Commit Graph
30399 Commits
Author SHA1 Message Date
Jakub Trzebiatowski 6a8a28b80f CustomStyleSpan: Move the class comment (#42700)
Summary:
`CustomStyleSpan`: Move the class comment (it was misplaced)

## Changelog:

[INTERNAL] [FIXED] - `CustomStyleSpan`: Move the class comment

Pull Request resolved: https://github.com/facebook/react-native/pull/42700

Reviewed By: yungsters

Differential Revision: D53195908

Pulled By: NickGerleman

fbshipit-source-id: f77575e16f76871dcf10d75448282b2166003412
2024-01-31 15:01:22 -08:00
Blake Friedman 9c0fe734fb constrain on github.actor
Summary: Currently rejecting all users, use the [github.actor](https://docs.github.com/en/actions/learn-github-actions/contexts#github-context:~:text=The%20username%20of%20the%20user%20that%20triggered,run%20(github.triggering_actor)%20has%20different%20privileges.)

Reviewed By: hoxyq

Differential Revision: D53275232

fbshipit-source-id: 54bbbdb857db6c642814953832e0ffdc55505deb
2024-01-31 13:12:47 -08:00
Blake Friedman 82e9a5e4f7 Add Github Action to mirror partner's nightly CI results (#42744)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42744

This adds a nightlies-feedback workflow, which our partners can get permission to mirror the results of their nightlies CI workflows.  We do this to use our internal tools that are restricted to Meta owned Github projects.

The benefit to partners is that they can add this step to their workflow:

```
      - if: ${{ success() || failure() }}
        env:
          OUTCOME: ${{ contains(steps.*.conclusion, 'failure') && 'fail' || 'pass' }}
        run: |
          curl -X POST \
               -H "Accept: application/vnd.github.v3+json" \
               -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
               https://api.github.com/repos/facebook/react-native/actions/workflows/nightlies-feedback.yml/dispatches \
               -d "$(printf '{"ref":"main","inputs":{"outcome":"%s","stage":"needs_an_action","link":"http://github.com/some/action","version":"%s"}}' "$OUTCOME" "${{ inputs.version }}" )"

```

### Feedback:
It's complicated, but there are ways to simplify this for our users.  I'd like to prove out that it's valuable first with Expo.

### Limits:

There's certainly a lot of room for improvement, which we could provide with a published action (populate the ref correctly, simplify gathering the outcome, labelling of failing step correctly, etc...).

### Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53229996

fbshipit-source-id: 10e4ba5b5fd85935b1b03aaafa41ef8b96d2faca
2024-01-31 09:49:08 -08:00
generatedunixname89002005325672 7ea7904500 Daily arc lint --take KTFMT (#42772)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42772

Changelog: [Internal]

Reviewed By: bigfootjon

Differential Revision: D53257696

fbshipit-source-id: f384899361215288a3c9578ae22c9f097c4a3201
2024-01-31 09:36:16 -08:00
Riccardo Cipolleschi 68ae8cd5e9 Fix crash in the interop layer when components emits events as soon as are created (#42743)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42743

When working on Mobile Home, we found a component (RNCSafeAreaView) that was going through the interop layer.

The component eits an event as soon as its content view changes, but this is too early: the block that emits the event is still nil at that point in time and that makes the app crash.

There might be other components with similarbehavior, therefore, we are fixing it at the interop layer, setting the props immediately after the component is created.

## Changelog:
[iOS][Fixed] - Immediately set props of Components that goes through the interop layer

Reviewed By: sammy-SC

Differential Revision: D53230471

fbshipit-source-id: 90a19e0e87fea381b348b5a7e723ab8b416b828c
2024-01-31 09:09:36 -08:00
hurali97 ae42e0202d Changelog: 0.71.16 (#42759)
Summary:
## Changelog:

Changelog: [Internal] Generated changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

Pull Request resolved: https://github.com/facebook/react-native/pull/42759

Reviewed By: cortinico

Differential Revision: D53268094

Pulled By: huntie

fbshipit-source-id: a18d513df4614be1b7715c9c69d8de58baac9548
2024-01-31 07:27:06 -08:00
Rubén Norte c7bef93af0 Rename performance.reactNativeStartupTiming as performance.rnStartupTiming (#42762)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42762

This renames `performance.reactNativeStartupTiming` as `performance.rnStartupTiming` to align with the recommended vendor prefix for React Native.

This API is still private, so it's safe to rename.

Changelog: [internal]

Reviewed By: javache

Differential Revision: D53264515

fbshipit-source-id: 6e7a222901071594cac0ca8a0ac78e56e60ab132
2024-01-31 07:16:21 -08:00
Riccardo Cipolleschi 37cb84db96 Fix template jobs, broken for moved file (#42767)
Summary:
Some jobs are failing because we moved a file and we did not update the CI with the new path

## Changelog:
[Internal] - Update path to relocated file in CI

Pull Request resolved: https://github.com/facebook/react-native/pull/42767

Test Plan: CircleCI is green (a part from test_android, fixed by another PR)

Reviewed By: huntie, dmytrorykun

Differential Revision: D53266042

Pulled By: cipolleschi

fbshipit-source-id: 7e611b96c204cdbbf794a731fe0db58cb31657fb
2024-01-31 06:31:46 -08:00
Nicola Corti 123934581b Fix broken test_android on main (#42763)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42763

Fix broken test_android on main

Changelog:
[Internal] [Changed] - Fix broken test_android on main

Reviewed By: cipolleschi

Differential Revision: D53264488

fbshipit-source-id: 58e0f3512878aa424bb6e1f0c930ff6c0769ee43
2024-01-31 05:30:35 -08:00
Alex Hunt b7b55854fe Enable Flow on misc release scripts (#42736)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42736

- Minimally enable Flow in these scripts. This would have caught outdated imports in D53001971 and D53228096.
- Update `publish-npm` script with async `main()` function.
- Also delete leftover `ReactNativeVersion.js.template` file.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D53225162

fbshipit-source-id: 9521291b7c84728e3e05af510ebf3244a9a189e5
2024-01-31 03:36:02 -08:00
zhongwuzw 0bbc311c8a Fixes root view's background color in bridgeless mode (#42739)
Summary:
Fixes root view's background color in bridgeless mode, the top area has white background color when in dark mode.

Before:
![Simulator Screenshot - iPhone 15 - 2024-01-30 at 23 28 48](https://github.com/facebook/react-native/assets/5061845/4359385d-370d-48cf-a58e-e2e9eb871400)

After:
![Simulator Screenshot - iPhone 15 - 2024-01-30 at 23 25 39](https://github.com/facebook/react-native/assets/5061845/5e9d2029-43d2-40c3-b2cb-c8a9ee80a5e1)

## Changelog:

[IOS] [FIXED] - [iOS] Fixes the root view's background color in bridgeless mode

Pull Request resolved: https://github.com/facebook/react-native/pull/42739

Test Plan: Run RNTester and see the top area's background color.

Reviewed By: cortinico

Differential Revision: D53263621

Pulled By: javache

fbshipit-source-id: f18128464c9171ba8e0f6858c0608ce757349d27
2024-01-31 03:25:24 -08:00
ankit-tailor 8fca1c5854 fix: font variant typings (#42760)
Summary:
This PR fixes the typings for `fontVariant` style prop. Flow file has below typings but they were missing in typescript file.

```
  fontVariant?:
  | 'small-caps'
  | 'oldstyle-nums'
  | 'lining-nums'
  | 'tabular-nums'
  | 'common-ligatures'
  | 'no-common-ligatures'
  | 'discretionary-ligatures'
  | 'no-discretionary-ligatures'
  | 'historical-ligatures'
  | 'no-historical-ligatures'
  | 'contextual'
  | 'no-contextual'
  | 'proportional-nums'
  | 'stylistic-one'
  | 'stylistic-two'
  | 'stylistic-three'
  | 'stylistic-four'
  | 'stylistic-five'
  | 'stylistic-six'
  | 'stylistic-seven'
  | 'stylistic-eight'
  | 'stylistic-nine'
  | 'stylistic-ten'
  | 'stylistic-eleven'
  | 'stylistic-twelve'
  | 'stylistic-thirteen'
  | 'stylistic-fourteen'
  | 'stylistic-fifteen'
  | 'stylistic-sixteen'
  | 'stylistic-seventeen'
  | 'stylistic-eighteen'
  | 'stylistic-nineteen'
  | 'stylistic-twenty';
```

## Changelog:

[GENERAL] [ADDED] - Added missing typings for fontVariant style prop.

Pull Request resolved: https://github.com/facebook/react-native/pull/42760

Test Plan: Tested manually.

Reviewed By: cortinico

Differential Revision: D53263569

Pulled By: javache

fbshipit-source-id: b127e0377cf9ceb50d094294d188f87a23038e5b
2024-01-31 03:13:18 -08:00
Kevin Gozali 841e00edaf iOS: RCTImageLoader: use static request counter for request IDs (#42720)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42720

The request ID was used for in-memory request caching purpose only. There wasn't much reason to use the sophisticated monotonic number, so let's just use a static 64-bit unsigned int counter. With the more-or-less unique UUID prefix, this should have an extremely low chance of collision.

Changelog: [Internal]

Reviewed By: philIip, sammy-SC

Differential Revision: D53205641

fbshipit-source-id: e6da12029624058dc877e9cbe2000af4df938870
2024-01-30 23:05:59 -08:00
David Vacca 25c5d1c341 Mark classes of package animated as @Nullsafe (#42727)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42727

All these classes are NullSafe, let's mark them as NullSafe(Local) to ensure lint detect errors in the future

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D53200096

fbshipit-source-id: 2d965ebcb568e7bbff4b37db11070c5079fa6394
2024-01-30 17:26:31 -08:00
David Vacca 6cae417828 Fix wrong type in kotlin (#42726)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42726

initHybrid always return a HybridData. we shouldn't allow null here.

changelog: [internal] internal

Reviewed By: cortinico, NickGerleman

Differential Revision: D53200101

fbshipit-source-id: 284a69c48928e88ad35c1f52cbf01afbfb1ea818
2024-01-30 17:26:31 -08:00
David Vacca db6c98eac1 Deprecate com/facebook/react/config/ReactFeatureFlags (#42718)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42718

Deprecate com/facebook/react/config/ReactFeatureFlags, to be replaced by com.facebook.react.internal.featureflags.ReactNativeFeatureFlags

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D53199655

fbshipit-source-id: 32bdc526e377ff70e2df3c97a259066a25180231
2024-01-30 15:46:23 -08:00
Jack Pope c7479b07ae Add react-native-test-renderer package (#42644)
Summary:
The goal is to provide testing utilities that use Fabric and concurrent rendering by default to support the new RN architecture. Currently most testing is done through ReactTestRenderer, which is an overly-simplified rendering environment, non-concurrent by default, and over exposes internals. A dedicated RN environment in JS can allow for more realistic test execution.

This is the initial commit to create the `react-native-test-renderer` package. It currently only offers a simple toJSON() method on the root of a test, which is used for snapshot unit tests. We will be iterating here to add a query interface, event handling, and more.

## Changelog:
[GENERAL] [ADDED] - Added react-native-test-renderer package for Fabric rendered integration tests

Pull Request resolved: https://github.com/facebook/react-native/pull/42644

Test Plan:
```
$> cd packages/react-native-test-renderer
$> yarn jest
```

Output:

```
 PASS  src/renderer/__tests__/render-test.js
  render
    toJSON
      ✓ returns expected JSON output based on renderer component (7 ms)

Test Suites: 1 passed, 1 total
1 passed, 1 total
Snapshots:   1 passed, 1 total
Time:        2.869 s
```

Reviewed By: yungsters

Differential Revision: D53183101

Pulled By: jackpope

fbshipit-source-id: 8e29ba35f55f6c4eb2613ab106bc669d72f33d1d
2024-01-30 12:54:26 -08:00
Alex Hunt 2f818b464f Fix import in publish-npm script (#42740)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42740

Follow-up to a CircleCI breakage introduced by D53001971.

This was missed by both the typechecker (no Flow in file) and CI (no PR-time jobs covering this script).

Changelog: [Internal]

Reviewed By: cortinico, GijsWeterings, cipolleschi

Differential Revision: D53228096

fbshipit-source-id: fbbe1538ee52b8452399d86489239434d3a068be
2024-01-30 10:59:02 -08:00
Rubén Norte 2108269ea8 Move flags unused in OSS from legacy ReactNativeFeatureFlags (JS) to the new system (#42433)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42433

Changelog: [internal]

The only flags we know are being [assigned](https://github.com/search?type=code&q=%2FReactNativeFeatureFlags%5C.%5Cw%2B+%3D%2F+lang%3AJavaScript+NOT+path%3AReactNative%2FReactNativeFeatureFlags.js+NOT+path%3Apackages%2Freact-native+NOT+is%3Afork) in OSS are:
* `shouldEmitW3CPointerEvents`
* `shouldPressibilityUseW3CPointerEventsForHover`

So we can migrate all the rest relatively safely.

Reviewed By: javache

Differential Revision: D52905703

fbshipit-source-id: 5c9689f1d3a6133ee7c4a057437cf2ce4f8cddf5
2024-01-30 09:50:24 -08:00
zhongwuzw 3d71b11e84 Fixes semantic color not work when dark mode changed (#42737)
Summary:
When we changed dark mode, the semantic color was not applied because we use color components, it's not dynamic. So let's store the `UIColor` for semantic color directly.

https://github.com/facebook/react-native/assets/5061845/bd6d15fe-01eb-4ad7-9844-a19ef8585dae

## Changelog:

[IOS] [FIXED] - [Fabric] Fixes semantic color not work when dark mode changed

Pull Request resolved: https://github.com/facebook/react-native/pull/42737

Test Plan: semantic color changed when switch dark mode.

Reviewed By: christophpurrer

Differential Revision: D53226806

Pulled By: cipolleschi

fbshipit-source-id: 66d5417fa1bb6a5da498e903675a93b20d920c0a
2024-01-30 09:27:18 -08:00
Pieter De Baets c1c1f0d6b9 Use xplat-init for internal builds (#42738)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42738

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D53087308

fbshipit-source-id: a1d9365fe74ada58d94719a8598134a1a6cd6067
2024-01-30 09:26:56 -08:00
Moti Zilberman b7025fe156 Create stub InstanceTarget, send execution context notifications (#42636)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42636

Changelog: [Internal]

Models the Native instance lifecycle in the modern CDP backend, by:

1. Registering the instance, once created, with `PageTarget`.
2. While an instance is registered, delegating messages from `PageAgent` to an internal `InstanceAgent`.
3. Unregistering the instance once it is invalidated and about to be destroyed.

We use this infrastructure to implement two simple behaviours that will be superseded in future diffs (mainly by delegating work to the JSVM), but that are useful as stubs for testing:

* Sending [`Runtime.executionContextDestroyed`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Runtime#event-executionContextDestroyed), [`Runtime.executionContextsCleared`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Runtime#event-executionContextsCleared), and [`Runtime.executionContextCreated`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Runtime#event-executionContextCreated) events to the frontend when reloading the instance.
* Implementing a toy version of [`Runtime.getHeapUsage`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Runtime#method-getHeapUsage) (that always reports zero memory usage) to exercise the Page→Instance message dispatching logic.

iOS Bridge/Bridgeless and `PageTargetTest` are the only integrations that exist as of this diff, and are all updated here; Android will follow later.

## Object lifetimes

* PageTarget owns an InstanceTarget that it creates (in `registerInstance`) and destroys (in `unregisterInstance`).
* `registerInstance` returns a raw `InstanceTarget&` reference, which becomes invalid upon calling `unregisterInstance`. It's the caller's responsibility to stop using the reference at the point of calling `unregisterInstance`.
* InstanceTarget holds a raw `InstanceTargetDelegate&` reference. It's the caller's responsibility to keep this reference valid at least until `unregisterInstance` returns.

## Thread safety

* As with PageTarget's constructor and destructor, It's the caller's responsibility to invoke `registerInstance` and `unregisterInstance` on the main thread (or using appropriate synchronisation).
* `InstanceAgent` handles messages on the same thread as `PageAgent` (typically the platform-specific main thread) and receives a copy of the same thread-safe `FrontendChannel` for sending messages back.

Reviewed By: huntie

Differential Revision: D51214056

fbshipit-source-id: 2dc2ff30d2dda6887871831a818aa117ca3e6e91
2024-01-30 08:56:17 -08:00
Riccardo Cipolleschi c5258b5b2a Exclude platform/windows from React-graphics
Summary:
Internally, we synched the windows folders in react-native. This added the `windows` folder in the `platform` folder of react/graphics.

This breaks the build for iOS internally as the `React-graphics` pod is now importing both the `ios` and the `windows` folders, but, of course, some of the Windows headers are not available to iOS.

This change excludes the windows folder from the iOS Pod, when building for Meta engineers.

## Changelog:
[internal] - exclude the `plafrom/windows` folder from the `React-graphics` pod.

Reviewed By: motiz88

Differential Revision: D53228890

fbshipit-source-id: 2be5b71f6556e5da76496f0d64a98318477ad3c5
2024-01-30 08:36:19 -08:00
Pieter De Baets 650541222d Change null-check in DefaultComponentsRegistry (#42731)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42731

This matches the behaviour we have for DefaultTurboModuleManagerDelegate, where we handle the lack of this being set gracefully. It's probably worth still logging this, as it may point at an incorrectly configured app.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D53048064

fbshipit-source-id: 3ef10da3a7779a1274a1a1793387cf8cdf36c535
2024-01-30 07:59:59 -08:00
Nicola Corti 2f523f0acf Bump FBJNI to 0.6.0 (#42735)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42735

This realigns the NDK versions used to build the two tools.

Changelog:
[Internal] [Changed] - Bump FBJNI to 0.6.0

Reviewed By: cipolleschi

Differential Revision: D53223301

fbshipit-source-id: 640e9008ed460e58423fb26b6e7030e264ef9320
2024-01-30 07:34:46 -08:00
D N b133bf6024 fix: [TS] Update translateX & translateY types to support % (#42671)
Summary:
After update to the latest `react-native` version
we discover that we are unable to use `number%` value for `translate*` props :

```tsx
StyleSheet.create({
  root: {
    transform: [
      { translateX: '-50%'  },
      // ^^^^^^ TS Error: Type string is not assignable to type AnimatableNumericValue | undefined
    ],
  }
});
```

 ---

percentage values are supported, demo: https://snack.expo.dev/retyui/test-tstransform

## Changelog:

[GENERAL] [FIXED] - Update typescript definition of `translateX` & `translateX` to be able to use percentage values

Pull Request resolved: https://github.com/facebook/react-native/pull/42671

Test Plan: `yarn tsc --noEmit`

Reviewed By: rozele, cortinico

Differential Revision: D53146046

Pulled By: NickGerleman

fbshipit-source-id: 3486e7a9b55b98c36cc96b2bca4bb27841061e80
2024-01-30 07:10:47 -08:00
Alex Hunt e97ba475aa Relocate and refactor set-rn-version script (#42730)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42730

Reviewing and modernising this script as part of simplifying our release publish workflow.

- Drop unused `--dependency-versions` arg from CLI entry point
- Simplify templating approach
- Type as Flow
- Drop dependencies on `shelljs` and `yargs`
- Relocate under `scripts/releases/`
- Rewrite tests as snapshot tests

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D53001971

fbshipit-source-id: e55a71a0bb37e3e18ba1e582a5c46ddd58823d81
2024-01-30 06:46:50 -08:00
Rubén Norte 9ef6d606a7 Fix broken ReactNativeFeatureFlagsTest test on iOS (#42699)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42699

Changelog: [internal]

The test was fine on C++. The reason is probably that C++ destroys the process between tests (effectively resetting singletons) while iOS doesn't.

This fixes the test by implementing a correct `TearDown` method to reset the flags.

Reviewed By: rshest

Differential Revision: D53178474

fbshipit-source-id: 6a0f67f1a59fe47f73a495344d4c0daa8eafa3c4
2024-01-30 06:09:27 -08:00
zhongwuzw 4c108aaae4 Add Fabric dynamic color support (#42117)
Summary:
Fixes https://github.com/facebook/react-native/issues/42006 .

## Changelog:

[IOS] [ADDED] - Add Fabric dynamic color support

Pull Request resolved: https://github.com/facebook/react-native/pull/42117

Test Plan:
Dynamic color worked.

![image](https://github.com/facebook/react-native/assets/5061845/c6e988c1-9d6b-4c09-a5e9-2f1960bbfcc5)

![image](https://github.com/facebook/react-native/assets/5061845/dcccdef7-990b-4367-b21f-38cabc7040ae)

Reviewed By: javache, sammy-SC

Differential Revision: D52512672

Pulled By: cipolleschi

fbshipit-source-id: f91da08e0bdd07a987289bd82585722496bdc280
2024-01-30 05:29:56 -08:00
Oskar Kwaśniewski d00d35e872 Fix retrieving current appearance in multi-window apps (#42231)
Summary:
This PR resolves issues with retrieving appearance in multi-window apps by calling `RCTKeyWindow()` instead of retrieving the AppDelegate window property. It also does small optimization in the RCTAlertController.

## Changelog:

[IOS] [FIXED] - Fix retrieving current appearance in multi-window apps

Pull Request resolved: https://github.com/facebook/react-native/pull/42231

Test Plan: CI Green, it should work the same as before

Reviewed By: NickGerleman

Differential Revision: D52802756

Pulled By: cipolleschi

fbshipit-source-id: 60b5f7045f41be19caae5102f0dc321d4ecdcd2f
2024-01-30 04:52:34 -08:00
ankit-tailor fb5f79ceb5 fix: fontWeight typings (#42707)
Summary:
This PR fixes the typings for `fontWeight` style prop. Flow file has below typings but they were missing in typescript file.

```
  fontWeight?:
    | 'normal'
    | 'bold'
    | '100'
    | '200'
    | '300'
    | '400'
    | '500'
    | '600'
    | '700'
    | '800'
    | '900'
    | 100
    | 200
    | 300
    | 400
    | 500
    | 600
    | 700
    | 800
    | 900
    | 'ultralight'
    | 'thin'
    | 'light'
    | 'medium'
    | 'regular'
    | 'semibold'
    | 'condensedBold'
    | 'condensed'
    | 'heavy'
    | 'black'
    | undefined;
```

## Changelog:

[GENERAL] [ADDED] - Added missing typings for fontWeight style prop.

Pull Request resolved: https://github.com/facebook/react-native/pull/42707

Test Plan: Tested manually.

Reviewed By: cortinico

Differential Revision: D53191119

Pulled By: NickGerleman

fbshipit-source-id: 47c00ea81be5aa217d57be0609cfc7bd4e8e6843
2024-01-30 04:21:30 -08:00
Riccardo Cipolleschi fe337f25be Make bridgeless the default when the New Arch is enabled (#42714)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42714

For 0.74, we would like to have Bridgeless as the default when the New Architecture is enabled.

## Changelog:
[Android][Breaking] - Make bridgeless the default when the New Arch is enabled

Reviewed By: cortinico

Differential Revision: D52600227

fbshipit-source-id: 0d967c73cd805710c501c020ad892f059a0fb117
2024-01-30 03:35:11 -08:00
Riccardo Cipolleschi c91af773fa Make bridgeless the default when the New Arch is enabled (#42182)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42182

For 0.74, we would like to have Bridgeless as the default when the New Architecture is enabled.

## Changelog:
[iOS][Breaking] - Make bridgeless the default when the New Arch is enabled

Reviewed By: cortinico

Differential Revision: D52598104

fbshipit-source-id: a551bbdda7f7b76d1647036137983e39e612ea45
2024-01-30 03:35:11 -08:00
Riccardo Cipolleschi 8d710bfaca Refactor RCT_handleKeyCommand to avoid concurrency issues (#42708)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42708

When pressing `r` on simulator in Bridgeless mode, we have a race condition between:
- RCTKeyCommands evaluating the blocks to be invoked
- ReactNative invalidating the DevMenu with the list of RCTKeyCommands (on which ReactNative is iterating).

The fix checks which commands need to be executed, stores them in an array and then iterates on the array, which is local to the function call, avoiding any concurrency issue.

## Changelog:
[iOS][Fixed] - Refactored RCT_handleKeyCommand to avoid concurrency issues

Reviewed By: motiz88

Differential Revision: D53186262

fbshipit-source-id: 60ae8974a9df7289395c8a9e9abe2e34e4c40309
2024-01-30 03:12:50 -08:00
Ramanpreet Nara 8a8f74b7b2 Deprecate UIManager.{show,dismiss}PopupMenu
Summary:
This API is better implemented as a component: PopupMenuAndroid. Please see the ancestor diff D52712758.

Changelog: [Android][Deprecated] Deprecate UIManager.showPopupMenu, and UIManager.dismissPopupMenu

Reviewed By: mdvacca

Differential Revision: D52887565

fbshipit-source-id: 42da6bdaa707395c5694ec8ae3eb77b64cdefb69
2024-01-29 18:54:14 -08:00
Ramanpreet Nara 35308a73a5 Open source PopupMenuAndroid
Summary:
In React Native 0.75, we will remove UIManager.showPopupMenu(), UIManager.dismissPopupMenu().

To replace that API, we are introducing this <PopupMenuAndroid> component. This component works in both Fabric and Paper!

For the usage, please see PopupMenuAndroidExample.js.

Changelog: [Android][Added] - Introduce PopupMenuAndroid to replace UIManager.showPopupMenu()

Reviewed By: mdvacca

Differential Revision: D52712758

fbshipit-source-id: a87628a168d64fabbcc4d0f7b694fa639a927448
2024-01-29 18:54:14 -08:00
Ramanpreet Nara 7f549ec7be Deprecate BatchedBridge.registerCallableModule (#42717)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42717

This diff introduces a new bridge/bridgeless-agnostic api for registering JavaScript modules with React Native.

Usage:
```
import {registerCallableModule} from 'react-native';

registerCallableModule('FooModule', () => {...});
registerCallableModule('BarModule', {...});
```

Changelog: [General][Deprecated] - Deprecate BatchedBridge.registerCallableModule. Please use registerCallableModule instead

Reviewed By: javache

Differential Revision: D52805387

fbshipit-source-id: c7e77f0450ce1b0de349fa540c3a812256da054f
2024-01-29 18:41:54 -08:00
Nick Gerleman daa308027a Migrate enableSpannableBuildingUnification to new feature flag system (#42716)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42716

Migrates this to the new flag system just added.

Made a quick change to the Android template, to mark Kotlin accessors as `JvmStatic` to make calling from Java more idiomatic.

Next diff will wire to MC.

Changelog: [Internal]

Reviewed By: rubennorte, mdvacca

Differential Revision: D53198874

fbshipit-source-id: 6ab5b279d9ac59733c6e820c25be72383ce0e54a
2024-01-29 18:15:22 -08:00
Nick Gerleman bc6105016c Add standards based lexer/tokenizer for CSS values (#42626)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42626

Right now this is done by some combination of string splitting, JS side regexing, etc. This will not scale for math expressions, and gets more and more annoying when we try to add more.

In preparation for adding more units, this adds a tokenizer/lexer for a subset of CSS grammar, based on the spec. This is not hooked up to anything yet, and doesn't add a parser.

The algorithm uses a subset of the comprehensive instructions provided at https://www.w3.org/TR/css-syntax-3/#tokenizer-algorithms as a reference, with some major simplifications.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D53030661

fbshipit-source-id: c48bc572c5e02daee0b05e91830f2441528193d1
2024-01-29 17:47:30 -08:00
Nick Gerleman 359738b6ca Remove redundant std::hash enum specializations (#42651)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42651

Lots of boilerplate to define hash functions for different enums, so we can use them in `hash_combine`. This should not be needed, and seems like it might have been an artifact of older C++ version of standard library with bugs.

https://en.cppreference.com/w/cpp/utility/hash

> In addition to the above, the standard library provides specializations for all (scoped and unscoped) enumeration types. These may be (but are not required to be) implemented as std::hash<std::underlying_type<Enum>::type>.

Also moves `hash_combine` SFINAE to concepts for clarity and better error messages.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D53074535

fbshipit-source-id: 5fcb653dbe4aa51aa3d9d96f1511da3b7541270d
2024-01-29 17:39:49 -08:00
Nick Gerleman 3a789a1776 Fixup bad ANDROIDLINT Automatic Fix (#42694)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42694

D53115471 commited all the automatically fixable lints by `ANDROIDLINT`. When I looked again, closer, there was one automatic fix that I'm fairly sure is incorrect.

Before:

`outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));`

After:

`outTransform.postTranslate((dx + 0.5f), (dy + 0.5f));`

I think the linter did this because the underlying API accepts a float, so this was (incorrectly) seen as an extraneous cast causing precision loss, but the previous behavior was using the cast and addition to round the float, instead of adding 0.5 to it.

This replaces the call with an explicit rounding, for the same behavior as before (though, I'm not sure if the rounding is intentional, since in and out are both fp).

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D53158801

fbshipit-source-id: d268a5c429663dd7da0bfce2d717589986601196
2024-01-29 13:27:11 -08:00
Samuel Susla 29df29f5e2 update react fabric renderers (#42712)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42712

changelog: [General][Changed] react@18.3.0-canary-b2d637128-20240123

Move open source React renderer to react@18.3.0-canary-b2d637128-20240123

Reviewed By: javache

Differential Revision: D53085842

fbshipit-source-id: adbf04aae12a626e88c6a4e16f78b28787f7ce12
2024-01-29 12:47:55 -08:00
Samuel Susla 39cb02f6f1 explicitly dirty yoga node when cloned in case parent is dirty (#42711)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42711

changelog: [internal]

Reviewed By: NickGerleman

Differential Revision: D53130776

fbshipit-source-id: b85a90835698ef5199622edcb64f64273d32724a
2024-01-29 12:30:12 -08:00
Riccardo Cipolleschi 5bf5f4b150 Remove dependency on PropsParserContext (#42616)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42616

PropsParserContext is an entity in Core with a lot of baggage. We used it in graphics only to access the `surfaceId` and the `contextContainer`. We don't need to bring to graphics the whole dependencies of core due to these two parts.

This change break the dependency by passing along only the elements that we actually need.

## Changelog
[Internal] - break dependencies between graphics and core by removing the include of the PropsParserContext

Reviewed By: sammy-SC

Differential Revision: D52999204

fbshipit-source-id: a4b92fc11238f5caa63e39a6e286273ab671c8de
2024-01-29 12:03:27 -08:00
Ilia Vorobev 5d559c1ff4 Removes QPL from github (#42641)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42641

This removes QPL from public github repo
Changelog: [internal]

Reviewed By: rubennorte

Differential Revision: D53041914

fbshipit-source-id: 68bea613fd50242233145cbfb34f483b01c8e086
2024-01-29 11:48:27 -08:00
Blake Friedman 55978804dc Changelog: 0.73.3 (#42709)
Summary:
## Changelog: [Internal] Generated changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

Pull Request resolved: https://github.com/facebook/react-native/pull/42709

Reviewed By: huntie

Differential Revision: D53188549

Pulled By: blakef

fbshipit-source-id: 4d5eab7d393777d14c2848b33626dfa7c3be5b02
2024-01-29 11:13:55 -08:00
HoonJoo 6f7e8e17e2 fix: community cli plugin homepage url in package.json (#42696)
Summary:
fixed homepage url in package.json file of community cli plugin.

## Changelog:
[GENERAL][CHANGED] - changed community cli plugin homepage url.
<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

Pull Request resolved: https://github.com/facebook/react-native/pull/42696

Test Plan: community-cli-plugin homepage url must be opened correctly.

Reviewed By: rubennorte

Differential Revision: D53179709

Pulled By: huntie

fbshipit-source-id: 7949a897d4fe1da228fce323fa8bb32640194273
2024-01-29 07:36:45 -08:00
szymonrybczak 93dc3ee691 fix: update error message to use npx when calling react-native (#42691)
Summary:
Just small fix for those who are copy & pasting commands from error message.

## Changelog:

[INTERNAL] [CHANGED] - Update erorr message to use `npx` when calling `react-native`

Pull Request resolved: https://github.com/facebook/react-native/pull/42691

Test Plan: _

Reviewed By: cipolleschi

Differential Revision: D53177186

Pulled By: cortinico

fbshipit-source-id: e680cde81fde1f560dfeb1a85c8ad90090d69653
2024-01-29 07:34:58 -08:00
Dmitry Rykun b32c6c2cc1 Event name normalization (#42586)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42586

Every event name must be normalized.

The normalization strategy is:
1. If it starts with `top` -> do nothing.
2. If it starts with `on` -> replace `on` with `top`.
3. Else -> capitalize the first character and prepend `top`.

We have it for the old renderer on iOS [here](https://github.com/facebook/react-native/blob/a7586947d719a9cd2344ad346d271e7ca900de87/packages/react-native/React/Base/RCTEventDispatcher.m#L12-L21). This one is also used by the interop layer.
Static ViewConfigs being a part of the new renderer [replicate](https://github.com/facebook/react-native/blob/a7586947d719a9cd2344ad346d271e7ca900de87/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js#L164-L172) this behavior to match the old rendered.

The Android that we have is incomplete, it is missing the [*2. If it starts with `on` -> replace `on` with `top`*]. This means that some events names that worked with the old renderer would not be compatible with the new renderer + Static ViewConfigs. Specifically every event names that start with `on`.

This diff implements event name normalization on Android.

Changelog: [Internal] - Update event normalization algorithm to match SVCs.

Reviewed By: cortinico

Differential Revision: D50604571

fbshipit-source-id: cef34d8baa2cf31f641be423a16bca7ea9fa20c4
2024-01-29 07:01:26 -08:00
Alex Hunt 273ce836a1 Skip unsupported Flow syntax in public-api-test (#42667)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42667

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D53091943

fbshipit-source-id: afbde589d2fce705f6907de929f291e7862c4258
2024-01-29 06:47:49 -08:00