Commit Graph
36354 Commits
Author SHA1 Message Date
aleqsioandFacebook GitHub Bot 4cc9db1cd5 Fix disappearing redbox on initial load of an invalid bundle. (#50867)
Summary:
Right now having a javascript error like an invalid import statement during first bundle load results in a disappearing redbox screen.

https://github.com/user-attachments/assets/ab9c64f5-6e32-481c-a58f-6d37bb920acb

The `invalidate` call removed in this PR cleans up all turbomodules, including the RedBox module, which in turns calls `dismiss` in `RCTRedBox`.

After removing this line the result is as following:

https://github.com/user-attachments/assets/6eeb4d43-f883-440f-ade3-5628f85f833a

I made sure that the `invalidate` function is still called when executing only two possible ways to reload the bundle:
- the Reload button
- Cmd+R

The HMR/hot reload is not connected if the bundle has an error on initial load, so we don't need to worry about it.

Longer term, it would be better to establish HMR and use a different redbox in this case:

![simulator_screenshot_DFF4EA47-DA12-46A9-81DF-9904B35EB1D9](https://github.com/user-attachments/assets/c46eb0e9-845a-4b62-96e2-74215cbdad18)

Doing this requires larger changes to the bundle loading flow – happy to to try and land that change if there's any guidance you could give.

## 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
-->

[IOS][FIXED] – Fix disappearing redbox on initial load of an invalid bundle.

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

Test Plan: I have tested this change using RN from main and RNTester app (see videos).

Reviewed By: cortinico

Differential Revision: D73511154

Pulled By: cipolleschi

fbshipit-source-id: dfe149ebc15d845f07fd3926db2e063b468870af
2025-04-24 08:54:09 -07:00
Dawid MałeckiandFacebook GitHub Bot 3e14d1638c Add babel plugin to @react-native/babel-preset for console.warn injection under deep react native imports (#50802)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50802

The plugin analyses the source of all `import`, `require`, and `export` statements and injects the `console.warn` statement for each path targeting deep react-native source code. It runs only on a dev mode so there is no need to keep that in the `if (__DEV__) ` block. It is possible to disable this plugin by setting `disableDeepImportWarnings: true` and **resetting** the Metro cache:

```js
module.exports = {
  presets: [['module:react-native/babel-preset', {
    "disableDeepImportWarnings": true
  }]],
};
```

Changelog:
[General][Internal] - Added plugin to react-native/babel-preset injecting `console.warn` for each react native deep import in dev mode.

For a given code:
```js
import { Image } from 'react-native';
import View from 'react-native/Libraries/Components/View/View';
const Text = require('react-native/Libraries/Text/Text');
export { PressabilityDebugView } from 'react-native/Libraries/Pressability/PressabilityDebug';
```

The transformed output should look like:

```js
import { Image } from 'react-native';
import View from 'react-native/Libraries/Components/View/View';
const Text = require('react-native/Libraries/Text/Text');
export { PressabilityDebugView } from 'react-native/Libraries/Pressability/PressabilityDebug';
console.warn("Deep imports from the 'react-native' package are deprecated ('react-native/Libraries/Components/View/View').");
console.warn("Deep imports from the 'react-native' package are deprecated ('react-native/Libraries/Text/Text').");
console.warn("Deep imports from the 'react-native' package are deprecated ('react-native/Libraries/Pressability/PressabilityDebug').");
```

For more information about why this plugin was needed, please check [RFC](https://github.com/react-native-community/discussions-and-proposals/pull/894).

Reviewed By: huntie

Differential Revision: D70783145

fbshipit-source-id: ae145db6471d861099566a8faf2fbd93bd136450
2025-04-24 08:04:21 -07:00
Wojciech LewickiandFacebook GitHub Bot bef5cc1007 fix: build proper hermes for all debug variants (#50897)
Summary:
When building hermes from source in a project that has a debug scheme not named strictly "Debug", hermes is built with wrong flags which makes the compilation fail. We should use a better check for such cases, analogous to https://github.com/facebook/react-native/blob/ec43150b2a8db3a93137ae69ac414859a2fff73e/packages/react-native/scripts/react-native-xcode.sh#L16. I haven't found any other usages of this pattern: https://github.com/search?q=repo%3Afacebook%2Freact-native%20%24CONFIGURATION&type=code, hopefully other places use the correct semantics already.

## Changelog:

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

Pick one each for the category and type tags:

[IOS] [FIXED] - properly check for debug schemes when building hermes from source

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

[IOS] [FIXED] - properly check for debug schemes when building hermes from source

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

Test Plan: Use e.g. https://github.com/martinlAP/keyboardcrash with `Dev-Debug` scheme and try to build hermes from source based on https://github.com/facebook/hermes/blob/rn/0.79-stable/doc/ReactNativeIntegration.md. to see that it fails without this PR.

Reviewed By: rshest

Differential Revision: D73579031

Pulled By: cortinico

fbshipit-source-id: 3a48c6fe63f78fbc9cf566d300b9518aa9abdd89
2025-04-24 06:15:42 -07:00
Samuel SuslaandFacebook GitHub Bot 51091d434a add a view culling test case when for reparenting a culled grand (#50894)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50894

changelog: [internal]

adding more tests to cover all branches of `calculateShadowViewMutationsFlattener`.

calculateShadowViewMutationsFlattener is over 400 lines of code and covers quite a few edge cases. I plan to cover every branch with a test to make it easier to refactor Differentiator in the future.

Reviewed By: rubennorte

Differential Revision: D73543444

fbshipit-source-id: b0b22aba4b9cc4718edd2a6c4535993be437ed9f
2025-04-24 05:32:48 -07:00
Samuel SuslaandFacebook GitHub Bot d8fe0d2ee2 simplify parent-child flattening-unflattening (#50893)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50893

changelog: [internal]

In the two branches changed by this diff, it is unnecessary to check `reparentMode` because `reparentMode` and `childReparentMode` will always mismatch. When `childReparentMode` is unflatten, `reparentMode` will be flatten and vice versa. This is guaranteed by a `if else` statement above: https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/renderer/mounting/Differentiator.cpp#L674

This slightly simplifies code and lowers the burden on the reader.

Reviewed By: javache, rubennorte

Differential Revision: D73571160

fbshipit-source-id: 8623d991f7b063f70c95720ca0d3b63318dfc08b
2025-04-24 05:32:48 -07:00
Mateo GuzmánandFacebook GitHub Bot 94fed5facc Flip mockito usages to mockito-kotlin (#50878)
Summary:
As the repository is moving towards Kotlin and the tests have also been moving towards mockito-kotlin, I'm doing another round here.

## Changelog:

[INTERNAL] - Flip mockito usages to mockito-kotlin

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

Test Plan:
```sh
yarn test-android
```

Reviewed By: javache

Differential Revision: D73569293

Pulled By: rshest

fbshipit-source-id: 9bfe7d3f69480367384eafdde429db15eb81d11c
2025-04-24 05:21:57 -07:00
drrefactorandFacebook GitHub Bot 79d3eea0b7 refactor: Rewrite JavaModuleWrapper from Java to Kotlin (#50882)
Summary:
Rewrite of JavaModuleWrapper from Java to Kotlin in scope of https://github.com/facebook/react-native/issues/50513

## Changelog:

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

Pick one each for the category and type tags:

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

[ANDROID] [CHANGED] - Migrated JavaModuleWrapper to Kotlin

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

Test Plan:
Test RNTester using old arch. SampleLegacyModule is the one I've used, it needs to be enabled for old arch though (RNTesterApplication.kt -> getPackages & getReactModuleInfoProvider).

I may enable SampleLegacyModule for old arch to make testing easier. mateoguzmana
It breaks on `getDynamic` on old arch, but I could filter these from examples or add some fallback in SampleLegacyModule.kt for old arch.

Reviewed By: cortinico

Differential Revision: D73576099

Pulled By: javache

fbshipit-source-id: c940be27133258fa589571a600435fa478e6b51e
2025-04-24 04:58:43 -07:00
Samuel SuslaandFacebook GitHub Bot c443bc18f5 clean up removeTurboModuleManagerDelegateMutex feature flag (#50891)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50891

changelog: [internal]

remove unnecessary mutex in RCTTurboModuleManager.mm.

Reviewed By: philIip

Differential Revision: D73506191

fbshipit-source-id: 54c83704ffb8066f214e683a163face78f1922d5
2025-04-24 04:23:42 -07:00
Pieter De BaetsandFacebook GitHub Bot fc55cc3318 Simplify InteropModuleRegistry API (#50863)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50863

No need for `shouldReturnInteropModule` if we can just use the nullability of what's returned by `getInteropModule` instead.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D73501845

fbshipit-source-id: 9b7628707edc3eb288733baffaca59a9d3c40b40
2025-04-24 03:20:12 -07:00
Pieter De BaetsandFacebook GitHub Bot 22f2247a96 Migrate ReactInstanceProcessedErrorConverter to Kotlin (#50870)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50870

As explained in the doc block, now that ReactInstance is in Kotlin we can move this logic to StackTraceHelper and migrate it to Kotlin

Changelog: [Internal]

Reviewed By: alanleedev

Differential Revision: D73503879

fbshipit-source-id: 38a9ff346e00d68bbc3c383834e2a1763dbba9b8
2025-04-24 03:03:06 -07:00
Mateo GuzmánandFacebook GitHub Bot 12147e3bee TypeScript: Replace deprecated React.ElementRef usages to React.ComponentRef (#50883)
Summary:
While upgrading a project to React 19, I noticed React.ElementRef is deprecated (see [types/react/index.d.ts#L199](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts#L199)). I think we can replace it for the RN types as well.

Not sure if this is considered as a breaking change.

## Changelog:

[GENERAL] [CHANGED] - TypeScript: Replace deprecated React.ElementRef usages to React.ComponentRef

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

Test Plan:
Create a RNTesterPlayground.tsx next to the normal .js just to validate the type checking is not throwing an unexpected error.

<details>
<summary>Code snippet:</summary>

```tsx
import React, { useRef, useEffect } from 'react';
import { FlatList, Text, View } from 'react-native';

type Item = { id: string; title: string };

const data: Item[] = Array.from({ length: 10 }, (_, i) => ({
  id: i.toString(),
  title: `Item ${i + 1}`,
}));

const FlatListScrollRefExample: React.FC = () => {
  const flatListRef = useRef<FlatList<Item>>(null);

  useEffect(() => {
    if (flatListRef.current) {
      const nativeRef = flatListRef.current.getNativeScrollRef();

      console.log('nativeRef', nativeRef?.componentWillUnmount);
    }
  }, []);

  return (
    <FlatList
      ref={flatListRef}
      data={data}
      keyExtractor={(item) => item.id}
      renderItem={({ item }) => (
        <View style={{ padding: 16 }}>
          <Text>{item.title}</Text>
        </View>
      )}
    />
  );
};

export default FlatListScrollRefExample;

```

</details>

Reviewed By: cipolleschi

Differential Revision: D73569274

Pulled By: rshest

fbshipit-source-id: f72477b9b3c0eda1007187c7dac3da0433410e86
2025-04-24 03:02:27 -07:00
Samuel SuslaandFacebook GitHub Bot 4e679a22e7 group reparenting tests for view culling together (#50886)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50886

changelog: [internal]

Group tests related to reparenting in "describe" block. Differentiator is two algorithms hidden behind a single interface: regular and reparenting. The tests are structured this way as well where regular tests focus on common scenarios and reparenting section focuses on reparenting and special cases around that. The reparenting implementation is considerably more complex as it handles edge cases that don't happen often.

Reviewed By: mdvacca

Differential Revision: D73541053

fbshipit-source-id: c3905a0f0117cb1aa6c468e24e6bb982de48545d
2025-04-23 20:21:49 -07:00
Samuel SuslaandFacebook GitHub Bot 6f345cb852 add a test for view culling where during reparenting a view is culled (#50885)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50885

changelog: [internal]

a special case inside of Differentiator handling parent-child switching from unflattened-flattened to flattened-unflattened. If a child has view that is culled, this needs to be handled.

This diff also simplifies the implementation inside of calculateShadowViewMutationsFlattener by passing only one cullingContext.

Reviewed By: mdvacca

Differential Revision: D73523523

fbshipit-source-id: d6f314da6b9ff40bcf3362243b03de1b39e7aabb
2025-04-23 20:21:49 -07:00
Samuel SuslaandFacebook GitHub Bot f51d6ec9ff fix bug in reparenting where wrong parentTag is used in differentiator (#50884)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50884

changelog: [internal]

Fix incorrect parentTag coming from differentiator when reparenting. The fix is hidden behind existing feature flag that is already fixing similar issue: D73428312

The problem occurs under very specific circumstances that are covered by an integration test. The *parentTag* is also [only used on Android](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp#L566) and only if layout changes as part of the update.

This diff introduces a new test specifically triggering the incorrect behaviour: `Differentiator-itest.js`. Without this fix, the test fails on following assert:           [react_native_assert(hasTag(mutation.parentTag))](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/renderer/mounting/stubs/StubViewTree.cpp#L245).

Reviewed By: mdvacca

Differential Revision: D73545165

fbshipit-source-id: 43344eebfa4cc0119e5b42170f6b9097dacd704d
2025-04-23 20:21:49 -07:00
Arushi KesarwaniandFacebook GitHub Bot d28d4c5ff8 Rename Codegen Component Descriptors Entrypoint for FAC and hook it up in DefaultComponentsRegistry (#50881)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50881

Rename Codegen Component Descriptors Entrypoint for FAC and hook it up in DefaultComponentsRegistry

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D73535745

fbshipit-source-id: dad68e7e6c8d7ba2ed86bbd1c06131101e00689e
2025-04-23 16:56:45 -07:00
Zeya PengandFacebook GitHub Bot 5ec00097b6 Add pan gesture animation examples to rntester (#50851)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50851

## Changelog:

[General] [Added] - Add pan gesture animation example to rntester

Including examples of
* using native driven Animated.event + touch event (which will not be interrupted by busy js thread, and is potentially a boost to performance) - the code requires some hacks but it's doable
* using js PanResponder to drive pan gesture animation

Reviewed By: sammy-SC

Differential Revision: D68909931

fbshipit-source-id: 484ecb0646fb249b31362013725219a1c1ec6181
2025-04-23 16:41:46 -07:00
Nick GerlemanandFacebook GitHub Bot 42251ec0ed Fix Non-uniform border colors on TextInput (#50880)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50880

Kotlin conversion exposes unused variable warning. Looks like I broke this a year ago.

Changelog:
[Android][Fixed] - Fix Non-uniform border colors on TextInput

Reviewed By: mdvacca

Differential Revision: D73453825

fbshipit-source-id: 8e3fcac8ea55feb518a8d11a6fbdba7ea548ea2b
2025-04-23 15:26:04 -07:00
Nick GerlemanandFacebook GitHub Bot cf9514e549 Fix ReactTextAnchorViewManager Nullability (#50879)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50879

The view for a view manager should not be nullable. Let's fix that.

These are also all bound specifically to `ReactTextView` instead of the generic constraint, so I just changed the constraint. Really this should just be totally merged with `ReactTextViewManager`.

Changelog: [Internal]

Reviewed By: cortinico, rshest

Differential Revision: D73453631

fbshipit-source-id: 74bcadeef0e83a719dfe2b989784501575b58168
2025-04-23 15:26:04 -07:00
Nick LefeverandFacebook GitHub Bot 1156c08ac4 Move shadow node reference updates to tree commit (#50753)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50753

Runtime Shadow Node Reference Updates (RSNRU) is currently implemented through the clone method which on each internal clone updates the runtime reference to point to the new clone. This guarantees that the runtime reference always points at the latest revision of the shadow node.

This came with the constraint that RSNRU could only run from one thread at all times, otherwise the React renderer state (current fiber tree) would end up being corrupted by receiving reference updates from multiple threads cloning shadow nodes.

This change moves the reference update step to the locked scope of the commit phase. Since the runtime is blocking on the commit and the scope is locked, it is safe and correct to update the runtime references with the latest revision of the shadow node after running state progression and layout.

By moving the reference update to the commit, we can support shadow node syncing from any thread since the actual runtime references are now executing at a safe time and the renderer state will stay valid at all times.

This change is gated behind the `updateRuntimeShadowNodeReferencesOnCommit` feature flag, which enabled shadow node syncing from any thread and reference updates only during the commit.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D73038439

fbshipit-source-id: d90308498f3c0625dc87158f15311d1088aad8b0
2025-04-23 14:55:23 -07:00
Nick LefeverandFacebook GitHub Bot 2080fd81f9 Split shadow node reference setter and update functionality (#50752)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50752

Storing the runtime reference for a shadow node and updating the runtime reference to point at a specific shadow node should be separated so that these actions can be done at different moments in time.

We want to keep a reference to the runtime reference of a shadow node for all revisions cloned internally (not triggered by the React renderer, e.g. on layout or shadow node state updates).

We also want to support updating that runtime reference to point at a specific shadow node revision, ideally the one that will end up being used to mount the host component.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D73038438

fbshipit-source-id: 68c3912cbb077d790dd8d2abe8291548b12c8231
2025-04-23 14:55:23 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot ee215800d7 Fix backgroundImage on new Background Drawable (#50877)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50877

At some point I made some changes to how alpha works on BackgroundDrawable. This inadvertently broke BackgroundImage because we need a non transparent color to apply shaders.

Setting the alpha to 255 temporarily when drawing background-image layers fixes it

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D73520952

fbshipit-source-id: b8017bb06adc0d3d328d9831fbc4c74f2ec0b783
2025-04-23 14:13:05 -07:00
David VaccaandFacebook GitHub Bot 4d44273672 Temporarily revert removal of ShadowNodes (#50876)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50876

This diff is temporarily reverting the code shipped in D72671083 to wait for more data before fully release this change

changelog: [internal] internal

Reviewed By: rshest, arushikesarwani94

Differential Revision: D73515903

fbshipit-source-id: 6566e9533ebffc93348e24eb6c0512020b220eae
2025-04-23 13:54:09 -07:00
Peter AbbondanzoandFacebook GitHub Bot 93f12eb71d Add prop to filter drag and drop pasting on iOS (#50533)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50533

Builds upon https://github.com/facebook/react-native/pull/49446

On iOS, by default, every EditText accepts DragEvent and will automatically focus themselves to accept these data. In some rare cases, it might not be desirable to allow data from arbitrary drag and drop events to be pasted into a text input.

This change adds a new prop `acceptDragAndDropTypes` to do exactly that: reject drag and drop events by telling the system to ignore certain types of drag data and, by proxy, disabling behavior that automatically focuses the text input.

The prop accepts a list of [Uniform Type Identifiers](https://developer.apple.com/documentation/uniformtypeidentifiers) that iOS supports. It's important to note that these are *not* MIME types. A MIME type would be something like `text/plain` but the equivalent for iOS is `public.plain-text`.

It's important to note that this is an experimental prop, as is evident by the `experimental_` prefix on the JS side. Its signature could change before the prop has fully matured, use at your own risk

Changelog: [iOS][Added] - Add new prop for filtering drag and drop targeting to text inputs

Reviewed By: javache

Differential Revision: D70992749

fbshipit-source-id: 22b5aa1b4ced14147bf16a844361acf6f99c5a40
2025-04-23 13:13:17 -07:00
Peter AbbondanzoandFacebook GitHub Bot d10dd7130c Add prop to filter drag and drop pasting on Android (#49446)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49446

On Android, by default, every EditText accepts `DragEvent` and will automatically focus themselves to accept these data. In some rare cases, it might not be desirable to allow data from arbitrary drag and drop events to be pasted into a text input.

This change adds a new prop `acceptDragAndDropTypes`  to do exactly that: reject drag and drop events by telling the system to ignore certain types of drag data and, by proxy, disabling behavior that automatically focuses the text input.

The prop accepts a subset of MIME types supported by Android as documented [here](https://developer.android.com/reference/android/content/ClipDescription#MIMETYPE_TEXT_HTML).

It's important to note that this is an experimental prop, as is evident by the `experimental_` prefix on the JS side. Its signature could change before the prop has fully matured, use at your own risk

Changelog: [Android][Added] - Add new prop for filtering drag and drop targeting to text inputs

Reviewed By: javache

Differential Revision: D69674225

fbshipit-source-id: 4dbbdd81bb0f394b6206da5a377c75ea71671626
2025-04-23 13:13:17 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 3b17cdb643 Add back the folly_compiler_flags for backward compatibility (#50875)
Summary:
Some libraries still use the `folly_flags` method provided by our infra. When updating how folly should be installed in an app, we removed that function.
We are putting it back as deprecated, to avoid unnecessary breaking changes in libraries

## Changelog:
[iOS][Fixed] - Put back the `folly_compiler_flag` function to make libraries install pods

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

Test Plan: Tested locally in a nightly app, using the react-native-exit-app library which still uses these flags

Reviewed By: cortinico

Differential Revision: D73512830

Pulled By: cipolleschi

fbshipit-source-id: 28f099064e93ecd5a5a6a7b82e3f7e9db4d35cb9
2025-04-23 12:15:49 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 3f41fe2948 Make fmt and SocketRocket compatible with Swift (#50874)
Summary:
`SocketRocket` and `fmt` are part of React Native dependencies.
If a library is written in swift and depends on them, it will fail to install the pods because these pods are not compatible with Swift.

This change makes sure that the pods are installed in a way that is swift compatible.

## Changelog:
[iOS][Fixed] - Make fmt and SocketRocket Swift friendly

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

Test Plan:
Tested locally in a nightly app.

### Before the change:

```
yarn add react-native-video
cd ios
bundle exec pod install
```

This script resulted in this error:

```
[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod `react-native-video` depends upon `fmt` and `SocketRocket`, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
```

### After the change

```
yarn add react-native-video
cd ios
bundle exec pod install
```

This script installed pods successfully.

Reviewed By: cortinico

Differential Revision: D73512109

Pulled By: cipolleschi

fbshipit-source-id: 222d85dba1cbdf4044e3c8459008a4083a720016
2025-04-23 12:07:20 -07:00
Pieter De BaetsandFacebook GitHub Bot b9b61f002c Tweak SoftError tags (#50862)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50862

Changelog: [Internal]

Reviewed By: arushikesarwani94

Differential Revision: D73501837

fbshipit-source-id: 7889dd994900cec54845263286e24da24a3c9542
2025-04-23 10:31:50 -07:00
Iwo PlazaandFacebook GitHub Bot dc494bb341 Revert [RN][JS Stable API] Limit @react-native/virtualized-lists subpath imports (#50846)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50846

## Motivation
After a more rigorous search through GitHub uses of the restricted APIs, and consultation with framework authors, it became apparent that this restriction should be lifted.

Changelog: [Internal]

Reviewed By: zeyap

Differential Revision: D73267844

fbshipit-source-id: e6c0c146690c07debf74c51f82171a9239be5c15
2025-04-23 10:20:06 -07:00
bornkissandFacebook GitHub Bot 96b6604037 chore: update license-docs link (#50868)
Summary:
The source for the React Native documentation and website is hosted on a separate repository, [**facebook/react-native-website**][repo-website]. [LICENSE-docs](https://github.com/facebook/react-native/blob/main/LICENSE-docs) had been removed, so it should be replaced by [**this link**](https://github.com/facebook/react-native-website/blob/main/LICENSE-docs). Of course we could delete it directly.

## Changelog:
[Internal] [Fixed] - Update link

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

Test Plan: nothing

Reviewed By: cipolleschi

Differential Revision: D73512121

Pulled By: cortinico

fbshipit-source-id: dba43626eb2a65a73ca2f46a830488e1437c3a1f
2025-04-23 09:33:43 -07:00
Riccardo CipolleschiandFacebook GitHub Bot ec43150b2a Disable react-native-maps for nightlies (#50873)
Summary:
the `react-native-maps` library has a complex setup for iOS. It doesn't work with autolinking, therefore we need to disable the test with the nightlies

## Changelog:
[Internal] - Disable nitghtly test for react-native-maps

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

Test Plan: GHA

Reviewed By: cortinico

Differential Revision: D73510995

Pulled By: cipolleschi

fbshipit-source-id: a8abadfc8f0656de1288aa28e65abeab07bb9074
2025-04-23 08:14:36 -07:00
Mateo GuzmánandFacebook GitHub Bot e25e4258a0 Make JSStackTrace internal (#50792)
Summary:
This class can be internalized as part of the initiative to reduce the public API surface. I've checked there are [no relevant OSS usages](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+user%3Acortinico+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+NOT+repo%3Apkcsecurity%2Fdecompiled-lightbulb+com.facebook.react.util.JSStackTrace).

## Changelog:

[INTERNAL] - Make com.facebook.react.util.JSStackTrace internal

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

Test Plan:
```bash
yarn test-android
yarn android
```

Reviewed By: cortinico

Differential Revision: D73501578

Pulled By: javache

fbshipit-source-id: 367161f06a43a3877c157e976b6e813f3bbef758
2025-04-23 06:14:20 -07:00
Mateo GuzmánandFacebook GitHub Bot 41b17504bf Make DrawerSlideEvent internal (#50791)
Summary:
This class can be internalized as part of the initiative to reduce the public API surface. I've checked there are [no relevant OSS usages](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+user%3Acortinico+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+NOT+repo%3Apkcsecurity%2Fdecompiled-lightbulb+com.facebook.react.views.drawer.events.DrawerSlideEvent).

## Changelog:

[INTERNAL] - Make com.facebook.react.views.drawer.events.DrawerSlideEvent internal

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

Test Plan:
```bash
yarn test-android
yarn android
```

Reviewed By: cortinico, fabriziocucci

Differential Revision: D73501596

Pulled By: javache

fbshipit-source-id: f2c3d94e8a91c6b7666a30d3d9a465c57358d871
2025-04-23 05:38:35 -07:00
Samuel SuslaandFacebook GitHub Bot d40b4c660b add view culling tests when flattetning and deleting a subtree (#50860)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50860

changelog: [internal]

Adding a test case verifying branch of code starting in [Differentiator:855](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/renderer/mounting/Differentiator.cpp#L855)

Without using `adjustedOldCullingContext` in the branch, it leads to a crash on [StubViewTree:177](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/renderer/mounting/stubs/StubViewTree.cpp#L177):  trying to remove view that does not exist.

Reviewed By: lenaic

Differential Revision: D73493001

fbshipit-source-id: 4b81a6635decabb5be043b36cbbd764998f2c438
2025-04-23 05:01:25 -07:00
Samuel SuslaandFacebook GitHub Bot e0b1b63c3f add view culling test when unflattening a subtree (#50852)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50852

changelog: [internal]

Adding a test to verify view culling in scenario where a subtree is revealed and part of it is culled.

Reviewed By: lenaic

Differential Revision: D73454202

fbshipit-source-id: 6c4fb2ec4757b9ed1460bec8d3f02a661470266f
2025-04-23 05:01:25 -07:00
Vitali ZaidmanandFacebook GitHub Bot 8b11970adb accept Settings.Global.TRANSITION_ANIMATION_SCALE with a comma decimal separator (#50864)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50864

Changelog:
[Android][Fixed] Settings.Global.TRANSITION_ANIMATION_SCALE accepts comma as decimal separator

Reviewed By: javache

Differential Revision: D73501445

fbshipit-source-id: f7f54dbbcbc4cea1e746222febf8ec63638a73ac
2025-04-23 04:45:01 -07:00
Mateo GuzmánandFacebook GitHub Bot 5ed486cc8f Text: fix selectable prop not working correctly on initial render (#50822)
Summary:
Fixes https://github.com/facebook/react-native/issues/50010

On the initial render of a Text with the `selectable` prop set as `true`, the Text view is not making itself selectable. I debugged this quite a lot, and by changing the state from false to true using `setState` on the JS side, I made it work.

It turns out that we are setting this property in `onAttachedToWindow`, but somehow if `super.setTextIsSelectable` was already set as `true`, it won't re-apply it and we have to reset it to false before setting it again to true. This PR adds this reset.

I couldn't understand yet why this is not breaking in Fabric.

## Changelog:

[ANDROID] [FIXED] - Fix `selectable` prop not working correctly on initial render (old-arch)

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

Test Plan:
- Test in both Fabric and Paper architectures to ensure there won't be a regression with this change in Fabric, as the issue occurs only in Paper.

- To test this, I created a small example in the RN-Tester playground to toggle the selectable property on/off. Notice in the first video that initially the prop is set as true, but it won't allow selecting. If you toggle to false and then back to true again, it works. With the provider fix it should also allow selecting the text on initial render.

Use this code snippet:

```tsx
function Playground() {
  const [selectable, setSelectable] = React.useState(true);

  return (
    <View style={styles.container}>
      <Text selectable={selectable} selectionColor="blue">
        TESTING: is selectable? {selectable ? 'true' : 'false'}
      </Text>
      <Button title="Press me" onPress={() => setSelectable(!selectable)} />
    </View>
  );
}
```

Videos:

<details>
<summary>Before</summary>

https://github.com/user-attachments/assets/6a24dd0d-7f45-4a38-b18d-5142801ea1c3

</details>

<details>
<summary>After</summary>

https://github.com/user-attachments/assets/ce5f9e6e-9a4c-44d7-9d97-f607f2fdc1b4

</details>

Reviewed By: cortinico

Differential Revision: D73421487

Pulled By: rshest

fbshipit-source-id: c0b9d76076ef2e05930996953015fb58ad2a3d5f
2025-04-23 02:21:52 -07:00
Samuel SuslaandFacebook GitHub Bot 45160b64af add test describing React commit overriding values set by setNativeProps (#50858)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50858

changelog: [internal]

This test verifies that React commits can override values previously set by `setNativeProps`. The test demonstrates the proper reconciliation behaviour between imperative updates via `setNativeProps` and declarative updates via React renders.

Reviewed By: lenaic

Differential Revision: D73463364

fbshipit-source-id: 3504d9a23bfc36a46fdfc4e9bf585f64088ab518
2025-04-23 00:08:06 -07:00
Samuel SuslaandFacebook GitHub Bot e89d2681ee write a test for setNativeProps+props update (#50849)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50849

changelog: [internal]

Previously we didn't have a way to properly test bug reported in https://github.com/facebook/react-native/issues/47476. But with Fantom we do! Let's write a test for it to make sure this is not broken in the future.

Reviewed By: rubennorte

Differential Revision: D73432279

fbshipit-source-id: dbc1ce9d7b34bbe4275f6b8b1ce3a1c48bca3504
2025-04-22 18:18:43 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot 3af8d95441 Revert D73114782: Fix keyboard navigation for FlatList with removeClippedSubviews enabled
Differential Revision:
D73114782

Original commit changeset: 081a2216037e

Original Phabricator Diff: D73114782

fbshipit-source-id: fa37a2c52171e3acb4ffea3380e923e919ddf65e
2025-04-22 17:15:59 -07:00
Erich GrahamandFacebook GitHub Bot aa98b8589b Run swift-format OrderedImports rule across fbsource [58] (#50853)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50853

Pre-run OrderedImports rule in prep for enabling across repo.
drop-conflicts

Reviewed By: adamjernst

Differential Revision: D73453458

fbshipit-source-id: d7f7bb319e04209f20dbdd03945eededc57522d5
2025-04-22 16:53:01 -07:00
Samuel SuslaandFacebook GitHub Bot 8f33c006e9 fix deadlock and test flakiness for RuntimeSchedulerTest (#50854)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50854

changelog: [internal]

In D73437449 I accidentally introduced a deadlock for single threaded testing environments. Here, I resolve the flakiness and the deadlock.

Reviewed By: mdvacca

Differential Revision: D73457182

fbshipit-source-id: 242edd4443b354cda4b082c2d45d8df04033cfd0
2025-04-22 15:48:50 -07:00
Sim SunandFacebook GitHub Bot 40381830c5 Revert D73213775: Fix crash with nested FlatLists and fix edge case with nested views
Differential Revision:
D73213775

Original commit changeset: 51a667a0c22e

Original Phabricator Diff: D73213775

fbshipit-source-id: da2269a70981522f87bd5636a1614b41773b96c2
2025-04-22 15:09:42 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot 5a9023f7ab Fix crash with nested FlatLists and fix edge case with nested views (#50827)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50827

This diff addresses a crash caused by view duplication in React Native Android. The issue occurred when a view was not already clipped and was laid out again, resulting in duplicated views.

This problem was particularly noticeable when using nested FlatLists, which triggered a custom focus search with an incomplete and buggy duplicated FlatList container view.

The fix involves preventing the duplication of views by checking if a view is clipped already before laying it out again. Additionally, this diff includes two other improvements:
- Preventing clipping issues: When a view is nested within a non-ReactClippingViewGroup ancestor, focus searching would fail due to the needUpdateClippingRecursive logic only running on instances of ReactClippingViewGroup. By excluding these ancestors, we ensure that the next focusable view can be properly excluded from being clipped.
- Minor fix: A minor fix was made to prevent potential issues in deeply nested cases.
- Add a Kill switch with a feature flag and mobile config combo.  For Facebook we can kill through MC and for all other apps we can kill with the feature flag default value

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D73213775

fbshipit-source-id: 51a667a0c22eb35f0ec46ac4cbe430e2e62b407b
2025-04-22 13:17:21 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot bbff754db3 Fix keyboard navigation for FlatList with removeClippedSubviews enabled (#50826)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50826

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

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

When using `ReactScrollView` or `ReactHorizontalScrollView` Views with `removeClippedSubviews` keyboard navigation didn't work.

This is because keyboard navigation relies on Android's View hierarchy to find the next focusable element. With `removeClippedSubviews` the next View might've been removed from the hierarchy.

With this change we delegate the job of figuring out the next focusable element to the Shadow Tree, which will always contain layout information of the next element of the ScrollView.

We then prevent the clipping of the topmost parent of the next focusable view to lay out the entire containing element in case we have some necessary context in the parent

Changelog: [Android][Fixed] - Fix keyboard navigation on lists with `removeClippedSubviews` enabled

Reviewed By: NickGerleman

Differential Revision: D73114782

fbshipit-source-id: 081a2216037e033a4638151e5226f430ac093ea5
2025-04-22 13:17:21 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot 98c10d568e Add fabric implementation to find Top-Most relative and relevant parent of a child view (#50825)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50825

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

Add another function to fabric to get the topmost stacking context parent given a root and a child.

This is to be used on focus searching algorithm in the case where the next focusable child is deeper in the hierarchy meaning we need to find the top most parent in the Android hierarchy and lay that out as well before transferring focus.

If we don't lay out the parent as well as the next focusable view:

- The next focusable view might lack context given by the parent
- If the parent is a scrollview and has removeClippedSubviews enabled then laying out the next focusable view will not work
- If the view is deeper in the android hierarchy in some cases it won't be layed out unless the parent is

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D73114933

fbshipit-source-id: 081720199943eff78966982a5fd1c921d4e105fd
2025-04-22 13:17:21 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot c31699b760 Add fabric implementation to find next focusable view (#50824)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50824

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

Currently when `removeClippedSubviews` is enabled on Android keyboard navigation breaks and we can never focus the elements that are clipped. iOS has a similar issue but not as drastic, it only happens when elements on the FlatList have a lot of margin between them.

This algorithm aims to find the next focusable view and return it to native so that we can prevent the clipping of the view on the view clipping algorithm and hence fix keyboard navigation. For more information see D71324219

Fabric algorithm to find the next focusable view given:

`parentTag`: Top most relevant parent of the focused view
`focusedTag`: Tag of the currently focused view
`direction`: Direction in which focus is moving

EDIT AFTER AMA SEV 3 S510469:

This whole algorithm was based on the idea of fixing focusing within a ScrollView. What we didn't consider is that focus search could be triggered when focusing a pop-up view. This includes transfering focus to an element on a new page or a modal which means that in some cases the parent view could be removed from the hierarchy.

Just add null checks to the parent node and the currently focused node to prevent unexpected crashes.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D73115104

fbshipit-source-id: b9c9314fbd4b97da23c0b941d34f4dc2a1a3b883
2025-04-22 13:17:21 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot 0796ff80c1 Add KeyboardFocusableNode ShadowNodeTrait (#50823)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50823

Introduce a trait to be able to tell if a ShadowNode is focusable by keyboard. This will be used for focus ordering that delegates the work to the shadow tree when Native platforms don't have enough information to define the next focusable node

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D73114986

fbshipit-source-id: eed8642db0c65b6f54808d681640bb605cb6e0aa
2025-04-22 13:17:21 -07:00
Samuel SuslaandFacebook GitHub Bot 43403be02d fix crash in view culling when parent-child go from flattened-unflattened to unflattened-flattened (#50844)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50844

changelog: [internal]

Fixes a problem where during reparenting differentiator will generate invalid mounting instructions. In tests, this fails with assertion failure on [StubViewTree.cpp:177](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/renderer/mounting/stubs/StubViewTree.cpp#L177).

Reviewed By: rubennorte

Differential Revision: D72822113

fbshipit-source-id: 924fca76a87119c3a86c19dc974f4ec282b149d5
2025-04-22 10:32:55 -07:00
Samuel SuslaandFacebook GitHub Bot 4ab7d531fb fix a crash in view culling when the differentiator produces create instruction for existing tag (#50843)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50843

changelog: [internal]

Fix a crash where view culling produces a mutation to create a view that was already created.

Without the change in Differentiator.cpp, the test fails assert on [StubViewTree.cpp:69](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/renderer/mounting/stubs/StubViewTree.cpp#L69).

Reviewed By: rubennorte

Differential Revision: D72818343

fbshipit-source-id: 8aec3ccf967f453c619a9495dcd32b43b21afea3
2025-04-22 10:32:55 -07:00
Samuel SuslaandFacebook GitHub Bot 90a93aa48c fix incorrect parentTag coming from differentiator when reparenting (#50842)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50842

changelog: [internal]

introduce a feature flag that fixes incorrect parentTag coming from differentiator when reparenting.

The problem occurs under very specific circumstances that are covered by an integration test. The *parentTag* is also [only used on Android](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp#L566) and only if layout changes as part of the update.

This diff introduces a new test specifically triggering the incorrect behaviour: `Differentiator-itest.js`. Without this fix, the test fails on following assert:           [react_native_assert(hasTag(mutation.parentTag))](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/renderer/mounting/stubs/StubViewTree.cpp#L245).
This diff also converts existing tests for the differentiator to parametrised tests and enables the fix.

Reviewed By: rubennorte

Differential Revision: D73428312

fbshipit-source-id: 8b00977b610a85fba8b01a50a151f30bd5321ed4
2025-04-22 10:32:55 -07:00