Commit Graph

38536 Commits

Author SHA1 Message Date
Kirill Novikov 91d034533e Allow the .pnpm folder to be discovered during code generation (#49983)
Summary:
This PR (https://github.com/facebook/react-native/pull/48182) introduced skipping hidden folders during Codegen generation.

However, when using pnpm, all files are stored in the `.pnpm` folder (see explanation here: https://pnpm.io/symlinked-node-modules-structure).

As a result, some libraries that support the new architecture but lack the `ios.codegenConfig.componentProvider` field - like [FlashList](https://github.com/Shopify/flash-list/blob/main/package.json) - will be skipped during Codegen generation.

This PR explicitly includes `.pnpm` to prevent this issue.

## Changelog:

[iOS][Fixed] - Check .pnpm folder when looking for third-party components.

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

Test Plan:
Tested on:

RN 0.78.0
PNPM: 10
Flashlist: 1.7.3

Reviewed By: cipolleschi

Differential Revision: D71047936

Pulled By: cortinico

fbshipit-source-id: fa9caab23dea8c92ef5f23c997812d348eb19e08
2025-03-12 11:55:00 -07:00
Rubén Norte 0f2a53d04b Fix crashes in MutationObserver caused by commit hooks in main thread (#49981)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49981

Changelog: [internal]

(because MutationObserver isn't a public API yet)

## Context

`MutationObserver` is a [JavaScript API](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) used to report mutations in the DOM tree. The mutations available on Web are: changing children, changing attributes and changing text. In React Native, only changing children is supported.

Mutation detection needs to happen synchronously when mutations happen (in ShadowTree commits) and the notification is dispatched as a microtask in JS, which means we can only report mutations happening in JavaScript.

There's an assumption that only React (in JS) can change the structure of the tree in Fabric, so we implemented `MutationObserver` considering this assummption.

Unfortunately, while the assumption is correct (we can only mutate children from React) the implementation didn't take into account that commit hooks were triggered from multiple threads, even if the structure doesn't change (e.g.: with Fabric state updates). In this case, we do the checks but we never dispatch the notifications. This can cause crashes (see T217617393) if we try to check for mutations from the main thread while we add new observers in the JS thread (because that logic wasn't thread safe).

This fixes that crash by, in MutationObserver, not only preventing notifications from commits not coming from React, but also preventing the determination altogether.

In order to do this, this modifies the signature of the commit hooks to also pass the commit options, and adds a new field in the commit options with the source of the commit (for now, just "React" or "Unknown").

In `MutationObserver`, before accessing the data structures of the observer, we check if the commit is coming from React, and return early otherwise.

Reviewed By: javache

Differential Revision: D71036705

fbshipit-source-id: 985c8f903375cbf876dce5174e04563f74d7621a
2025-03-12 11:17:46 -07:00
Alex Hunt 24957ac248 Bump CLI to 17 (RNTester) (#49973)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49973

We still depend on the Community CLI directly, supporting local development in  `packages/rn-tester`. Bump to latest — contains a number of build improvements, and will align us closer to prod/next.

Changelog: [Internal]

Reviewed By: cortinico, cipolleschi

Differential Revision: D71033085

fbshipit-source-id: ddbf7df5a35951b77c36d111cfd12ad64c3b73f7
2025-03-12 11:07:20 -07:00
Joe Vilches 11c8c5394e Clean up usage of rn_stable_api_modules_ios_universe.enable_image_manager_queue (#49956)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49956

This is no longer being used internally so I think we can just remove this for less complexity

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D70983663

fbshipit-source-id: 61ca5212cb45dd1c8b96aee62964ad62b410d6f1
2025-03-12 11:01:20 -07:00
Nicola Corti a0528d834c RNGP - Better compatibility with Kotlin 2.1.x (#49977)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49977

See: https://github.com/facebook/react-native/issues/48274
This makes our integration with Kotlin 2.1.x easier.

Changelog:
[Android] [Changed] - Better compatibility with Kotlin 2.1.x

Reviewed By: cipolleschi

Differential Revision: D71034044

fbshipit-source-id: 9a26ed28ae4770a5c05a4113f4d86c1b97063db3
2025-03-12 10:10:46 -07:00
Peter Abbondanzo 5f12d01ff5 Fix app lagging while attempting a connection to Metro (#49949)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49949

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D70965365

fbshipit-source-id: 91f9debe7783d855493281f96aef2f3f8cdb5053
2025-03-12 10:00:47 -07:00
Jakub Piasecki c7aa3f3fe7 Export codegen functions and types from the main package (#49854)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49854

Changelog: [GENERAL][ADDED] - Codegen utility functions and types are now exported from the root package

Up to this point, third-party libraries needed to use deep imports to access codegen utilities and types This diff exports them from the main entry point, as we want to move away from supporting deep imports in OSS as a part of JS Stable API project.

Reviewed By: huntie

Differential Revision: D70628408

fbshipit-source-id: 5a6e1cb870465ede0fbc9eb8912d255aa90aa2a8
2025-03-12 09:20:55 -07:00
Sam Zhou 2cdd79f4fc Pre-suppress errors ahead of next release
Reviewed By: gkz

Differential Revision: D71039278

fbshipit-source-id: 5d42ee1707335bfb579fa49beeb597d98eba70c5
2025-03-12 09:10:02 -07:00
Mateo Guzmán 43fe9f3d88 Migrate ActivityEventListener & BaseActivityEventListener to Kotlin (#49910)
Summary:
Migrate com.facebook.react.bridge ActivityEventListener & BaseActivityEventListener to Kotlin.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.bridge ActivityEventListener & BaseActivityEventListener to Kotlin

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

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

Reviewed By: alanleedev

Differential Revision: D70871037

Pulled By: Abbondanzo

fbshipit-source-id: ebb784db5ea58598f483f9775629666716de39f0
2025-03-12 08:12:29 -07:00
Mateo Guzmán 6c5a9e8257 Migrate BaseLayoutAnimation to Kotlin (#49962)
Summary:
Migrate com.facebook.react.uimanager.layoutanimation.BaseLayoutAnimation to Kotlin.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.uimanager.layoutanimation.BaseLayoutAnimation to Kotlin

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

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

Reviewed By: cortinico

Differential Revision: D71031224

Pulled By: javache

fbshipit-source-id: c74d72b85dcc37a48a2ebb795a29ff317511d5ed
2025-03-12 07:56:06 -07:00
Vitali Zaidman 2d7356193f report high ping and event loop delay even when debug is not enabled (#49976)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49976

Changelog:
[General][Internal]

Reviewed By: robhogan

Differential Revision: D70962431

fbshipit-source-id: 74c0fcc67e1785f213629db235fbf18bcd5a5f95
2025-03-12 06:49:54 -07:00
Rubén Norte 6356a85b98 Do not log errors when the native module is missing if TurboModules are not used (#49974)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49974

Changelog: [internal]

The feature flag system currently logs an error when trying to access common feature flags (flags accessible from everywhere but defined in native) from JS if the native module isn't available.

This forces a pattern in code to check if the module is available before accessing certain feature flags, to avoid showing that error to users in the legacy architecture.

This removes the need for that pattern by adding the check in the feature flag infra itself. If TM infra isn't available, we return default values and don't log the error.

Reviewed By: rozele

Differential Revision: D70975412

fbshipit-source-id: 5544bd96aaaf046ef90ca69bc549bef4e54eb98b
2025-03-12 05:37:22 -07:00
Jakub Piasecki 39f051aeb6 Add a test case ensuring touch events are dispatched to views overflowing ScrollView content container (#49967)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49967

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D71030561

fbshipit-source-id: 4d73a0c4d3dc22b83c47091ba8de1d5261ab9ed5
2025-03-12 05:18:43 -07:00
Alex Hunt e70961e05c Bump packages for next release (#49972)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49972

Follows the recent `0.79-stable` branch cut.

Changelog: [Internal] - Bump all packages to `0.80.0-main`

Reviewed By: cortinico

Differential Revision: D70976555

fbshipit-source-id: e81e4c45c6a510e114d02853c5bb90a715b7df8b
2025-03-12 05:11:16 -07:00
Jakub Piasecki 6ecd9a43f1 Fix touch events not being dispatched to ScrollView's children when they overflow content container (#49855)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49855

Changelog: [IOS][FIXED] - Fixed touch events not being dispatched to ScrollView's children when they overflow the content container

Closes https://github.com/facebook/react-native/issues/47740.

Changes the ScrollView's container view to be `RCTViewComponentView` instead of `UIView` and sets custom layout metrics to it in a way that it will propagate touch events to all children, even if they overflow its bounds.

Reviewed By: sammy-SC

Differential Revision: D70619894

fbshipit-source-id: 348a1a369489d5208d6037c8d76b223c4ab2d5f7
2025-03-12 03:50:07 -07:00
Joe Vilches 0ade23d34f accessibleElements impl on iOS (#49582)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49582

TSIA, this is a fairly straightforward implementation since iOS likes the shape the data is already in. Note I form a stacking context since I need the native view that has `accessibilityElements` to actually be an ancestor of everything under it

Note I am not exposing anything yet on the JS side, since we need to do Android also

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D69625269

fbshipit-source-id: 836f1bb631646408a5726f126be61c0ff6afe1d0
2025-03-11 20:20:16 -07:00
Nick Gerleman 99f962627f Fix New Arch handling of inline views when text truncated (#49960)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49960

Fixes  https://github.com/facebook/react-native/issues/49106

RN legacy arch, and web, will clip inline content which appears after elipsized text. This is the correct behavior, compared to new arch, which will put it in a random place depending on the platform.

`line-clamp`: https://jsfiddle.net/7xgdke1b/
`text-overflow`: https://jsfiddle.net/7xgdke1b/2/

Fabric renderer does not, funnily enough, having an `isClipped` field on `TextMeasurement::Attachment` that is never used.

This change propagates state for whether an attachment is beyond elipsized area to this measurement, then when we see it, we set empty layout results with `DisplayType::None` so that we don't create native views. We don't layout child views either, but this seems to work out okay, even when removing and re-adding `numberOfLines`.

Changelog:
[General][Fixed] - Fix New Arch handling of inline views when text truncated

Reviewed By: mdvacca

Differential Revision: D70922174

fbshipit-source-id: 8c1f4aadbf53ff64ce55b44d6c7953d9b2e40bc5
2025-03-11 18:03:56 -07:00
Jorge Cabiedes Acosta c068c599c6 Fix keyboard navigation for FlatList with removeClippedSubviews enabled (#49543)
Summary:
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.

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

Reviewed By: joevilches

Differential Revision: D69618406

fbshipit-source-id: 1df7f90066dfc685e74a89b29222937777714b87
2025-03-11 17:08:51 -07:00
Jorge Cabiedes Acosta 81405b450c Prevent the currently focused View from getting clipped (#49961)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49961

As preparation for fixing focus on FlatList we need to prevent the currently focused view from getting clipped. This is because in Android, if the currently focused view gets clipped before transferring focus we crash.

Changelog: [Android][Changed] - Prevent currently focused child from getting clipped when `removeClippedSubviews` is enabled

Reviewed By: NickGerleman

Differential Revision: D70994348

fbshipit-source-id: 8c68eeebd7df8e7d8f788e50a3bbe46b0335ace3
2025-03-11 17:08:51 -07:00
Pieter De Baets ade41c851b Make missing parent view state in updateLayout a soft error (#49951)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49951

We previously fixed Differentiator generating an incorrect parentTag (https://github.com/facebook/react-native/pull/48055), but this can lead to crashes in Android UI due to reordering that happens in the Android mounting layer. While we have an experiment to disable this reordering (https://github.com/facebook/react-native/pull/46702) this currently has a negative performance impact which needs to be addressed.

As a mitigation, we can make the lookup of parentTag's ViewManager state nullable. We only require this to support `needsCustomLayoutForChildren`, which is not commonly used, and seems acceptable to drop in this scenario.

Changelog: [Android][Changed] Do not crash when parent view state can't be found

Reviewed By: NickGerleman

Differential Revision: D70966621

fbshipit-source-id: 33d0b6a90860788a4c9a8c6cea36c2c72c1392e1
2025-03-11 14:11:15 -07:00
Nick Lefever 1482dd9e99 Add assert for recycled views with parent (#49937)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49937

Adding an assert for recycled views still attached to their parent, which would lead to an exception when the view would be added to a new parent.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D70922503

fbshipit-source-id: 7d4daf427306203d603c31999ab138b3aee08e83
2025-03-11 12:42:46 -07:00
Pieter De Baets 54e8bd44bd Suppress deprecation error in ProgressResponseBody (#49954)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49954

We have a different version of OkHttp internally and in OSS so we need to suppress these for now.

Changelog: [Internal]

Reviewed By: Abbondanzo

Differential Revision: D70975145

fbshipit-source-id: cd2a3ab5cdc52f25c78cb608e917fa3ca378e4f1
2025-03-11 12:31:28 -07:00
Samuel Susla cf39e6164c delete feature flag excludeYogaFromRawProps (#49817)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49817

changelog: [internal]

Remove feature flag excludeYogaFromRawProps. It did not yield any performance wins and the code to support the feature is spread across multiple classes. Removal simplifies complexity.

Reviewed By: javache

Differential Revision: D70389071

fbshipit-source-id: 21751f56aec8de501ff1e1efafda035069d8ef48
2025-03-11 09:10:22 -07:00
Mateo Guzmán ff84ae9188 Migrate OpacityAnimation to Kotlin (#49822)
Summary:
Migrate com.facebook.react.uimanager.layoutanimation.OpacityAnimation to Kotlin.

I moved out `OpacityAnimationListener` as well in this PR to separate concerns and align more with the codebase.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.uimanager.layoutanimation.OpacityAnimation to Kotlin

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

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

Reviewed By: javache

Differential Revision: D70588884

Pulled By: alanleedev

fbshipit-source-id: 1b70f5e5facd5f47b828090e7c63a218229000cb
2025-03-11 08:40:10 -07:00
Mateo Guzmán bf7a0e5798 Migrate ProgressResponseBody to Kotlin (#49752)
Summary:
Migrate com.facebook.react.modules.network.ProgressResponseBody to Kotlin.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.modules.network.ProgressResponseBody to Kotlin

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

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

Reviewed By: javache

Differential Revision: D70592532

Pulled By: alanleedev

fbshipit-source-id: 2680951a3b5290314d0632eb55b69c9bcf44b96a
2025-03-11 08:28:25 -07:00
Dawid Bartczak c6a075bcc7 Fix missing type for login-password alert prompt (#49757)
Summary:
When using the `login-password` prompt type, there is a TypeScript type mismatch issue. The `callbackOrButtons` parameter returns an object with `{login: string, password: string}` structure, but this type variation is not properly included in the **AlertType** type definition. This causes TypeScript to show type errors when using callback functions that expect credentials in the format `(credentials: {login: string, password: string}) => void`.

## Changelog:
- [General] [Fixed] Add missing type variation `{login: string, password: string}` to **AlertType** type definition to properly support `login-password` prompt callbacks

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

Test Plan: This change is purely type-related and doesn't affect runtime behavior.

Reviewed By: NickGerleman

Differential Revision: D70797036

Pulled By: alanleedev

fbshipit-source-id: 8e27a39f0c8f49083730c683b41b69173715bd68
2025-03-11 08:10:11 -07:00
zhongwuzw 8d7aca30e7 Fixes TextInput crashes when any text is entered while running as iOS app on apple silicon mac (#49320)
Summary:
Fixes https://github.com/facebook/react-native/issues/48544. We can make `RCTWeakEventEmitterWrapper` to subclass `NSDictionary` that Textinput supports encode it.

System allowed classes are:
```
Allowed classes are:
 {(
    "'NSMorphology' (0x20088b6d8) [/System/Library/Frameworks/Foundation.framework]",
    "'NSString' (0x2003f4738) [/System/Library/Frameworks/Foundation.framework]",
    "'NSInflectionRule' (0x20088d348) [/System/Library/Frameworks/Foundation.framework]",
    "'UIColor' (0x2006c0520) [/System/iOSSupport/System/Library/PrivateFrameworks/UIKitCore.framework]",
    "'NSTextAttachment' (0x20042af98) [/System/Library/PrivateFrameworks/UIFoundation.framework]",
    "'NSShadow' (0x20042ae30) [/System/Library/PrivateFrameworks/UIFoundation.framework]",
    "'NSTextEncapsulation' (0x200897e50) [/System/Library/Frameworks/CoreText.framework]",
    "'NSTextAlternatives' (0x20042af70) [/System/Library/PrivateFrameworks/UIFoundation.framework]",
    "'NSFont' (0x20042a9f8) [/System/Library/PrivateFrameworks/UIFoundation.framework]",
    "'NSAttributedString' (0x2003f3838) [/System/Library/Frameworks/Foundation.framework]",
    "'NSData' (0x2003ed528) [/System/Library/Frameworks/CoreFoundation.framework]",
    "'NSURL' (0x2003ed938) [/System/Library/Frameworks/CoreFoundation.framework]",
    "'NSAdaptiveImageGlyph' (0x2008ae538) [/System/Library/PrivateFrameworks/UIFoundation.framework]",
    "'NSNumber' (0x2003f4238) [/System/Library/Frameworks/Foundation.framework]",
    "'NSParagraphStyle' (0x20042ad40) [/System/Library/PrivateFrameworks/UIFoundation.framework]",
    "'NSDictionary' (0x2003ed5a0) [/System/Library/Frameworks/CoreFoundation.framework]",
    "'UIFont' (0x20042c668) [/System/Library/PrivateFrameworks/UIFoundation.framework]",
    "'NSColor' (0x200412350) [/System/Library/Frameworks/AppKit.framework]",
    "'NSGlyphInfo' (0x20042aa98) [/System/Library/PrivateFrameworks/UIFoundation.framework]",
    "'NSArray' (0x2003ed460) [/System/Library/Frameworks/CoreFoundation.framework]",
    "'NSPresentationIntent' (0x20088da28) [/System/Library/Frameworks/Foundation.framework]"
)}
```

## Changelog:

[IOS] [FIXED] -  Fixes TextInput crashes when any text is entered while running as iOS app on apple silicon mac

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

Test Plan:
Run RNTester on apple silicon mac, and entered some text in textinput, no crash occured. Also, verified that the caret was not jumping around, thus preserving the original fix.

https://github.com/user-attachments/assets/6304f6e7-c663-4351-ace8-ab1842ee545f

Reviewed By: javache

Differential Revision: D69981500

Pulled By: cipolleschi

fbshipit-source-id: 2af9b280e42f621446efda9b101af50525e8fef7
2025-03-11 06:06:55 -07:00
Vojtech Novak 0cc1ac18cf fix(ios): enable use of multiple RCTAppDependencyProvider instances (#49889)
Summary:
instantiating multiple `RCTAppDependencyProvider` instances creates problems with their internal state, because the internal fields such as [`_thirdPartyFabricComponents` are populated once](https://github.com/facebook/react-native/blob/f5feb73022f9340583ebcf576eaedd3ca5677e1a/packages/react-native/scripts/codegen/templates/RCTAppDependencyProviderMM.template#L60) for the entire app (see [`dispatch_once`](https://developer.apple.com/documentation/dispatch/1447169-dispatch_once)).

That means when you create 2 instances, and call `thirdPartyFabricComponents` on them, the first instance will respond with a dictionary and the second with `nil`. This is unexpected.

## Changelog:

[IOS] [FIXED] - enable use of multiple `RCTAppDependencyProvider` instances

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

Test Plan:
`rnTester` - the templates are used by codegen. Running `pod install`, the files were generated correctly from the `.template` files.

I was able to verify that accessing `thirdPartyFabricComponents` on multiple instances of `RCTAppDependencyProvider` returns valid result.

<details>
<summary>screenshot</summary>

<img width="789" alt="Screenshot 2025-03-07 at 15 11 22" src="https://github.com/user-attachments/assets/9270ba90-ae7f-491a-a53a-f7e1f4606438" />

</details>

Reviewed By: javache

Differential Revision: D70892779

Pulled By: cipolleschi

fbshipit-source-id: 27c7c8fd9982b6427daec02e0de59b08ad20bfad
2025-03-11 05:57:40 -07:00
Nicola Corti 40203e21a6 Add Changelog for 0.79.0-rc.1 (#49946)
Summary:
Just the changelog for 79 RC1

## Changelog:

[Internal] [Changed] -

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

Test Plan: NA

Reviewed By: cipolleschi

Differential Revision: D70962117

Pulled By: cortinico

fbshipit-source-id: 7423c4562695f16398d39169e7b2072b6ce0b164
2025-03-11 05:56:56 -07:00
Riccardo Cipolleschi 3b3d502ccf Automate setting the RCTNewArchEnabled flag (#49927)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49927

This change automates updating App's Info.plist with the new `RCTNewArchEnabled` boolean entry. The value depends on how the pod install is set up. In this way, we maintain the previous UX to enable/disable the New Arch.

## Context
The RCT_NEW_ARCH_ENABLE flag is a compile time flag we used for almost two years to configure the iOS apps and to determine whether the app should build with the New Arch or not.

However, given that we are looking into prebuilding React Native, we have to get rid of all the compilation flags, because they would require us to prebuild a combinatorial number of artifacts for react native. For example:

- New Arch / Hermes
- Old Arch / Hermes
- New Arch / JSC
- Old Arch / JSC
- ...

## Backward compatibility
We are going to keep adding the RCT_NEW_ARCH_ENABLED flag in all the dependencies, through the cocoapods inrastructure, so libraries, which are not prebuilt, will be build for the right architecture by the app itself.

## Changelog:
[iOS][Added] -

Reviewed By: cortinico

Differential Revision: D70888212

fbshipit-source-id: 541a818e02ccb96c822de29b0714646d1e69a5a9
2025-03-11 05:05:49 -07:00
Riccardo Cipolleschi 6dd721b258 Deprecate RCT_NEW_ARCH_ENABLED (#49924)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49924

This change deprecates the RCT_NEW_ARCH_ENABLEd flag to toggle the New Architecture.

The new approach bring iOS closer to Android: to diasable the New Architecture, user needs to modify the App's Info.plist and add a `RCTNewArchEnabled` boolean entry and set it to `NO`.

The absence of the entry implies that the New Arch is enabled. (Defaults to enabled)

This also deprecates the `RCTSetNewArchEnabled` function because it makes no sense now

## Context
The RCT_NEW_ARCH_ENABLE flag is a compile time flag we used for almost two years to configure the iOS apps and to determine whether the app should build with the New Arch or not.

However, given that we are looking into prebuilding React Native, we have to get rid of all the compilation flags, because they would require us to prebuild a combinatorial number of artifacts for react native. For example:

- New Arch / Hermes
- Old Arch / Hermes
- New Arch / JSC
- Old Arch / JSC
- ...

## Backward compatibility
We are going to keep adding the RCT_NEW_ARCH_ENABLED flag in all the dependencies, through the cocoapods inrastructure, so libraries, which are not prebuilt, will be build for the right architecture by the app itself.

## Changelog:
[iOS][Deprecated] - deprecate the `RCT_NEW_ARCH_ENABLED` and the `RCTSetNewArchEnabled`

Reviewed By: cortinico

Differential Revision: D70885454

fbshipit-source-id: 4b8404ead4900d9787049ebd0b8b3c29b272f913
2025-03-11 05:05:49 -07:00
Vitali Zaidman 70c3ffe984 Use builtin libdefs from flow-typed (#49929)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49929

X-link: https://github.com/facebook/metro/pull/1459

In the next version of Flow, we will stop bundling many of the builtin libdefs, and they have been moved to flow-typed. This diff checks in them to prepare for the deployment of the next version of Flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D70896122

fbshipit-source-id: aa6bd0b1e653b983a345b0e202c8dad5058a0001
2025-03-11 04:46:33 -07:00
Vitali Zaidman a27ec64a00 report an event tracking the event loop perf in metro dev middleware (#49674)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49674

Changelog:
[General][Internal] - report an event tracking the event loop perf in metro dev middleware

Reviewed By: hoxyq

Differential Revision: D69988265

fbshipit-source-id: 89cb427215b0034d545305cccfcee542af8c0367
2025-03-11 04:41:50 -07:00
Riccardo Cipolleschi 10bbdb8679 Fix verifyReleaseOnNPM by dropping the v in the version (#49944)
Summary:
GHA passes the version to the script with a `v` prefix. However, when we receive the version from NPM, the `v` prefix is not here.
We can fix the script by dropping the `v` when it is passed to the function.

bypass-github-export-checks

## Changelog:
[Internal] - Fix verifyPackageOnNPM

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

Test Plan: GHA

Reviewed By: cortinico, fabriziocucci

Differential Revision: D70960414

Pulled By: cipolleschi

fbshipit-source-id: 4234103ebe49cf715aea4a1473a8a60978f07a9f
2025-03-11 04:05:11 -07:00
David Vacca d24e5acb26 Ensure LegacyArchitectureLogger.assertWhenLegacyArchitectureMinifyingEnabled is called only once per class loading in kotlin (#49936)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49936

Ensure LegacyArchitectureLogger.assertWhenLegacyArchitectureMinifyingEnabled is called only once per class loading in kotlin

changelog: [internal] internal

Reviewed By: alanleedev

Differential Revision: D70922132

fbshipit-source-id: ce4d68dc2ab0f61266e4bb5cddfc175c364f568a
2025-03-10 23:46:25 -07:00
Nick Lefever 3b07fb7426 Disable clipped view removal on recycle (#49938)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49938

Recycling a `ReactViewGroup` will lead to all child views being removed from the view. To avoid having view recycling corrupt the clipping state set for the child views, ahead of base view recycling preparation this diff disables `removeClippedSubviews` so that layout changes don't run over all child views that will end up being removed anyway.

The bug reported earlier should already have been resolved by D70672120 since the view recycling of a child view would remove the view from the parent. Meaning the ReactViewGroup can only have subviews that are not prepared for recycling, any recycled view would have been removed from their parent (the ReactViewGroup)

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D70921641

fbshipit-source-id: a8b311169b268c09400d2b62008184e379f6fe79
2025-03-10 19:00:36 -07:00
Sam Zhou d98fc9de2d Align internal and external definition of describe function from jest (#49934)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49934

The typing of internal version of jest and the libdef in react-native has diverged a bit. This diff aligns the typing for `describe`

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D70917375

fbshipit-source-id: 9c2ab98a08394aa187712f4966748a8a60e202b1
2025-03-10 15:19:38 -07:00
Eric Rozell 34ae9facd5 Fix issue with zIndex child removal (#49900)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49900

This appears to fix an issue where removing a sibling with zIndex breaks drawing of the next sibling. The theory is that eager return in `onViewRemoved` prevents the view from reverting into a state where it no longer uses custom draw order. However, tracing back history, this eager return was [added](https://github.com/facebook/react-native/pull/43389) to fix a bug in Reanimated. cc bartlomiejbloniarz to confirm if [this Reanimated issue](https://github.com/software-mansion/react-native-reanimated/issues/5715) resurfaces from this change.

Fixes #49838

## Changelog

[Android][Fixed] Fixes issue with z-indexed sibling removal

Reviewed By: NickGerleman, cipolleschi

Differential Revision: D70795631

fbshipit-source-id: 500af92226be29af73f36f911ffff27a0c083ae9
2025-03-10 13:43:10 -07:00
Oskar Kwaśniewski e1464c0975 fix(iOS): provide useful error message about dependency provider (#49843)
Summary:
Currently, when integrating into a native app using ReactNativeFactory, when we forget to set `dependencyProvider` we get a random crash exception instructing us (depending on native modules in our app) about an unrecognized selector:

![CleanShot 2025-03-05 at 15 21 53@2x](https://github.com/user-attachments/assets/04b8d4fe-1e40-4023-af1b-1825a3a99f33)

After this change we get a proper error informing us that we for got to set dependencyProvider:

![CleanShot 2025-03-05 at 15 22 16@2x](https://github.com/user-attachments/assets/39bb1c2a-3efc-4689-a92e-ca2ee54cb6a4)

## Changelog:

[IOS] [ADDED] - Useful error message about setting dependency provider

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

Test Plan: CI Green

Reviewed By: cortinico

Differential Revision: D70631515

Pulled By: cipolleschi

fbshipit-source-id: d99c8fa12fdb0624a01fe16c50fe0f2d10554f94
2025-03-10 12:09:52 -07:00
zhongwuzw 22cd3b1023 Fabric: Fixes Modal snapshot when closing it (#48252)
Summary:
Fixes https://github.com/facebook/react-native/issues/48245 . The reason is we reuse the modal component and also reuse the snapshot of previous modal.

## Changelog:

[IOS] [FIXED] - Fabric: Fixes Modal snapshot when closing it

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

Test Plan: Repro repo please see Fixes https://github.com/facebook/react-native/issues/48245

Reviewed By: rshest

Differential Revision: D70629570

Pulled By: cipolleschi

fbshipit-source-id: fe97184d2f27283a9c7e6df09e9df35630429ff1
2025-03-10 11:20:33 -07:00
Mateo Guzmán 0b2b91d532 Migrate JavaScriptContextHolder & JavaScriptExecutor to Kotlin (#49909)
Summary:
Migrate com.facebook.react.bridge JavaScriptContextHolder & JavaScriptExecutor to Kotlin.

In this PR I also marked the return of HermesExecutor.initHybridDefaultConfig as non-nullable to keep the conversion without logic changes. I checked that this was changed unintentionally to nullable in 12e321daf0 but I think it was not supposed to be.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.bridge JavaScriptContextHolder & JavaScriptExecutor to Kotlin

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

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

Reviewed By: javache

Differential Revision: D70871012

Pulled By: Abbondanzo

fbshipit-source-id: 1c15927056baf166e520e896e92bebf664fa0229
2025-03-10 11:08:44 -07:00
Riccardo Cipolleschi 8b33668c43 Add missing loadFromSource method in the DefaultRNFactoryDelegate (#49931)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49931

This change fixes the app startup in the Old Architecture by implementing the loadSourceForBridge:onProgress:onComplete method in the RCTDefaultReactNativeFactoryDelegate object.

The method was missing here, so the Bridge was never trying to load the JS bundle from Metro, resulting in an empty app.

## Changelog:
[iOS][Fixed] - Implement the loadSourceForBridge:onProgress:onComplete in the RCTDefaultReactNativeFactoryDelegate.

Reviewed By: cortinico

Differential Revision: D70898811

fbshipit-source-id: 3e5d519a1965e92ace91ca6d5b316a9069279448
2025-03-10 11:05:39 -07:00
Vitali Zaidman 52b02a6077 track event loop delay in metro dev middleware (#49660)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49660

Changelog:
[General][Internal] - track event loop delay in metro dev middleware

Reviewed By: robhogan

Differential Revision: D69988266

fbshipit-source-id: 042511bd68a8d6f24a8a2036f604c12ca923027a
2025-03-10 09:52:45 -07:00
Jakub Piasecki c04b4a92d1 Update modal wrapper to be translatable to TypeScript (#49923)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49923

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D70887822

fbshipit-source-id: 729e91245cfb750cf1de4f4532925ff7263b3d82
2025-03-10 08:40:37 -07:00
Jakub Piasecki e7c44b2a26 Add depth limit to StyleSheet.flatten type (#49925)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49925

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D70888318

fbshipit-source-id: ded13e64bde87803ce79a8c9272bcb5b6f4ab321
2025-03-10 08:23:33 -07:00
Pieter De Baets d8181721f6 Inline Task.call without Executor (#49906)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49906

Task.call is equivalent to a try-catch and wrapping the result in a Task. Inlining this is cheaper than creating a TaskCompletionSource and a Runnable.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D70803554

fbshipit-source-id: 0886176be974eff67c983ce1475ad685a8021b14
2025-03-10 07:51:23 -07:00
Nicola Corti d998b7b330 Remove stale BUCK setup for Android pre-builts (#49926)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49926

Those files can be fully removed as it's not referenced at all in OSS/Internal

Changelog:
[Internal] [Changed] -

Reviewed By: fabriziocucci

Differential Revision: D70888664

fbshipit-source-id: 4cacc449aa141e0465f771bf8c52d573d4227ef5
2025-03-10 07:28:20 -07:00
Vitali Zaidman d50cb768c9 instead of sampling report high ping events (#49922)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49922

Spamming the DB with "heartbeat" events with close to 0 ping didn't give us any useful information. Instead, report high ping situations.

Changelog:
[General][Internal] Remove reporting all device and debugger heartbeat events, only report heartbeats with high round trip latency

Reviewed By: GijsWeterings

Differential Revision: D70707457

fbshipit-source-id: 6bc8a55fd32dfa60fb4f7764ac00a6218417dcb5
2025-03-10 07:07:49 -07:00
Mateo Guzmán 0928406530 Make DispatchCommandMountItem, MountItemFactory, MountItem & BatchMountItem internal (#49893)
Summary:
As part of the initiative to reduce the public API surface, these classes under com.facebook.react.fabric.mounting.mountitems can be internalized. I've checked there are no relevant OSS usages:

- [DispatchCommandMountItem](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.fabric.mounting.mountitems.DispatchCommandMountItem) (all GH results are forks)
- [MountItemFactory](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.fabric.mounting.mountitems.MountItemFactory)
- [MountItem](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.fabric.mounting.mountitems.MountItem) (a lot of GH results, but all are forks)
- [BatchMountItem](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.fabric.mounting.mountitems.BatchMountItem) (all GH results are forks)

## Changelog:

[INTERNAL] - Make DispatchCommandMountItem, MountItemFactory, MountItem & BatchMountItem internal

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

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

Reviewed By: cortinico

Differential Revision: D70788076

Pulled By: javache

fbshipit-source-id: 34b8c5e0a716365d5905dfb846c6467b0ae9fc09
2025-03-10 06:54:42 -07:00
Pieter De Baets c2b49d446a Fix disabled ReactHost tests (#49907)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49907

These tests have been disabled for a while due to feature flags being introduced, fusebox flags with native dependencies, and the removal of Powermock.

Changelog: [Internal]

Reviewed By: Abbondanzo

Differential Revision: D70803553

fbshipit-source-id: d1ae6e4ca6c0d22e6a8c89bf01b28333929fa8a6
2025-03-10 06:07:25 -07:00