Commit Graph

12270 Commits

Author SHA1 Message Date
Riccardo Cipolleschi 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 Cipolleschi 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 Baets 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 Plaza 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
Mateo Guzmán 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án 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 Susla 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 Susla 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 Zaidman 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án 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 Susla 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 Susla 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 Acosta 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 Graham 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 Susla 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 Sun 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 Acosta 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 Acosta 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 Acosta 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 Acosta 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 Acosta 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 Susla 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 Susla 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 Susla 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
Samuel Susla 4221fc8a32 fix flaky RuntimeSchedulerTest (#50845)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50845

changelog: [internal]

`signalTaskToSync` should be released after `executeNowOnTheSameThread` is called to prevent race condition between `executeNowOnTheSameThread` and reading stubQueue's size on line 723.

Reviewed By: rubennorte, rshest

Differential Revision: D73437449

fbshipit-source-id: 3b2af3ddee5a422f7f846cc34ebbb7695463c267
2025-04-22 09:15:27 -07:00
Alex Hunt 7a3da81478 Remove Learn Core warnings for JS APIs with >3y blame (#50840)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50840

Cleanup of index.js API removal warnings. This should motivate more urgency on the remaining members.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D73429537

fbshipit-source-id: 03faabdf30c2836dd5c61b4a2ce8d2355ad8e1e9
2025-04-22 08:01:35 -07:00
Nicola Corti be37e1b7d8 Convert to Kotlin - ReactTextAnchorViewManager (#50841)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50841

This diff convert to Kotlin the following file: ReactTextAnchorViewManager.java
Changelog:
[Internal] [Changed] -

Reviewed By: rshest

Differential Revision: D72778863

fbshipit-source-id: d088005573763c95475cfd2ff712a094f764940b
2025-04-22 07:15:12 -07:00
Mateo Guzmán 2b0189b964 Skip cloning Fragments in ListEmptyComponent to avoid onLayout warning (#50833)
Summary:
Fixes https://github.com/facebook/react-native/issues/50817

Using a fragment is very common when rendering elements. We are cloning and adding `onLayout` always to the ListEmptyComponent element, but this would seem to work only when `View` is used for this as a wrapper in this prop. To prevent this unnecessary warning, I think we can easily check whether it is a fragment or not before cloning and adding the extra props – this adds backwards compatibility for those that don't need to use `onLayout`.

## Changelog:

[GENERAL] [FIXED] - Skip cloning Fragments in ListEmptyComponent to avoid onLayout warning

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

Test Plan: Use the code snippet from the linked issue to verify that the warning is not thrown anymore when using a Fragment.

Reviewed By: javache

Differential Revision: D73421503

Pulled By: rshest

fbshipit-source-id: 0da4a38130601943e4704589ac275eba39767191
2025-04-22 07:06:07 -07:00
Pieter De Baets 04348e9db6 Convert com.facebook.react.runtime.ReactInstance to Kotlin (#50664)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50664

Changelog: [Internal]

Reviewed By: mlord93

Differential Revision: D72804418

fbshipit-source-id: 776adcb4c6cd6ad867525ac28cda8089c56f1ae5
2025-04-22 06:18:25 -07:00
Mateo Guzmán ffd7691505 Fix out-of-date "Direct Manipulation" link (#50834)
Summary:
Was triaging an issue and saw this dead link that has changed. This diff adds the equivalent link that works.

<details>
<summary>See screenshot of previous link:</summary>

![image](https://github.com/user-attachments/assets/f17e72a0-75b2-4446-9f4b-7a6470580f17)

</details>

## Changelog:

[INTERNAL] - Fix out-of-date "Direct Manipulation" link

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

Test Plan:
<details>
<summary>See screenshot of new link:</summary>

![image](https://github.com/user-attachments/assets/a284ba3c-050d-4c4c-9f8e-4770608f529a)

</details>

Reviewed By: cortinico

Differential Revision: D73421475

Pulled By: rshest

fbshipit-source-id: c9be165d2a27a3227d8337dc00456746627b8708
2025-04-22 06:07:06 -07:00
Mateo Guzmán 66a4a4d9fa Make MultiSourceHelper internal (#50793)
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.imagehelper.MultiSourceHelper).

## Changelog:

[INTERNAL] - Make com.facebook.react.views.imagehelper.MultiSourceHelper internal

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

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

Reviewed By: Abbondanzo

Differential Revision: D73250760

Pulled By: cortinico

fbshipit-source-id: 8c1103745d405a9ab36c1372f3ca6750ae8ce8e2
2025-04-22 05:55:01 -07:00
JatinDream11 5d1febf7de refactor: migrate BlobProvider.java to Kotlin (#50756)
Summary:
This PR aims to migrate BlobProvider from Java to kotlin as part of [50513](https://github.com/facebook/react-native/issues/50513)

## Changelog:
[ANDROID][CHANGED] – Migrate BlobProvider to Kotlin

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

Test Plan: Tested on RN tester with both new and old arch

Reviewed By: rshest

Differential Revision: D73420896

Pulled By: cortinico

fbshipit-source-id: 4c9a26452a7e45a78c9698f699822b4ac855628c
2025-04-22 05:46:44 -07:00
Alan Lee 1fb04e2134 Fix Type comparison (v2) in TurboModuleInteropUtils.kt
Summary:
instead of explictly specifying fully qualified Java boxed types, use proper Kotlin syntax to refer to it.

 ---
👉 Notes on Java <> Kotlin type mapping !!!

See: Kotlin's Mapped Types; https://kotlinlang.org/docs/java-interop.html#mapped-types
- kotlin `Boolean` maps to Java's primitive type `boolean` and not boxed Type `Boolean`
- Java boxed type `Boolean` maps to `Boolean?` in Kotlin

So in Kotlin,
- `Boolean::class.java` refers to Java primitive type `Class<boolean>` which is equivalent to `Boolean::class.javaPrimitiveType`
- For boxed type use `Boolean::class.javaObjectType` == `Class<Boolean>`

**TIP:** When dealing with Java primitive types using reflection, use `::class.javaPrimtiveType` or `::class.javaObjectType` to avoid the confusion with using plain `::class.java`.

Changelog:
[Internal]

Reviewed By: cortinico

Differential Revision: D73224138

fbshipit-source-id: 858093a22b38bfdad40b170d0cf80a440e503829
2025-04-22 05:11:30 -07:00
Joe Vilches f466e43a15 Label coopting RN Tester example (#50812)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50812

tsia, adding some accessibility examples that we have refined so far this half.
Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D73283176

fbshipit-source-id: 5bb451c1e79cd8bc92f333ef2fce82669ad0e971
2025-04-21 19:16:23 -07:00
Joe Vilches e9a0747a8f Text with links RN Tester example (#50811)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50811

tsia, adding some accessibility examples that we have refined so far this half.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D73281713

fbshipit-source-id: 42db49feba5c232e699afe01916425ddf11f4aea
2025-04-21 19:16:23 -07:00
Joe Vilches dc13a45907 Accessibility Order RN Tester example (#50810)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50810

tsia, adding some accessibility examples that we have refined so far this half.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D73280582

fbshipit-source-id: a1cc572522729d06b9a0227f0e5731e698f86cc3
2025-04-21 19:16:23 -07:00
David Vacca f8b7ab8733 Remove usages of ShadowNodes by fully releasing disableShadowNodeOnNewArchitectureAndroid() (#50838)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50838

This diff removes the usages of ShadowNodes in the new architecture by fully releasing disableShadowNodeOnNewArchitectureAndroid() feature flag.

changelog: [internal] internal

Reviewed By: alanleedev

Differential Revision: D72671083

fbshipit-source-id: a1505d02fd6bf7e87c7234581a26ef13768796a0
2025-04-21 18:43:27 -07:00
Jorge Cabiedes Acosta 57779cebf0 Fix border rendering incorrectly when it has translucent alpha (#50829)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50829

It is not appropriate to go through the fast path for border drawing when we have translucent border colors since it will cause overlapping borders to look weird.

Adding an if statement to prevent fastpath when the alpha value of any border is less than 255 (opaque)

Changelog: [Android][Fixed] - Fix translucent borders on Android overlapping bug

Reviewed By: NickGerleman

Differential Revision: D73145119

fbshipit-source-id: f22d0d55adca571d6b75725f6bc4753f98698763
2025-04-21 17:35:12 -07:00
Jorge Cabiedes Acosta 132a871b46 Change to use new Background and Border drawables by default (#50828)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50828

The new Background and Border drawables come with some correctness improvements and potential small perf gains on edge cases. We are now switching to using them by default.

Changelog: [Android][Changed] - Change to use new Background and new Border drawables by default

Reviewed By: NickGerleman

Differential Revision: D72082947

fbshipit-source-id: 7caeb279110b520bea760a4621184dc0de05cf78
2025-04-21 17:35:12 -07:00
Jorge Cabiedes Acosta aa89f7a01c Fix incorrect conditional for radial gradients (#50836)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50836

Made a typo on D71898565 when addressing lints

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D73393379

fbshipit-source-id: 9fef08bddb5875ff5bd4e3da28c9ea2b93027642
2025-04-21 17:23:21 -07:00
Anupriya Verma bc90c839aa Add showsVerticalScrollIndicator in ScrollViewProps.cpp SetProp (#50798)
Summary:
https://github.com/facebook/react-native/blob/a3252def1990c0d0afba67a4698357bc91c5bb2a/packages/react-native/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.cpp#L409

Need to add     `RAW_SET_PROP_SWITCH_CASE_BASIC(showsVerticalScrollIndicator);` as it's missing

Related PR: https://github.com/microsoft/react-native-windows/pull/14526
Resolves: https://github.com/facebook/react-native/issues/50779

## Changelog:

Add showsVerticalScrollIndicator in ScrollViewProps.cpp SetProp

Pick one each for the category and type tags:

[GENERAL] [ADDED] - Message

Windows : RNW

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

Test Plan: Tested here: Related PR: https://github.com/microsoft/react-native-windows/pull/14526

Reviewed By: Abbondanzo

Differential Revision: D73291101

Pulled By: NickGerleman

fbshipit-source-id: 6db26d379d496c0652917cc326dfbcbd92dc3923
2025-04-21 16:28:51 -07:00
Ramanpreet Nara aa41184633 Take 2: Mitigate deadlock hazard in RCTUtils.m (#50807)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50807

This structure is unsafe:

```
// In each native module:
+load
  dispatch_once
    NSBundle mainBundle
```

NSBundle mainBundle itself uses dispatch_once during initialization. If that initialization triggers a native module class load, we could end up with a circular dependency chain. This could deadlock the application.

## Changes
Just remove the dispatch_once. Getting the NSBundle mainBundle is very efficient after the first access. And NSBundle objectForInfoDictionaryKey is also very efficient.

Created from CodeHub with https://fburl.com/edit-in-codehub

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D73265906

fbshipit-source-id: f718e5bba7e95517613204b1f95e1b637e6c2366
2025-04-21 15:49:27 -07:00
Phillip Pan 5b5cf0e199 cleanup queue configs for some native modules (#50832)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50832

Changelog: [iOS][Breaking]

these experiences did not end up shipping, so cleaning them up.

Reviewed By: fkgozali

Differential Revision: D73343958

fbshipit-source-id: ff0dc1394748c897aed9c66513b250dfc2192e0d
2025-04-21 15:09:54 -07:00
Alan Lee 77f2c610db fixed wrong class name in string (#50831)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50831

fixed wrong class name in string

Changelog:
[Internal]

Reviewed By: Abbondanzo

Differential Revision: D73370669

fbshipit-source-id: 76529099b1eabc4e23333fb97aec2c9b613ee7e0
2025-04-21 14:32:26 -07:00
David Vacca 7284bea018 Delete unused tag constant in LegacyArchitectureLogger (#50819)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50819

Delete unused tag constant in LegacyArchitectureLogger

changelog: [internal] internal

Reviewed By: mlord93

Differential Revision: D73322326

fbshipit-source-id: 38463792675094db721d1fa018185d4aed17c1d8
2025-04-21 12:26:41 -07:00
George Zahariev 6ad41f9a3f Update hermes-parser and related packages in xplat to 0.28.1 (#50803)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50803

Bump hermes-parser and related packages to [0.28.1](https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md).

Changelog: [internal]

Reviewed By: panagosg7

Differential Revision: D73242526

fbshipit-source-id: fbe0a233b4ae1315eb0e060c6338eb7156a5c6ea
2025-04-21 07:50:22 -07:00
David Richey 634f06688c Apply SWIFTFORMAT to fbsource
Summary:
```
hg files -I '**/*.swift' \
| arc lint \
  --take SWIFTFORMAT \
  --apply-patches \
  --no-paths-check \
  --paths-from - \
  --eden-prefetch \
  --output none \
  > /dev/null
```

Reviewed By: ebgraham

Differential Revision: D73276943

fbshipit-source-id: 5432642a217fc1fa37eb97409a2cc282f65c3117
2025-04-20 18:08:18 -07:00
David Vacca 0bdf7bf2c4 Log LegacyArchitectureLogger asserts only in Debug mode (#50818)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50818

Logging LegacyArchitectureLogger asserts only in Debug mode as that will give us enough information about wrong usages of Legacy Architecture at this point

changelog: [internal] internal

Reviewed By: fkgozali

Differential Revision: D73322301

fbshipit-source-id: 981a26b1bd7c89080f35ef0ab27677b0a38f2665
2025-04-20 13:44:24 -07:00
Nick Gerleman f98c227ee9 Fix Android Gradle Build and Missing Buck Build for Test (#50813)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50813

This is already in the same package, which makes Gradle build unhappy. Then, this wasn't invoked at all by a Buck build, because we have target per folder. Let's fix those.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D73286269

fbshipit-source-id: 6100c83e6607705160e4602e8637e3b1ebe8f28b
2025-04-18 18:01:56 -07:00
Tim Yung f2518d4374 RN/Metro: Configure Transformer for React 19 (#50809)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50809

Configures `react-native/metro-babel-transformer` (used by `react-native/babel-preset`) to parse source using `hermes-parser` to target React 19. This changes components written with Component Syntax to stop generating `forwardRef` calls (because `ref` is now a prop).

Most of this was already accomplished in https://github.com/facebook/react-native/pull/50377 ({D72070021}), but this call site was missed.

Changelog:
[General][Changed] - Configured Hermes Parser to target React 19, resulting in Component Syntax no longer producing `forwardRef` calls.

Reviewed By: elicwhite

Differential Revision: D73279825

fbshipit-source-id: c0d64cb8c0adb22b78c5fbed1b2c386c8b3f3ede
2025-04-18 17:14:47 -07:00