Summary:
Minor fix to package.json which newer version of npm warn about when publishing, after running `npm pkg fix -ws` on the workspace.
{F1470070110}
## Changelog: [Internal] npm pkg fix -ws
Pull Request resolved: https://github.com/facebook/react-native/pull/43519
Test Plan: eyescloseddog
Reviewed By: cortinico
Differential Revision: D55012872
Pulled By: blakef
fbshipit-source-id: ff3c63a3eefaf56d369219a3d4b32d44d6d842c9
Summary:
This PR updates `typescript-eslint/eslint-plugin` and `typescript-eslint/parser` to `v7` and `eslint-plugin-jest` to `v27`, removing any dependencies on `typescript-eslint` `v6`, allowing projects using `react-native/eslint-config` to safely update to `typescript-eslint` `v7` without having to worry about duplicate major versions installed
## Changelog:
- [General] [Changed]: Updated `eslint-plugin-jest` to `v27`
- [General] [Changed]: Updated `typescript-eslint` monorepo to `v7`
Pull Request resolved: https://github.com/facebook/react-native/pull/43406
Test Plan: `yarn run lint` executed locally successfully
Reviewed By: robhogan
Differential Revision: D54749676
Pulled By: tdn120
fbshipit-source-id: f6fae92fc95333e28b36a3d2bd8470c8869d38bc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43385
`rncore` and `FBReactNativeComponentSpec` contain the same symbols, which leads to conflicts when we try to merge them into a single shared library. Cleanup the duplication and standardize on `FBReactNativeComponentSpec` everywhere. I've left the Android OSS targets as is, to avoid breaking deps.
Changelog: [Internal]
Reviewed By: cortinico, dmytrorykun
Differential Revision: D54630694
fbshipit-source-id: 75cb961ded9fd75508755c0530e29409fef801cf
Summary:
### Context
- Since RN 0.73, in the jest.setup file, methods of the Image module (Image.getSize, Image.resolveAssetSource...) are mocked on the **JS side** (introduced in https://github.com/facebook/react-native/pull/36996)
- It causes issues like https://github.com/facebook/react-native/issues/41907 : `Image.resolveAssetSource` returns nothing in test env with the new JS mock, when some test relies on it.
- On my project, it broke the snapshots : the URL of images disappeared. I use `react-native-fast-image` which uses `Image.resolveAssetSource` to compute URLs.
- I first opened a PR to fix exclusively Image.resolveAssetSource: https://github.com/facebook/react-native/pull/41957. I will close it to focus on this new one.
- As suggested by ryancat and idrissakhi, it should be better to return to the previous mock, where no method is mocked on the JS side, and we can trust the actual JS to work in test.
This is what this PR intends to do.
### Content
Along fixing the Image module mock in jest.setup, this PR :
- adds unit test on each one of the methods, ensuring they have a consistent behavior even when the module is mocked.
- adds 3 missing native mocks for `NativeImageLoader`: `prefetchImageWithMetadata`, `getSizeWithHeaders` & `queryCache`. After this PR, no method from NativeImageLoader remains unmocked.
## Changelog:
[GENERAL][FIXED] - fix jest setup for Image methods (resolveAssetSource, getSize, prefetch, queryCache)
Pull Request resolved: https://github.com/facebook/react-native/pull/43497
Test Plan:
See exhaustive unit tests in PR.
You can re-use the mock with all the methods mocked and see how the new unit tests fail.
I also patched those changes on my project: my snapshot did have their URL back (see demonstrative screenshots in my original PR: https://github.com/facebook/react-native/pull/41957 - NB; fixed mock was different but result was the same -> those screenshots cover only two cases, but anyway they illustrate well the case!)
Reviewed By: ryancat
Differential Revision: D54959063
Pulled By: tdn120
fbshipit-source-id: 837266bd6991eb8292d9f6af1774e897ac7a8890
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43504
Changelog: [internal]
We identified the issue in the experiments already, so we can remove this flag.
Reviewed By: sammy-SC
Differential Revision: D54945099
fbshipit-source-id: 4d547569eb3bbfd011f5d6894d87bfa542cac07b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43503
Changelog: [internal]
## Context
In the experiments to enable mount hooks on Android we saw some crashes that we couldn't reproduce or pinpoint accurately.
We ran another experiment excluding part of the code in one of the variants, and we found that the problem was in this block (only crashes when `skipMountHookNotifications` is false):
https://github.com/facebook/react-native/blob/121b26184acbb77ff4f2360647cb322ff560b145/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp#L726-L734
Looking more closely at the mounting coordinator code, I realized that some of the methods are not thread-safe, which is likely causing these issues.
~~We're probably only seeing these issues on Android because we have a push model there (we call `pullTransaction` from whatever thread we're committing to, JS thread or Fabric background thread) whereas in the rest of platforms we have a pull model and we always access call `pullTransaction` from the main thread, as we do to report mounts.~~
This is probably fine because both cases are protected by a mutex when accessing through `ShadowTreeRegistry::visit`. But there's a case that doesn't go through it that could be causing the issues: prerendering:
https://github.com/facebook/react-native/blob/121b26184acbb77ff4f2360647cb322ff560b145/packages/react-native/ReactCommon/react/renderer/scheduler/SurfaceHandler.cpp#L289
## Changes
1) Make `getBaseRevision` return a copy of the revision rather than a reference.
2) Make all methods that access `baseRevision_` and `lastRevision_` thread-safe.
Reviewed By: javache
Differential Revision: D54945100
fbshipit-source-id: d8b211137d0eac02a5814cc6c376c22733290eab
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43507
Changelog: [General][Changed] - sync React renderers to 18.3.0-canary-9372c6311-20240315
Syncs React renderers to https://github.com/facebook/react/commit/9372c63116fc1e855c51d93d83f5150661371ec3 which is canary for 18.3.0-canary-9372c6311-20240315.
This includes the necessary changes to enable the use of microtasks for scheduling in Fabric.
Reviewed By: yungsters
Differential Revision: D54947212
fbshipit-source-id: 8fd5def5107d77e6a248f653a9d0260b392fab6b
Summary:
This is causing Twilight Android app to hang and crash on start
Original commit changeset: 3f24271405f6
Original Phabricator Diff: D54905564
Reviewed By: sammy-SC
Differential Revision: D54960053
fbshipit-source-id: 5c1063f11ae1314e71288905eb6d8da32ddbfadd
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43511
Changelog: [Internal]
This is an attempt to fix [#39783](https://github.com/facebook/react-native/issues/39783).
It seems that when `configureBuildForHermes` runs (as part of `yarn android` in `rn-tester`) cmake may not be available and is not installed automatically:
* for 3p, even after installing the latest Android Studio, cmake 3.22.1 is not available by default but needs to be installed manually
* for Meta employees, same story when looking at the `ANDROID_HOME` set by the `setup_fb4a.sh` in the `.zshrc` file:
```
# added by setup_fb4a.sh
export ANDROID_SDK=/opt/android_sdk
export ANDROID_NDK_REPOSITORY=/opt/android_ndk
export ANDROID_HOME=${ANDROID_SDK}
export PATH=${PATH}:${ANDROID_SDK}/emulator:${ANDROID_SDK}/tools:${ANDROID_SDK}/tools/bin:${ANDROID_SDK}/platform-tools
```
This diff introduces an explicit task to install cmake.
### ALTERNATIVE 1
See D54897379.
### ALTERNATIVE 2
Suggested by cortinico:
> Create a mini module called :packages:react-native:ReactAndroid:hermes-engine:cmake-downloader which just triggers an empty cmake build via Android SDK
Reviewed By: cortinico
Differential Revision: D54859484
fbshipit-source-id: f9ecdf78ff408947b1e85e7da4f112c89d3a8c89
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43506
Changelog: [internal]
We've been making all the built-in C++ TurboModules in RN extend `enable_shared_from_this` because we copied from the same template that needed it, but none of them do. This removes that unnecessary extension.
Reviewed By: sammy-SC
Differential Revision: D54901332
fbshipit-source-id: 795c7696e70041d640399e3b9f177999e22fd90b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43470
Changelog: [internal]
This moves the native code for the Web Performance API to `ReactCommon`, to align with the other default C++ native modules we've defined there.
Reviewed By: sammy-SC
Differential Revision: D54860194
fbshipit-source-id: 32dccb080fb8ebd1e2acbdd59fa2dfe47e372c17
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43482
## Context
We are migrating to the new Hermes `CDPAgent` and `CDPDebugAPI` APIs in the modern CDP server (previously `HermesCDPHandler`).
## This diff
Now that we are confident that `CDPAgent` is stable, switch to it by default and remove the previous integration.
- Drop `inspectorEnableHermesCDPAgent` feature flag.
- Rename and replace `HermesRuntimeAgentDelegateNew` as `HermesRuntimeAgentDelegate`.
- Drop "Hermes integration: CDPAgent" log message.
- Update tests.
Changelog: [Internal]
Reviewed By: motiz88
Differential Revision: D54897841
fbshipit-source-id: 8a5212d27f21c54112c0820a2a3611e05d606880
Summary:
Changelog: [Internal]
TSIA - useful for the `console` test suite I'm currently writing (D54846940) which would be awkward to fit into `JsiIntegrationTest.cpp`.
bypass-github-export-checks
Reviewed By: huntie
Differential Revision: D54846938
fbshipit-source-id: 9e20bfae7c518b3822da468adf484e51cdc4d0b9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43459
Changelog: [General][Changed] - Console polyfill now copies all properties from the existing `console` object
Fusebox now exposes a full WHATWG `console` object integrated directly with CDP debugging (D54826073). Some WHATWG `console` methods are missing from React Native's polyfill/shim, so let's pass those through unmodified so they can still be called.
(Long term, we shouldn't need most of `console.js`, but let's get there gradually as there are many RN users still depending on `nativeLoggingHook` etc.)
NOTE: We also update the "bundled" copy of `console.js` that lives in the jsinspector-modern C++ test suite.
Reviewed By: huntie
Differential Revision: D54827902
fbshipit-source-id: c6c9128903496810192614f4f8d80b68b02e25c4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43495
## Changelog:
[Internal] -
Fixes build regression of RNTester on OSS, coming from D54764898.
NOTE: This is only Android bit for now, looking into the iOS one.
Reviewed By: cortinico
Differential Revision: D54908736
fbshipit-source-id: 70081d1378a56dd0df3f76322377f5a0e6615f80
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43461
Adds a regression test for the duplicate `scriptParsed` bug in Hermes (T182003727). In the process, we enable Hermes lazy compilation in all our CDPAgent JSI integration tests.
Changelog: [Internal]
Reviewed By: huntie
Differential Revision: D54852326
fbshipit-source-id: 52e23458d3e9e21902c3659fc944ef85c68731ac
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43496
This diff adds another sub-sub-spec to React-Fabric pod to fix import paths in `textinput`.
Changelog: [Internal]
Reviewed By: philIip, rshest
Differential Revision: D54918454
fbshipit-source-id: 3949f8b8b201157f4c9eb256f3eb5bd5d66bc228
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43438
changelog: [internal]
EventQueue can now be merged with BatchedEventQueue since there isn't anything else subclassing it.
Reviewed By: javache
Differential Revision: D54687859
fbshipit-source-id: f646583db0e46789b667f8d79d24d0cf9d7fc00c
Summary:
Changelog: [Internal]
We are currently eagerly constructing a `HermesRuntimeTargetDelegate` regardless of whether the Fusebox feature flags are enabled. This can interfere with the legacy CDP backend. Instead, let's lazily construct the target delegate in a code path that only runs when the modern backend is in use.
bypass-github-export-checks
Reviewed By: rozele
Differential Revision: D54907887
fbshipit-source-id: 7dc13506739866ea6690ed21d03d91ad24ef68c5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43487
Inconsistent between bridge and bridgeless, but if you forget to implement this interface, ReactDelegate will silently not do anything in bridgeless.
Changelog: [Android] Enforce Activities using ReactDelegate implement DefaultHardwareBackBtnHandler.
Reviewed By: arushikesarwani94
Differential Revision: D54900747
fbshipit-source-id: 5dd31d4f81e4ec37e1c3ee906be836a8a9c6a944
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43491
This diff brings back the `UNSET` constant to `TextAttributeProps`.
The removal of this constant was an unnecessary breaking change, that has broken several third-party libraries.
Changelog: [Android][Fixed] - Bring back the UNSET constant to TextAttributeProps.
Reviewed By: fabriziocucci
Differential Revision: D54899524
fbshipit-source-id: 368bde77d43f310fd458537d0191d09174fa5167
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43456
Changelog: [Internal]
Implements the [WHATWG `console` spec](https://console.spec.whatwg.org/) directly in `RuntimeTarget`, based on the Hermes-powered `addConsoleMessage` method first used in D54494298.
Benefits:
* This allows the console API to work independently of the polyfill shipped in RN, including very early during JS execution.
* It also opens the door to better stack traces (once we start reporting those) and richer functionality in the `console` object itself.
Reviewed By: robhogan
Differential Revision: D54826073
fbshipit-source-id: d5b0bd004bf35c2fce91742ae84ea86225ec1c61
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43486
We use `CopyOnWriteArrayList` in other places across the React Native codebase, as it assumes that reading happens more frequently than updating. This saves us from needing to synchronize and copy when we access the list of listeners.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D54806272
fbshipit-source-id: d1b54d532edb2af3391a7e4fdc758f705621227d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43478
This is rolled out internally already. Also exposing `memoryPressureRouter` to match the ReactInstanceManager interface.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D54802021
fbshipit-source-id: b74dcde71296d3925acfc2171d2a77d90960e15e
Summary:
Changelog: [Internal]
Adds a regression test for a Hermes CDPAgent bug using `JsiIntegrationTest`. See details in comments.
bypass-github-export-checks
Reviewed By: huntie
Differential Revision: D54890188
fbshipit-source-id: 325a32b83b145d2d35f99feaef9988028f15f196
Summary:
I was recently working on an [issue](https://github.com/software-mansion/react-native-reanimated/issues/5715) in Reanimated where z-index of some views was broken after a Layout Animation was used. The issue was that in some cases we were calling the `removeView` function on a already removed view. On plain Android this wouldn't be an issue, since the `removeView` function ignores such calls. Unfortunately, the `ReactViewGroup.java` implementation maintains a counter of views with user defined z-index. This counter is decremented whenever a call to `removeView` is made, even if the view is not a child of this `ViewGroup`. This PR adds an additional check in the `handleRemoveView` function to unify the `removeView` behavior between Android and react-native.
## Changelog:
[ANDROID] [CHANGED] - Changed the `handleRemoveView` function in `ReactViewGroup.java` to ignore calls for `Views` that are not children of this `ViewGroup`
Pull Request resolved: https://github.com/facebook/react-native/pull/43389
Test Plan: I tested if the `rn-tester` app behaves correctly after those changes.
Reviewed By: NickGerleman
Differential Revision: D54874780
Pulled By: javache
fbshipit-source-id: f1a34947419ef6106ee73b196ae99b7f8c2f7a77
Summary:
Implements the RFC which progressively provides warnings to users of the `npx react-native init` command as we gradually deprecate.
Changelog:
[General][Deprecated] - init cli deprecation logging
Reviewed By: cortinico
Differential Revision: D54423109
fbshipit-source-id: 679b6672bdbfc42a9b82a2aad38fd3253c6ea6a2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43357
This diff adds a class to get the needed RenderEffects to support CSS filters on Android. This diff does not add any of the plumbing for it to actually work, that comes in the next diff, but I figured this was complicated and isolated enough to be on its own.
Note that I did not add blur or drop shadow as those are a bit more involved and I plan on adding them later.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D54603892
fbshipit-source-id: 5780d7c846fdb1116e29e0a940ee02da609b01f5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43453
The forward declaration for RCTMountingManager doesn't appear to be used anywhere. It can be deleted.
## Changelog
[Internal]
Reviewed By: NickGerleman
Differential Revision: D54692764
fbshipit-source-id: ba8206408fdd515387a0a6aff6a3e43c51221e57
Summary:
When users create a new app, there is an option: Follow us on Twitter with the description. Twitter is X now.

## Changelog: [Internal]
Replace the Twitter link, title, and description with X.
Pull Request resolved: https://github.com/facebook/react-native/pull/43423
Test Plan: Set the environment for React Native app and then `npx react-native@latest init AwesomeProject`, `npm start`, and `npm run ios`
Reviewed By: cortinico
Differential Revision: D54850199
Pulled By: huntie
fbshipit-source-id: 424cb9212962d78a5b2d93d973f56498ba948136
Summary:
Changelog: [Internal]
Use our build script for packages and to generate the TypeScript types.
bypass-github-export-checks
Reviewed By: huntie
Differential Revision: D54428870
fbshipit-source-id: 2a1666d30ac472300979b2be078a906d390e919a