Commit Graph

12270 Commits

Author SHA1 Message Date
Pieter De Baets 0486604c89 Use delegate to handle commands when available (#51769)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51769

Generated delegate has this

```
  Override
  public void receiveCommand(T view, String commandName, Nullable ReadableArray args) {
    switch (commandName) {
      case "highlightTraceUpdates":
        mViewManager.highlightTraceUpdates(view, args.getArray(0));
        break;
      case "highlightElements":
        mViewManager.highlightElements(view, args.getArray(0));
        break;
      case "clearElementsHighlights":
        mViewManager.clearElementsHighlights(view);
        break;
    }
  }
````

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D75797948

fbshipit-source-id: c05f09f0afbc41b83b759e62ae020b6a7ebc6f0f
2025-06-03 07:28:18 -07:00
Moti Zilberman ab2c81faeb Bring RNDT shell to front when paused on breakpoint (#51748)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51748

Changelog: [Internal]

Implements the first RNDT shell-specific feature based on https://github.com/facebook/react-native-devtools-frontend/pull/168 - namely, the ability for RNDT to foreground itself when certain events occur. This is most noticeable when pausing on a breakpoint.

Reviewed By: huntie, vzaidman

Differential Revision: D75795689

fbshipit-source-id: a073bf8ea96ba70d835007f5af6069d49a693d81
2025-06-03 06:37:35 -07:00
Nicola Corti 48395d346b Convert ReactViewGroup to Kotlin (#51767)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51767

This is going to convert the last class inside `com.facebook.react.views.view` to Kotlin.

I still need to assess if this is going to be breaking or not for our users. Potentially some
breakages for Kotlin consumer could happen (see changes on ReactViewManager).
I'll follow-up with an investigation on that one.

Changelog:
[Android] [Changed] - Convert ReactViewGroup to Kotlin

Reviewed By: mdvacca

Differential Revision: D75797215

fbshipit-source-id: 5d58faa651d5959909a4b0237aad9c4209895083
2025-06-03 04:56:24 -07:00
Samuel Susla 747eb3c8ae Introduce Fantom.unstable_advanceAnimationsByTime (#51752)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51752

changelog: [internal]

Introduce a way to test animations: `unstable_advanceAnimationsByTime`. An API that fakes passage of time and triggers UI ticks to simulate how animations are run on iOS and Android.

The API is marked as unstable because it might evolve as we write more tests for C++ Animated.

Reviewed By: mdvacca

Differential Revision: D75787082

fbshipit-source-id: 24e29732bbbf581871e7868289257ab60d891ddf
2025-06-03 04:43:35 -07:00
Samuel Susla dd590c5b58 Remove outdated asserts from StubViewTree (#51751)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51751

changelog: [internal]

these asserts are not correct with C++ Animated or anything that overrides pull transaction. When pull transaction is overriden, the modified mounting instructions are not stored in shadow tree. Therefore, these asserts fail.

Reviewed By: rshest

Differential Revision: D75787083

fbshipit-source-id: ac08b96f6dea89a9f127b179a5d05e351b281c35
2025-06-03 04:43:35 -07:00
Samuel Susla d0e402f3d9 Call onRender inline instead of from startRenderCallbackIfNeeded (#51750)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51750

changelog: [internal]

inline call `onRender()` instead of calling it from `startRenderCallbackIfNeeded`. This has identical functionality but allows to use Fantom to test C++ Animated. In Fantom, there is only one thread the existing mechanism in C++ Animated uses thread locals to capture which thread in the UI thread. Therefore, some assumptions are broken. This is just an easy workaround around the problem.

Reviewed By: javache, zeyap

Differential Revision: D75787084

fbshipit-source-id: 8d70ef2d13e4ab14807deb7ca4cb0844980f5901
2025-06-03 04:43:35 -07:00
Samuel Susla 116fb6dab0 Make time in C++ Animated injectable (#51749)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51749

changelog: [internal]

Make it possible to inject time via `now` argument to C++ Animated. This will be used in testing.

Reviewed By: javache

Differential Revision: D75710463

fbshipit-source-id: 2d6da875c7379c4b229f8b7af0fa665cebc2ca8b
2025-06-03 04:43:35 -07:00
Riccardo Cipolleschi 80e8a6a161 Fix build after unifying RNCore in FBReactNativeSpec (#51766)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51766

Yesterday we landed [95ed8a6123](https://github.com/facebook/react-native/commit/95ed8a6123024afd03227358ab4b165fdf87b270) where we unified `rncore` and `FBReactNativeSpec` into the latter.

This of course broke the current setup of SwiftPM. This diff fixes it.

## Changelog:
[Internal] - Exclude rncore components

Reviewed By: javache

Differential Revision: D75863335

fbshipit-source-id: ad2739bed5645e41048a8bc466736712db18c3b6
2025-06-03 04:12:13 -07:00
Riccardo Cipolleschi 9c1a55a0b8 simplify searchPaths for FBLazyVectorPath (#51726)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51726

Previously we were spreading the searchPath on the FBLazyVectorPath everywhere, but that's not needed.

This change ensure that only the targets that nedds visibility over the FBLazyVectorPath depends on them.

## Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D75756304

fbshipit-source-id: 41abe073bf271fd5059f9cb8536cc4a8948a03dd
2025-06-03 04:12:13 -07:00
Riccardo Cipolleschi 004726eeca simplify searchPaths for ReactFBReactNativeSpecPath (#51727)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51727

Previously we were spreading the searchPath on the ReactFBReactNativeSpecPath everywhere, but that's not needed.

This change ensure that only the targets that nedds visibility over the ReactFBReactNativeSpecPath depends on them.

## Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D75756302

fbshipit-source-id: 41680b98dd07ea1abb09cebb1a1b8321f08929a0
2025-06-03 04:12:13 -07:00
Riccardo Cipolleschi dbbf0f8cf8 simplify searchPaths for CallInvoker (#51728)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51728

Previously we were spreading the searchPath on the CallInvoker everywhere, but that's not needed.

This change ensure that only the targets that nedds visibility over the CallInvoker depends on them.

## Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D75756303

fbshipit-source-id: d6fe70e43f65d8e9da5f1d18dc58491217575734
2025-06-03 04:12:13 -07:00
Riccardo Cipolleschi 7ef7736130 simplify searchPaths for RuntimeExecutor (#51729)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51729

Previously we were spreading the searchPAth on the Runtime Executor everywhere, but that's not needed.

This change ensure that only the targets that nedds visibility over the runtimeExecutor depends on them.

## Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D75756305

fbshipit-source-id: e54f1939d72049e7f4e8d3d14f7a33eacd5ac46f
2025-06-03 04:12:13 -07:00
Riccardo Cipolleschi 0e775ba378 Cleanup header search paths (#51730)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51730

This change cleans up the header search paths that are now mostly computed starting from other informations of the target.

There are still some execptions, for example for header only target for which we can't have a SwiftPM target. Therefore targets that depends on header only targets need to specify them in their search path.

Plus there are a small number of other exceptions, such as some circular dependencies on header only files.
We will fix them later on, by introducing separated targets

## Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D75756307

fbshipit-source-id: 53f24dcb08947648c8fce5c520a949b3b896c2fa
2025-06-03 04:12:13 -07:00
Riccardo Cipolleschi c38007a875 Improve searchPath transitive computation (#51731)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51731

With this change, we are computing the headerSearchPaths starting from the path, and the source's path. In this way we can greatly reduce the amount of searchPaths we have to manually specify, making it much easier to maintain the SwiftPM package in the long run.

## Changelog:
[Internal] -

## Facebook:
The next diff  in the stack proceeds with the cleanup.

Reviewed By: cortinico

Differential Revision: D75756306

fbshipit-source-id: 411ba6b598e568648488921c3ee62b8111f76749
2025-06-03 04:12:13 -07:00
Riccardo Cipolleschi 527e39a470 Move scrollView to ReactFabric (#51691)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51691

In cocoapods infrastructure, Scrollview is part of ReactFabric.
In the SwiftPM implementation we erroneously moved that to reactFabricComponents. However, the new view culling features in reactFabric imports scrollview and that was broken in Swift PM.

This change fixes it.

## Changelog:
[Internal] - move scrollview to reactFabric

Reviewed By: lenaic

Differential Revision: D75638510

fbshipit-source-id: 00828956093aaa87e15c22d15ca3a647876182f5
2025-06-03 04:12:13 -07:00
Rubén Norte 8ac0ccbb91 Add tracing section for event loop tick work for IntersectionObserver (#51744)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51744

Changelog: [internal]

TSIA

Reviewed By: rshest

Differential Revision: D75789346

fbshipit-source-id: fa32cd3e5d9809bcbad48f0a6f1706efcce34d7f
2025-06-03 02:42:38 -07:00
Nick Gerleman 7979c7ce06 Remove YogaLayoutableShadowNode::cleanLayout() and Fix ParagraphShadowNode Font Size Invalidation Logic (#51760)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51760

This API is evil.

Yoga's public API never allows a dirty node to become clean again, until its laid out, but this API requires doing that, since we will otherwise automatically dirty by default.

Let's replace it with `YogaLayoutableShadowNode::shouldNewRevisionDirtyMeasurement()`, which lets individual ShadowNodes represent whether a new revision's state and props should cause dirtying, defaulting to true.

Changelog:
[General][Removed] - Remove `YogaLayoutableShadowNode::cleanLayout()`

Reviewed By: lenaic

Differential Revision: D75479902

fbshipit-source-id: a40aa531522a76dc49feb7d12bae5a8d877c6c06
2025-06-02 19:52:31 -07:00
Tim Yung 5c8c5388fc RN: Fix Shadowing of Animated Styles (#51719)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51719

When `Animated` traverses props for instances of `AnimatedNode`, it flattens `props.style` before traversing it so that we correctly ignore any `AnimatedNode` instances that may be shadowed by static values:

```
{
  style: [
    {transform: [{translateX: new Animated.Value(0)}]},
    {transform: [{translateX: 100}]},
  ],
}
```

However, there is a bug that occurs when *every* `AnimatedNode` instance is shadowed. In this case, `AnimatedProps` assumes that there are *no* `AnimatedNode` instances in the entire `props.style`.

It then incorrectly operates on the unflattened `props.style`, which *does* have `AnimatedNode` instances. When this is passed to `View`, the `AnimatedNode` instances are encountered and can cause a crash in `processTransform`, as reported by: https://github.com/facebook/react-native/issues/51395

The fix for this was originally attempted by riteshshukla04 in https://github.com/facebook/react-native/pull/51442. This diff reuses the same unit test case, but it applies a different fix that does not involve re-traversing the `props.style` object.

The fix is gated behind a feature flag, `alwaysFlattenAnimatedStyles`. This will enable us to validate correctness of the new behavior before enabling it for everyone. (Beyond fixing the bug described above, this also causes styles to flatten more aggressively, so production testing is important to ensure stability.)

Changelog:
[General][Changed] - Creates a feature flag that changes Animated to no longer produce invalid `props.style` if every `AnimatedNode` instance is shadowed via style flattening.

Reviewed By: javache

Differential Revision: D75723284

fbshipit-source-id: 504f63e8edf836243d615783e119137a920ad271
2025-06-02 19:19:03 -07:00
Chang Hua 3353579946 fix ReactScrollViewHelper.kt remove listeners logic (#51718)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51718

## what

the current removing listeners code is not working. in prod, when removeScrollListener is called, it creates a new weakReference of the scroll listener and it would never match any existing weakreference listeners in the list. The remove action would end up removing nothing from the list.

This diff fixes the issue by iterating through the list and compare the obj
reference: https://stackoverflow.com/questions/6296051/how-to-remove-a-weakreference-from-a-list

Changelog: [Internal]

Reviewed By: Abbondanzo

Differential Revision: D75716993

fbshipit-source-id: af9eed218deb44e87317c19ffca7d227b96de8e2
2025-06-02 18:26:58 -07:00
Soe Lynn ab9ff886fc Remove unused header import (#51754)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51754

Changelog: [Internal]

Remove unused header import from RuntimeScheduler_Modern.cpp

Reviewed By: mdvacca

Differential Revision: D75815960

fbshipit-source-id: 32f7cab30216b3a76452dc9ef6354517fe3fcaf2
2025-06-02 16:10:59 -07:00
Tim Yung 0a951c1867 RN: Create virtualViewPrerenderRatio Feature Flag (#51716)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51716

Adds a feature flag to experiment with different `prerenderRatio` values from the `VirtualView` native component. Notably, this is the first time that the a feature flag has a non-boolean type.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D75713594

fbshipit-source-id: ff3feb8d8bb3292fea6e04a4cfccd87e8249144e
2025-06-02 15:48:22 -07:00
Tim Yung 746376af00 RN: Represent Numeric Feature Flags as Double (#51713)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51713

Changes the React Native Feature Flags system so that numeric feature flags are represented in native languages as double instead of int, in order to avoid loss of precision for non-integral JavaScript numbers.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D75709111

fbshipit-source-id: d4b2d553ce1e719a5f4b136a4f8d2e46446ef8d8
2025-06-02 15:48:22 -07:00
David Vacca 46e70fbcfd Rename root -> view in ViewManager parameters (#51755)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51755

this diff renames root -> view in ViewManager parameters

changelog: [internal] internal

Reviewed By: mlord93

Differential Revision: D75803186

fbshipit-source-id: e70708b5b504c13d617be3becac340d65471e67c
2025-06-02 14:56:59 -07:00
Mateo Guzmán df6eff4f8c Improve e2e times and flakiness by using the search (#51590)
Summary:
I'm writing some tests for some APIs/components, and I see some opportunity for improvement in the way how we can write e2e cases for the RNTester.

This diff improves two things:

1. e2e execution times: right now as we are using the `scrollUntilVisible` functionality, it takes quite some time *for some cases*, as some of the items are not very up in the lists and getting to them it's not always very fast.
2. Flakiness: I ran the tests multiple times locally, and in multiple occasions, the `scrollUntilVisible ` did not find anything as the scroll was too fast so the test ended up failing.

Instead of using `scrollUntilVisible` for all cases, we can simply use the search bar which we have in both Components and APIs tabs. This runs faster and we can also share the search flow across multiple test cases, so writing the tests becomes a bit simpler as well.

Initially, I did this for all cases but not all cases benefit from this change as some of them are easier to find than others – the improvement was most notable in iOS (keyboard visibility seems to make a big difference), but I still think it is a good baseline to use the search as if more test cases are added, likely, many of them are not going to be so easy to find.

## Changelog:

[INTERNAL] - Improve e2e times and flakiness by using the search

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

Test Plan:
These are the differences in the time it takes to pass the tests locally.

iOS:

| Before | After |
|--------|-------|
| <img width="336" alt="image" src="https://github.com/user-attachments/assets/6bc80de6-5a10-4c0c-b6b0-f7850d746781" /> | <img width="329" alt="image" src="https://github.com/user-attachments/assets/de47a7ff-84cf-4916-abce-9b3df96a03e1" /> |

<details>
<summary>Android (no significant difference):</summary>

| Before | After |
|--------|-------|
| <img width="328" alt="image" src="https://github.com/user-attachments/assets/73023669-af8e-410c-aee2-529d1cce7acf" /> | <img width="336" alt="image" src="https://github.com/user-attachments/assets/3fb868a9-36f5-43c3-9261-6f2753e28e5f" /> |

</details>

Reviewed By: cortinico

Differential Revision: D75389138

Pulled By: cipolleschi

fbshipit-source-id: cf9d11ab0f84c91eaa20ee5c4441766729925571
2025-06-02 10:16:48 -07:00
Krystof Woldrich 8f189fce03 fix(types): Devtools.d.ts (#51737)
Summary:
- This is similar to https://github.com/facebook/react-native/pull/43566, but include also updated `StackFrame` type.

The current `Devtools.d.ts` doesn't match the `parseErrorStack.js` and `symbolicateStackTrace.js` implementations.

I've tried to run `build-types`, but only `symbolicateStackTrace.d.ts` was generated. I've not checked why.

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

[GENERAL] [FIXED] - Devtools TS Types

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

Test Plan: Call `parseErrorStack` and `symbolicateStackTrace` in TS.

Reviewed By: rshest

Differential Revision: D75782013

Pulled By: huntie

fbshipit-source-id: 91fe560f079731af2a5834c8de8eafb723d00bf9
2025-06-02 09:39:26 -07:00
Zeya Peng 581097b8ea (Redo PR #51264) Remove native animation fabric sync in JS and infinite animation loop workaround
Summary:
## Changelog:

[General] [Changed] - Remove native animation fabric sync in JS and infinite animation loop workaround, when cxxNativeAnimated is enabled

when cxxNativeAnimated is enabled, we'll sync native animation props back to Fabric in native, when that happens we can remove the code in JS for same purpose

Reviewed By: sammy-SC

Differential Revision: D75789100

fbshipit-source-id: 966e2b187f43e8743ccbf7ba97b8e8a27273fe0c
2025-06-02 09:29:40 -07:00
Pieter De Baets 68ed4071e2 Add missing tests references to buck targets (#51743)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51743

Noticed some of these were missing, which may lose us useful test signal, or prevent tests from being ran at all.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D75789456

fbshipit-source-id: 75645866c672c77d3dac34383105955ef6d25e60
2025-06-02 09:05:14 -07:00
Pieter De Baets 95ed8a6123 Merge all core codegen into FBReactNativeSpec (#50317)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50317

`rncore`, `FBReactNativeSpec` and `FBReactNativeComponentSpec` contain the same symbols, which leads to conflicts when we try to merge them into a single shared library. Cleanup the duplication and standardize on `FBReactNativeSpec` everywhere. I've left the Android OSS targets names as is, to avoid breaking deps.

This aligns react-native's package.json with the codegen tooling supported across iOS and Android, which is a single target for all all type-derived codegen.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D55037569

fbshipit-source-id: dbf3c0a427c9d0df96e439b04e5b123cd1069c51
2025-06-02 08:47:05 -07:00
Tim Yung 95113e9dfd RN: Default featureflags Script to Update (#51708)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51708

Changes `yarn featureflags` to default to `--update` when no options are supplied.

Provides a way to display the available options with a new `--help` option.

Changelog:
[Internal]

Reviewed By: sammy-SC

Differential Revision: D75692119

fbshipit-source-id: 50d25c5f12c7646159872661c93ebe8c42f44788
2025-06-02 08:40:55 -07:00
Tim Yung 8343045404 RN: Support Non-Boolean Feature Flags (#51707)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51707

Currently, the feature flag system does not properly support non-boolean feature flags. The type definitions and generated code make assumptions about the value type being `boolean`.

This diff fixes these assumptions so that non-boolean feature flags are supported.

Changelog:
[Internal]

Reviewed By: sammy-SC

Differential Revision: D75690997

fbshipit-source-id: 870063ff979d0650ce6d0a2f6b340d97c28d7d0b
2025-06-02 07:36:53 -07:00
Moti Zilberman 8037e20206 Update debugger-frontend from 343405b...41bf86b (#51739)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51739

Changelog: [Internal] - Update `react-native/debugger-frontend` from 343405b...41bf86b

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebook/react-native-devtools-frontend/compare/343405ba784fca9290486cbce57e7f2ca953dc14...41bf86bdbb3e59e7711f11527efac67c050bca75).

Reviewed By: huntie

Differential Revision: D75785047

fbshipit-source-id: 5b2a611237e78811f140e8f3cdb8dec4a8b8a2be
2025-06-02 07:19:30 -07:00
Vladimir Iliev 36ddf853c3 Fix emitting event from turbo module crashes on 32bit android (#51695)
Summary:
After testing the latest RC and nighly builds, crash appeared when emitting events from turbo modules on 32bit Android devices. The crash is always reproducible only on 32bit devices on signed production builds. Fore more details and the crash log, check the [related issue](https://github.com/facebook/react-native/issues/51628#issue-3094045077).

From what I found, the variadic functions like CallVoidMethod are unsafe on 32bit due to not type checking the passed arguments at compile time. As far as I understand the 64bit cpus and ABIs are more forgiving with alignment and calling conventions. On 32bit the ABIs are strict as arguments are passed on the stack and if there is type/size/alignment issue it reads the wrong memory, which causes the SIGEGV crashes.

## Changelog:
[ANDROID] [FIXED]  - emitting event from turbo module crashes on 32bit android

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

Test Plan:
1. Pull the [reproduction demo](https://github.com/vladimirivanoviliev/rn079eventcrash), install the dependencies (v `0.80` is on PR)
2. Run codegen on android
3. Build signed apk. To create it you will need to create new demo key-store.
4. To install the build apk in 32bit mode you can use `adb -s YOURDEVICE install --abi armeabi-v7a android/app/release/app-release.apk`
5. Run the app, create key, save it. Than update the key and save it again. The app crashes when try to emit event from the turbo module.
6. Patch the related `JavaTurboModule.cpp` file with the changes from this PR and enable build from source.
7. Rebuild and reinstall the apk and test again - the issue is now fixed

## Additional notes:
I have tested the app on android using the `rn-tester` demo app, everything works as expected. I also patched our production app and tested more complex scenarios and they works as expected. I have run the tests and linter and they passed.

One thing that I didn't able to setup and run is the iOS `rn-tester` app, due to Hermes engine error `Command PhaseScriptExecution failed with a nonzero exit code`. I haven't found any information how to fix it. I have followed [this guide](https://github.com/facebook/react-native/blob/main/packages/rn-tester/README.md) and installed node modules using yarn and started the `yarn prepare-ios`. I also haven't found any information with what node version and ruby version the react native package is build on CI so I use the same versions locally. If you provide me with updated instructions for those I can contribute by updating the related guides and including `.npmrc`, `.ruby-version` files.

Reviewed By: cortinico

Differential Revision: D75782377

Pulled By: javache

fbshipit-source-id: b94998be6dd51e90ad4137b1d2e38a6850bc3cb2
2025-06-02 04:50:40 -07:00
riteshshukla04 a6908ad1a5 Add pending declaration for ScrollView (#51613)
Summary:
Fixes https://github.com/facebook/react-native/issues/51548

## 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
-->
[General][ADDED] Added more Pending Decleration for ScrollView

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

Test Plan: Can be tested on RNTester with ScrollView

Reviewed By: cortinico

Differential Revision: D75516801

Pulled By: rshest

fbshipit-source-id: 87d6f68ab0a3ffd50af57b5eeaf313da4bf7ed98
2025-06-02 03:00:05 -07:00
Riccardo Cipolleschi e324874614 Fix workflow-retry for android (#51684)
Summary:
The retry mechanism introduced in [this commit]() works for iOS e2e failures but it is skipped if android e2e tests fails.
This change should fix that

## Changelog:
[Internal] - Fix retry for Android E2E tests

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

Test Plan: GHA

Reviewed By: rshest

Differential Revision: D75719890

Pulled By: cipolleschi

fbshipit-source-id: 0c2a22268bb655617eaf27f61227a46650878b4e
2025-06-02 02:58:37 -07:00
Mateo Guzmán d3d92b9a1d Unify RNTester Cache Policy Image example (#51580)
Summary:
The Image component in Android now supports the same cache control behaviour as in iOS, the examples needed to be separated in the past because the support was not the same for iOS and Android, but now that it is, we can unify the example.

## Changelog:

[INTERNAL] - Unify RNTester Cache Policy Image example

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

Test Plan:
<details>
<summary>RNTester Screenshots</summary>

| iOS | Android |
|--------|-------|
| ![Simulator Screenshot - iPhone SE (3rd generation) - 2025-05-24 at 12 55 30](https://github.com/user-attachments/assets/f2fd680d-67e4-42db-bc91-f09fe5b0f947) | ![Screenshot_1748084132](https://github.com/user-attachments/assets/ef1b5454-4a85-48d7-be76-3107082b883e) |
</details>

Reviewed By: yungsters

Differential Revision: D75538812

Pulled By: Abbondanzo

fbshipit-source-id: 7705c8f824cb18cebc39e84b6f48979035dc104c
2025-05-31 13:13:39 -07:00
Samuel Susla cddfe4a035 use if statement instead of unordered_map for mapping (#51705)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51705

changelog: [internal]

use if/else instead of unordered_map to map types of nodes/drivers from string to a class. This is faster and improves binary size.

Reviewed By: javache

Differential Revision: D75676701

fbshipit-source-id: be9b8b646ebd9472382e6f692768b8fe9703d88f
2025-05-30 10:28:17 -07:00
Rubén Norte 6a7cea25ba Fix reporting of errors during test setup (#51704)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51704

Changelog: [internal]

If you create a Fantom test that throws an error during its setup (not during the execution of specific tests), Fantom fails with an error saying there are no tests defined, which isn't useful.

This fixes the problem and shows where the error in the test setup happened exactly.

Reviewed By: javache

Differential Revision: D75689283

fbshipit-source-id: 54dd2382868dda0d284f46743ed94ba94aa3afdc
2025-05-30 10:25:16 -07:00
Pieter De Baets 96fe4a5ad7 Move default trackingName as undefined to RCTNetworking (#51703)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51703

Feedback on D75516619

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D75544422

fbshipit-source-id: f6c5e0090946b7861fd9cd9646e1b06b7c6a05d2
2025-05-30 09:56:20 -07:00
Pieter De Baets 69b56a4ca0 Do not use delegate wrapper for NativeReactNativeFeatureFlags (#51702)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51702

We have no need for C++ bridging in this TurboModule, as the generated code matches the base codegen exactly.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D75681901

fbshipit-source-id: 4b6caafe0bcd08a06686e0a44112bdb99a64a1cf
2025-05-30 09:50:36 -07:00
Alex Hunt 1a46b203b8 Re-expose src/ paths via exports (default) (#51699)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51699

Re-expose **all `"./src/*"` paths via `package.json#exports`.

Follows D72228547 — as we'd attempted to be proactive with hiding `src/`, but are now reverting — essentially reducing this change as much as possible (read: most defensive/safer effect on OSS).

**Motivation**

Mitigates a warning emitted by Metro that may surface in new bare React Native template projects.

{F1978757796}

This is due to a 1P reference to `'react-native/src/private/featureflags/ReactNativeFeatureFlags` in `react-native/virtualized-lists`.

This is enough motivation to undo part of our change with introducing `"exports"` on `react-native` in 0.80.

**Especially**, to avoid confusion with other warnings we've intentionally introduced in 0.80 around subpath imports.

- The key difference is the above screenshot is from Metro and covers **any** import from any `node_modules` file — as opposed to just the immediate project.

Changelog:
[General][Changed] - Re-expose `src/*` subpaths when not using the Strict TypeScript API

The net breaking change for 0.80, once picked, is simply the presence of `"exports"` (only very edge case effects on expanding per-platform extensions, which we've mitigated). **All exported paths equivalent**.

Reviewed By: robhogan

Differential Revision: D75682566

fbshipit-source-id: f90c7298279c6be3a4eab70f2dfdc618ffcf1124
2025-05-30 08:49:59 -07:00
Rubén Norte a218b63969 Refactor test setup to avoid importing the Fantom module before the body of the test (#51696)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51696

Changelog: [internal]

I realized that the Fantom module was being initialized before the execution of the test module itself (as part of the code generated by the runner), which could have problems if the test sets up the global environment that Fantom consumes. For example, if Fantom needs to use the `EventTarget` type from the global scope, it needs to wait until the initialization of the runtime so it can use it safely.

This refactors all the code calling into Fantom as part of our infra to always initialize it lazily, so the first thing that runs as part of the test execution is the test itself (apart from our test setup, which is supposed to be side-effect free).

Reviewed By: sammy-SC

Differential Revision: D75681181

fbshipit-source-id: 91e4b903a49fcee59c5875e73db314cde0adea03
2025-05-30 07:50:42 -07:00
Samuel Susla 3fb965df0c prevent deadlock in C++ Animated (#51697)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51697

changelog: [internal]

as a general rule of thumb, do not call outside of your class when holding a mutex. It is easy to cause a deadlock because the outside code may end up trying to acquire the mutex down the stack, leading to deadlock.

Here, it happens because `startRenderCallbackIfNeeded` may end up calling onRender and in onRender, we try to acquire the mutex again

Reviewed By: javache

Differential Revision: D75675465

fbshipit-source-id: 46168ee154a54ae5cccaa74728b41f027519db59
2025-05-30 07:49:38 -07:00
Moti Zilberman 366c89265f Fix up debugger-shell package definition (#51694)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51694

Changelog: [Internal]

D74820232 was missing an `exports` entry for `debugger-shell/package.json`, which is needed for some of our build tooling.

Reviewed By: hoxyq

Differential Revision: D75679347

fbshipit-source-id: 8deaf55ce354afcff410104948cad1b9a30093b7
2025-05-30 07:42:10 -07:00
Riccardo Cipolleschi cb6d388603 Add reactRuntime target (#51690)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51690

This change adds the reactRuntime target to SwiftPM

## Changelog:
[Internal] - Add reactRuntime

Reviewed By: cortinico

Differential Revision: D75638242

fbshipit-source-id: 900a1254e3084a78f41aec5e51f7513724c152ec
2025-05-30 07:21:25 -07:00
Jay Koutavas 48b2dd355b Fix ConcurrentModificationException in InteropUIBlockListener (#51631)
Summary:
This React Native Android fix hardens the Fabric `InteropUiBlockListener` against `ConcurrentModificationException` crashes in `willMountItems` and `didMountItems`. By iterating over a shallow copy of the UI‐block lists and catching any mid‐iteration mutations, we ensure the listener never throws during a UI frame and always clears its pending blocks.

The issue was first reported in [React Native Issue https://github.com/facebook/react-native/issues/49783](https://github.com/facebook/react-native/issues/49783), and although [React Native PR#50091](https://github.com/facebook/react-native/pull/50091) was closed and not merged, the work in that PR did make it to React Native in [commit 17da3cb](https://github.com/facebook/react-native/commit/17da3cbbf4687f86226c4a80297c4d8abfc9c4f5). However, the fix didn't go far enough. We saw intermittent examples of this exception being thrown when swiping through a carousel from `react-native-reanimated-carousel`. This fix goes right to the exception site itself.

## Changelog:

[ANDROID] [FIXED] -  Hardened the Fabric `InteropUiBlockListener` against `ConcurrentModificationException` crashes in `willMountItems` and `didMountItems`

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

Test Plan:
The only way to test this is to develop a standalone app that emulates what we've been seeing in our commercially available RN app. We have done extensive testing of before (intermittent crashes) and after the fix (no crashes) and things have been standing up very well for us.

Here is a the Red Box we see right at the time of the crash, before this fix:

<img width="414" alt="image" src="https://github.com/user-attachments/assets/8d1b6c6d-42f7-48a0-9574-2f05436547d4" />

And here is the beginning of the logcat crash log:

```
2025-05-07 16:01:49.212 unknown:BridgelessReact com.aura.suite                       W  ReactHost{0}.handleHostException(message = "null")
2025-05-07 16:01:49.212 unknown:ReactNative     com.aura.suite                       E  Exception in native call
                                                                                        java.util.ConcurrentModificationException
                                                                                        	at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1111)
                                                                                        	at java.util.ArrayList$Itr.next(ArrayList.java:1064)
                                                                                        	at com.facebook.react.fabric.internal.interop.InteropUIBlockListener.willMountItems(InteropUiBlockListener.kt:72)
                                                                                        	at com.facebook.react.fabric.FabricUIManager$MountItemDispatchListener.willMountItems(FabricUIManager.java:1235)
                                                                                        	at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchMountItems(MountItemDispatcher.java:184)
                                                                                        	at com.facebook.react.fabric.mounting.MountItemDispatcher.tryDispatchMountItems(MountItemDispatcher.java:122)
                                                                                        	at com.facebook.react.fabric.FabricUIManager$3.runGuarded(FabricUIManager.java:820)
                                                                                        	at com.facebook.react.bridge.GuardedRunnable.run(GuardedRunnable.java:29)
                                                                                        	at com.facebook.react.fabric.FabricUIManager.scheduleMountItem(FabricUIManager.java:824)
                                                                                        	at com.facebook.react.fabric.FabricUIManagerBinding.reportMount(Native Method)
                                                                                        	at com.facebook.react.fabric.FabricUIManager$MountItemDispatchListener$1.run(FabricUIManager.java:1282)
                                                                                        	at android.os.Handler.handleCallback(Handler.java:959)
                                                                                        	at android.os.Handler.dispatchMessage(Handler.java:100)
                                                                                        	at android.os.Looper.loopOnce(Looper.java:232)
                                                                                        	at android.os.Looper.loop(Looper.java:317)
                                                                                        	at android.app.ActivityThread.main(ActivityThread.java:8592)
                                                                                        	at java.lang.reflect.Method.invoke(Native Method)
                                                                                        	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
                                                                                        	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
```

All of this goes away with this fix. We're using React Native 0.79.2 and this is the first time we've open a PR for react-native. I hope this is enough info as far as testing goes.

Can we see a 0.79.x release with this fix, please?

Reviewed By: Abbondanzo, cortinico

Differential Revision: D75594791

Pulled By: javache

fbshipit-source-id: 982ae27e89756fdb290a24b0bdfa67c2e47c04e3
2025-05-30 03:50:09 -07:00
Moti Zilberman 63f4fb129f Scaffold debugger-shell package (#51688)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51688

Changelog: [Internal]

# Context

See D74904547.

## This diff

Creates the `react-native/debugger-shell` package, containing a basic implementation of an Electron-based shell for React Native DevTools. At this point, there is no direct dependency on the new package from the rest of React Native - it's designed to be used as part of a Meta-internal experimental rollout of the new debugger shell via the `BrowserLauncher` interface in `dev-middleware`.

Reviewed By: huntie

Differential Revision: D74820232

fbshipit-source-id: cb06ea9e2ed8c8822019cad8296cc19e69f9db0b
2025-05-30 02:23:12 -07:00
Moti Zilberman 55ff50fba5 dev-middleware: Scaffold standalone Fusebox shell experiment (#51687)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51687

Changelog: [Internal]

# Context

This is the first of several commits that aim to implement a **standalone shell for React Native DevTools**. This will be a lightweight desktop app designed to host the debugger frontend, in much the same way as we currently use Chrome or Edge. The launch flow will otherwise remain **very similar** to the one that exists today.

## What's changing for users?

1. With this commit, nothing; we're merely setting up an experiment flag (for stage 1 - Meta-internal testing) and will make separate plans for open source rollout, coordinated with our framework maintainer partners.
2. If the experiment is successful, we aim to *eventually* phase out the use of Chrome/Edge in React Native DevTools and ship the standalone shell as standard to all React Native developers. This is to enable further improvements that will rely on the standalone shell to work.
3. The first iteration of the standalone shell aims to solve some concrete pain points such as the "dead window problem" - the fact that opening DevTools multiple times for the same target will leave behind a now-dead window (that would ideally have been reused).

## This diff

We amend the `unstable_experiments` and `unstable_browserLauncher` APIs in `dev-middleware` to add basic support for launching a standalone shell based on a frontend URL and a *window key* - the latter being an opaque string that the shell process can match against previous launches in order to reuse and foreground existing windows.

We leave it up to `BrowserLauncher` implementers ( = frameworks) to provide a working implementation of `unstable_showFuseboxShell`, and do not provide one with `DefaultBrowserLauncher`. This will effectively allow us to dependency-inject the actual shell implementation at stage 1 so we don't increase the download size of React Native unnecessarily.

Reviewed By: rickhanlonii, robhogan

Differential Revision: D74904547

fbshipit-source-id: fbc6eac97923062bda8892bc130b39051845ea82
2025-05-30 02:23:12 -07:00
Rubén Norte 25f8b86dbe Replace existing usages of shadowNodeFromValue with new bridging function (#51676)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51676

Changelog: [internal]

This replaces all existing usages of `shadowNodeFromValue` (previously defined in `primitives.h`) to use the new bridging method to automatically convert `ShadowNode::Shared` from and to JS.

It also deletes the old method.

Reviewed By: javache

Differential Revision: D75597543

fbshipit-source-id: ab4e307dad80c7507b7ebd1cfa6621d020473d89
2025-05-29 11:20:15 -07:00
Rubén Norte 9c2148920c Define JSI bridging function for ShadowNode::Shared (#51675)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51675

Changelog: [internal]

This defines a new bridging method to convert ShadowNode::Shared from and to JS. This has some benefits over the existing `shadowNodeFromValue` and `valueFromShadowNode` functions:
1. It's more convenient, as we can just use `ShadowNode::Shared` in classes implementing the codegen, and the runtime will do the conversion automatically.
2. It's safer, as it checks for nullability and throws JS exceptions except of having segmentation faults down the line.

Reviewed By: javache

Differential Revision: D75597542

fbshipit-source-id: 37c0c43cbde0f4de9a740d9da910f215ae50efbd
2025-05-29 11:20:15 -07:00
Nicola Corti 3a41cdf5b2 Fully remove LOG_TAG from Buck/CMake (#51660)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51660

We should be able to clean this up as we're not using it directly.
It would be used via the NDK logging utilities from Android, that we don't use.

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D75531640

fbshipit-source-id: e96932b6e77b159683728194ac2e856cb868e06f
2025-05-29 10:42:31 -07:00