Commit Graph

11586 Commits

Author SHA1 Message Date
Nicola Corti 185443e299 Migrate RNTester to use {usesCleartextTraffic} Manifest Placeholder (#52620)
Summary:
This creates a `debugOptimized` build type for React Native Android, meaning that we can run C++ optimization on the debug build, while still having the debugger enabled. This is aimed at improving the developer experience for folks developing on low-end devices or emulators.

Users that intend to debug can still use the `debug` variant where the full debug symbols are shipped.

## Changelog:

[ANDROID] [ADDED] - Create a debugOptimized buildType for Android


Test Plan:
Tested locally with RNTester by doing:

```
./gradlew installDebugOptimized
```

This is the output of the 3 generated .aar. The size difference is a proof that we're correctly stripping out the C++ debug symbols:

<img width="193" height="54" alt="Screenshot 2025-07-15 at 17 49 50" src="https://github.com/user-attachments/assets/584a0e8d-2d17-40d4-ac29-da09049d6554" />
<img width="235" height="51" alt="Screenshot 2025-07-15 at 17 49 39" src="https://github.com/user-attachments/assets/eda8f9e7-3509-4334-8c16-990e55caa04d" />
<img width="184" height="52" alt="Screenshot 2025-07-15 at 17 49 32" src="https://github.com/user-attachments/assets/a5c94385-bc00-4484-b43e-088ee039827f" />

Rollback Plan:

Reviewed By: cipolleschi

Differential Revision: D78351347

Pulled By: cortinico
2025-07-18 07:43:44 -07:00
Jakub Piasecki 5cda3065ce Update font scale on Android when recreating RootView (#52595)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52595

Changelog: [ANDROID][FIXED] Update font scale when recreating `RootView`

At the moment `enableFontScaleChangesUpdatingLayout` flag only works when the activity is configured to handle font scale changes by itself (`configChanges="fontScale"` in the manifest).

When that configuration is missing, the OS handles the font scale changes by recreating the activity, but in this case the path responsible for updating internally kept font size isn't executed.

This diff updates the RootView, so that the display metrics are also updated when it's created. Alternative approach would be to do that on the Activity, but that assumes usage of `ReactActivity`.

Reviewed By: NickGerleman

Differential Revision: D78323174

fbshipit-source-id: e48583091767497b5dfd4f2d938329530de4068d
2025-07-18 06:50:29 -07:00
Rubén Norte adef486333 Assume NativePerformance will be available if the Performance module is loaded (#52671)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52671

Changelog: [internal]

When setting up the global `performance` value, we check if the native module exists to decide what version to setup: the legacy "barebones" version or the modern version that's mostly spec compliant.

As we do that check and we shouldn't be requiring the module from anywhere else, it should be safe to always assume the module will be defined if we load the `Performance` class, so we can avoid checks in all methods.

NOTE: I've kept some checks for a few methods that are still not fully propagated (new methods like `reportMark`, `reportMeasure` and `getMarkTime`).

This improves performance slightly for `performance` methods:

* Before

| (index) | Task name                                                 | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | --------------------------------------------------------- | -------------------- | ------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'mark (default)'                                          | '1803.32 ± 0.71%'    | '1763.00'           | '563849 ± 0.01%'           | '567215'                  | 554908  |
| 1       | 'mark (with custom startTime)'                            | '1762.39 ± 1.67%'    | '1692.00'           | '587832 ± 0.01%'           | '591017'                  | 567414  |
| 2       | 'measure (default)'                                       | '1879.47 ± 1.44%'    | '1813.00'           | '548962 ± 0.01%'           | '551572'                  | 532064  |
| 3       | 'measure (with start and end timestamps)'                 | '1916.65 ± 0.84%'    | '1873.00'           | '531258 ± 0.01%'           | '533903'                  | 521743  |
| 4       | 'measure (with mark names)'                               | '2049.84 ± 0.44%'    | '2013.00'           | '492799 ± 0.01%'           | '496771'                  | 487844  |
| 5       | 'clearMarks'                                              | '719.87 ± 0.04%'     | '711.00'            | '1403602 ± 0.01%'          | '1406470'                 | 1389136 |
| 6       | 'clearMeasures'                                           | '710.04 ± 0.04%'     | '701.00'            | '1421610 ± 0.01%'          | '1426534'                 | 1408373 |
| 7       | 'mark + clearMarks'                                       | '2256.56 ± 1.10%'    | '2143.00'           | '460721 ± 0.02%'           | '466636'                  | 443152  |
| 8       | 'measure + clearMeasures (with start and end timestamps)' | '2345.44 ± 1.11%'    | '2244.00'           | '442395 ± 0.02%'           | '445633'                  | 426360  |
| 9       | 'measure + clearMeasures (with mark names)'               | '2349.55 ± 0.61%'    | '2283.00'           | '434370 ± 0.02%'           | '438020'                  | 425613  |

* After

| (index) | Task name                                                 | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | --------------------------------------------------------- | -------------------- | ------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'mark (default)'                                          | '1791.47 ± 1.08%'    | '1732.00'           | '573787 ± 0.01%'           | '577367'                  | 558202  |
| 1       | 'mark (with custom startTime)'                            | '1699.41 ± 1.27%'    | '1642.00'           | '605188 ± 0.01%'           | '609013'                  | 588441  |
| 2       | 'measure (default)'                                       | '1820.92 ± 1.39%'    | '1763.00'           | '563437 ± 0.01%'           | '567215'                  | 549173  |
| 3       | 'measure (with start and end timestamps)'                 | '1923.57 ± 1.65%'    | '1852.00'           | '537112 ± 0.01%'           | '539957'                  | 519867  |
| 4       | 'measure (with mark names)'                               | '2036.09 ± 1.05%'    | '1983.00'           | '500406 ± 0.01%'           | '504286'                  | 491139  |
| 5       | 'clearMarks'                                              | '657.49 ± 0.07%'     | '641.00'            | '1543793 ± 0.01%'          | '1560062'                 | 1520939 |
| 6       | 'clearMeasures'                                           | '669.02 ± 0.09%'     | '651.00'            | '1520386 ± 0.01%'          | '1536098'                 | 1494730 |
| 7       | 'mark + clearMarks'                                       | '2213.09 ± 1.53%'    | '2103.00'           | '470008 ± 0.02%'           | '475511'                  | 451858  |
| 8       | 'measure + clearMeasures (with start and end timestamps)' | '2353.15 ± 1.27%'    | '2214.00'           | '448563 ± 0.02%'           | '451671'                  | 424962  |
| 9       | 'measure + clearMeasures (with mark names)'               | '2298.28 ± 0.62%'    | '2243.00'           | '441703 ± 0.02%'           | '445831'                  | 435108  |

Reviewed By: hoxyq

Differential Revision: D78412931

fbshipit-source-id: 07390722bb00a51847cb5625b2adb4e26f89e5d2
2025-07-18 03:44:21 -07:00
Rubén Norte c9367a8d86 Remove optionality for stable methods of the NativePerformance module (#52668)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52668

Changelog: [internal]

These methods have been available for months so no need to consider backwards compatibility with older binaries.

Reviewed By: huntie

Differential Revision: D78412932

fbshipit-source-id: 0f1d541c36c98a4cc8c847d1ee7a08a9d0f4b849
2025-07-18 03:44:21 -07:00
Alex Hunt e247be793c Lower minimum Node.js version to 20.19.4 (#52678)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52678

From partner feedback, there's still appetite to support Node 20.x for the next <1y of life. Lower min version to `20.19.4` (Jul 2025) and widen test matrix in CI.

Changelog:
[General][Breaking] - Our new minimum Node version is Node.js 20 (Overrides #51840)

Reviewed By: cortinico

Differential Revision: D78494491

fbshipit-source-id: c8d9dc6250cb11f8a12ca7e761b65f4a8dae9265
2025-07-18 03:32:13 -07:00
Nick Gerleman 3f9b19eb89 Fix build_android GHA Job (#52694)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52694

build_android job is always failing, with this assertion. Seems like find/replace in D78484060 gone wrong?

Changelog: [Internal]

Reviewed By: sbuggay

Differential Revision: D78534334

fbshipit-source-id: 291bdd01b41fa6efea00ed63a0dee8bdb14cbc3a
2025-07-17 20:42:02 -07:00
Ramanpreet Nara 862e8c7049 IntersectionObserver: Clean up legacy observe/unobserve methods
Summary:
In this diff, we migrated IntersectionObserver to tokens: D74262804.

So that we wouldn't have to store shadow nodes on the javascript side.

Storing shadow nodes lead to a memory leak in the past.

Changelog: [internal]

Reviewed By: rubennorte

Differential Revision: D78494075

fbshipit-source-id: 38923ca4b265de6ff81ea20e5649e0bd2e39afc9
2025-07-17 17:35:22 -07:00
Sam Zhou 23c8787fe2 Add annotations to fix future errors after fix for unsound array types (#52691)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52691

Unannotated array literals are unsound in Flow right now. This diff adds in annotations and makes a few things readonly, to reduce future errors.

Changelog: [Internal]

Reviewed By: marcoww6

Differential Revision: D78519638

fbshipit-source-id: d98a7668ecf97bcc87dcb3fad25ade736d885d9a
2025-07-17 17:30:43 -07:00
Tim Yung d78c242e4d RN: Enable enableVirtualViewRenderState by Default (#52686)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52686

Enables the `enableVirtualViewRenderState` feature flag by default.

Also, fixed classification for this and the `enableVirtualViewWindowFocusDetection` feature flags. (They were incorrect.)

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D78500846

fbshipit-source-id: 099adaa4ed0026c8bb7438df869564d76a999007
2025-07-17 12:59:13 -07:00
Tim Yung 5d4d1ce84b RN: Cleanup scheduleAnimatedCleanupInMicrotask Flag (#52685)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52685

Cleans up the `scheduleAnimatedCleanupInMicrotask ` feature flag and deletes code paths that are now unreachable.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D78498600

fbshipit-source-id: 307562030373742e64968ae4c92d6bfbb48ddc71
2025-07-17 12:59:13 -07:00
Tim Yung 5c7fdb252e RN: Cleanup disableInteractionManager Flag (#52684)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52684

Cleans up the `disableInteractionManager` feature flag and deletes code paths that are now unreachable.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D78498348

fbshipit-source-id: a3128c1e5ca9c5879080df54b7683a3c916cec13
2025-07-17 12:59:13 -07:00
Tim Yung 1814418f12 RN: Cleanup avoidStateUpdateInAnimatedPropsMemo Flag (#52683)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52683

Cleans up the `avoidStateUpdateInAnimatedPropsMemo` feature flag and deletes code paths that are now unreachable.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D78497862

fbshipit-source-id: 26406e713ca5b7b194159638a20dcfca877ba380
2025-07-17 12:59:13 -07:00
Tim Yung 0a3808d07c RN: Cleanup alwaysFlattenAnimatedStyles Flag (#52682)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52682

Cleans up the `alwaysFlattenAnimatedStyles` feature flag.

This was already unused starting with {D77314904}.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D78497554

fbshipit-source-id: 8bfbe6485812a675cdf3e78612347457f45ada90
2025-07-17 12:59:13 -07:00
Tim Yung 0508eddfe6 RN: Default Hermes Parser to reactRuntimeTarget: "19" (#52625)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52625

Changes `react-native/babel-preset` so that by default, `hermes-parser` is configured with `reactRuntimeTarget: "19"`. This changes the compiled output of Component Syntax to not use `forwardRef` when a `ref` prop is present.

Additionally, this adds a new preset option property, `hermesParserOptions`. This object allows users of `react-native/babel-preset` to supply overrides for any `hermes-parser` options.

Changelog:
[General][Changed] - Configures `react-native/babel-preset` to target React 19 by default, meaning Component Syntax will not compile to `forwardRef` calls when a `ref` prop is present.
[General][Added] - Added support to `react-native/babel-preset` for a `hermesParserOptions` option, that expects an object that enables overriding `hermes-parser` options.

Reviewed By: SamChou19815

Differential Revision: D78383269

fbshipit-source-id: 1e6b66b9bfbeaf8a06fdc39031cb6de7e921765f
2025-07-17 12:53:36 -07:00
Rubén Norte 25c61123fb Fix incorrect locking and attempts check in ShadowTree experiment (#52681)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52681

Changelog: [internal]

In the original change I made in D78418504 / https://github.com/facebook/react-native/pull/52645 I made 2 mistakes:
1. Used a lock that would try to re-lock on itself without it being recursive (which would cause a deadlock). I didn't see that because when testing I didn't hit the case where we'd exhaust the options.
2. The `attemps` variable wasn't incremented, so we never left the loop in case of exhaustion.

This propagates a flag to `tryCommit` to indicate we've already locked on the commitMutex_ so we don't need to lock again in that case and increases the counter, fixing the issue.

Reviewed By: cortinico

Differential Revision: D78497509

fbshipit-source-id: 546ccd0c84aed5416ce1aef47d79419b4fe06f66
2025-07-17 12:18:52 -07:00
Rubén Norte 9b30fe0c45 Back out "Add missing attempts++ in ShadowNode with MAX_COMMIT_ATTEMPTS_BEFORE_LOCKING" (#52680)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52680

Changelog: [internal]

Reverting to make the fix easier to pick. Will land again on top.

Original commit changeset: 91d7f5d88a90

Original Phabricator Diff: D78487202

Reviewed By: cortinico

Differential Revision: D78497511

fbshipit-source-id: 58379787786cadcbcbe354feb97bc400a24f9d58
2025-07-17 12:18:52 -07:00
Rubén Norte fef6e0f584 Back out "Fix incorrect locking in ShadowTree experiment" (#52679)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52679

Changelog: [internal]

Reverting to make the fix easier to pick. Will land again on top.

Original commit changeset: c18e967488de

Original Phabricator Diff: D78480136

Reviewed By: cortinico

Differential Revision: D78497510

fbshipit-source-id: 8037276cb70d27ff695c76cd9575b525568c4489
2025-07-17 12:18:52 -07:00
Luna Wei 4c9591c0ea Use experimental VirtualView (#52592)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52592

Changelog: [Internal] - Expose VirtualViewExperimental in JS, use in a test surface

Reviewed By: yungsters

Differential Revision: D78027899

fbshipit-source-id: d3d9808b8ba8e36c5fdb0c831c0855ed318d0a30
2025-07-17 12:15:57 -07:00
Luna Wei 937eac64e8 Move off of ReactScrollViewHelper.ScrollListener (#52591)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52591

Changelog: [Internal] Stop using ReactScrollViewHelper.ScrollListener for layout, scroll events from ScrollView

Reviewed By: yungsters

Differential Revision: D78287689

fbshipit-source-id: 3fe944d90e0165d10953a603e5694ac7bbaeb9b8
2025-07-17 12:15:57 -07:00
Luna Wei 510bfd4101 Fix VirtualViewExperimental (#52590)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52590

Changelog: [Internal] - Fix a couple of bugs with VirtualViewExperimental

1. `also` side-effect bug where we were accessing `scrollView` before it was assigned
2. Handling empty `rect`. Now, we don't add the virtualView until it has a non-empty rect layout

Reviewed By: yungsters

Differential Revision: D78287690

fbshipit-source-id: 1806b748a0117e51c7a201191396d79db3a8d205
2025-07-17 12:15:57 -07:00
Nicola Corti 847721dc9b Add missing attempts++ in ShadowNode with MAX_COMMIT_ATTEMPTS_BEFORE_LOCKING (#52673)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52673

We should be incrementing the `attempts` variable as otherwise this loop with never stop.

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

Changelog:
[Internal] -

Reviewed By: rubennorte

Differential Revision: D78487202

fbshipit-source-id: 91d7f5d88a90bdfa806195fd35897f2f51c1deb9
2025-07-17 09:02:19 -07:00
Rubén Norte 2a01eadcb8 Remove unnecessary $FlowFixMe after correct typing for console.timeStamp (#52633)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52633

Changelog: [internal]

Now that we have the correct type definition for `console.timeStamp` we can remove the unnecessary `$FlowFixMe` annotations we had to add to use the new arguments.

Reviewed By: hoxyq

Differential Revision: D78405312

fbshipit-source-id: 29378ee6fa5986e22d0dfdfb85b7e25375361dc9
2025-07-17 08:35:36 -07:00
Rubén Norte c247554342 Add correct typing for console (including console.timeStamp) (#52632)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52632

Changelog: [internal]

This improves the type definitions for methods in the global `console` object, most importantly:
- Removes use of `any`.
- Defines correct typing for `console.timeStamp`, including new parameters for the Chrome Extensibility API.

Reviewed By: hoxyq

Differential Revision: D78405314

fbshipit-source-id: 6f31cc3005ff708ef6aa155bcd150d53a845e66c
2025-07-17 08:35:36 -07:00
Rubén Norte 10ddec7aeb Add stubs for missing console methods (#52643)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52643

Changelog: [internal]

Defines stubs for the following `console` methods:
* `time`
* `timeEnd`
* `count`
* `countReset`

Reviewed By: huntie

Differential Revision: D78418212

fbshipit-source-id: 8063f240f1e3fcfb3e36a2b43e61ca0e8cdf94db
2025-07-17 08:35:36 -07:00
Rubén Norte b9e1e37c87 Define typing for performance extensibility API (#52631)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52631

Changelog: [internal]

Just a small improvement in the type definitions to serve as documentation for the expected arguments for custom tracks in RNDT.

Reviewed By: hoxyq

Differential Revision: D78405313

fbshipit-source-id: 75d250ea27f2e55e172aaf6e72399b85cecd43f4
2025-07-17 08:35:36 -07:00
Krystof Woldrich c4082c9ce2 surface uncaught promise rejections with ExceptionsManager.handleException instead of swallowing them (#51594)
Summary:
This PR fixes logging of rejections, which stopped working with the transition from using `LogBox` for warnings to directing users to use React Native Debugger, where warnings can be viewed in the `Console` tab.

Rejected promises before this PR used `LogBox.addLog` with the `level: warn` directly without `console.warn`, which notified users to open debugger to view a warning (after rejected promise) without actually printing any warnings to the console.

This PR uses `ExceptionsManager.handleException(error, false /* isFatal */);` for promise rejections that correctly raising an error to the console if needed.

### Rejected Promise in Chrome
Displaying the error as long as it's uncaught in the form:
`Uncaught (in promise) Error`
and if there's a message in that error:
`Uncaught (in promise) Error: ${message}`
once the error is handled, this error disappears:
{F1978806409}
This is done with `Runtime.exceptionThrown`, and  `Runtime.exceptionRevoked`:
{F1979815326}

## Changelog:
[General][Breaking] unhandled promises are now handled by ExceptionsManager.handleException, instead of being swallowed as Logbox Warnings.
----
This is a breaking change because we changed the wording for these errors and because some systems (like Sentry) might start monitoring a new set of errors when this code is adopted.

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

Test Plan:
Use `Promise.reject` and observe that the rejection is now shown symbolicated in LogBox and also printed in React Native Debugger Console.

```
<Button
  title="Uncaught Promise Rejection"
  onPress={() => {
    const err = new Error('test error');
    err.cause = new Error('cause');
    const promise = Promise.resolve().then(() => {
      throw err;
      // also test with throwing a string / object:
      // throw 'aa';
      // throw {test: 'object'};
      // return Promise.reject();
    });

    setTimeout(() => {
      promise.catch(e => {
        console.log('promise error caught', e);
      });
    }, 4000);
  }}
/>
```

### Before
There's no indication whatsoever there's an uncaught promise.

### After
An error is logged:
Error-
{F1979749366}
Text-
{F1979749350}
Object-
{F1979749351}
Promise.reject() or undefined-
 {F1979749826}

Reviewed By: hoxyq

Differential Revision: D75442651

Pulled By: vzaidman

fbshipit-source-id: bf6c56e643f03997f5a604b85c543aad62648a29
2025-07-17 07:55:50 -07:00
Christian Falch 4ee2b60a1e resolve xcframework paths from conf switch script (#52664)
Summary:
When switching between debug/release we run a small script to make sure to copy the correct version of the RNDeps xcframework.

This script was missing a resolve function that fixed up some path issues that we do when installing in the podspec.

## Changelog:

[IOS] [FIXED] - Fixed issue with RNDeps release/debug switch failing

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

Test Plan:
- Create new RN App
- Install pod with prebuilt deps
- Build (success)
- Switch to release
- Build (success)

Reviewed By: cortinico

Differential Revision: D78481590

Pulled By: cipolleschi

fbshipit-source-id: 2d02b0bc55e8aef6f3fafb4f7aa193c4cf00414e
2025-07-17 06:46:00 -07:00
Rubén Norte 2d4c43c267 Fix incorrect locking in ShadowTree experiment (#52662)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52662

Changelog: [internal]

In the original change I made in D78418504 / https://github.com/facebook/react-native/pull/52645 I made a mistake and used a lock that would try to re-lock on itself without it being recursive (which would cause a deadlock). I didn't see that because when testing I didn't hit the case where we'd exhaust the options.

This propagates a flag to `tryCommit` to indicate we've already locked on the `commitMutex_` so we don't need to lock again in that case, fixing the issue.

Reviewed By: sammy-SC

Differential Revision: D78480136

fbshipit-source-id: c18e967488de14e73e6abf6f6e82c16bc42a12c6
2025-07-17 05:37:07 -07:00
Christian Falch 2e55241a90 added missing script in package.json (#52663)
Summary:
When switching between release/debug we're running a script to copy the correct xcframework. This script for the React-Core prebuilts was not part of the package.json file.

This caused the build to fail after trying to switch from debug -> release.

## Changelog:
[IOS] [FIXED] - Fixed missing script for resolving prebuilt xcframework when switching between release/debug

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

Test Plan:
- Create new RN App
- Install pod with prebuilt deps and core
- Build (success)
- Switch to release
- Build (success)

Reviewed By: cortinico

Differential Revision: D78481302

Pulled By: cipolleschi

fbshipit-source-id: 1c7181e63219098ae140d77ff1cb2c0c9b9642e5
2025-07-17 05:26:07 -07:00
Riccardo Cipolleschi 2c752af535 Fix Windows CI (#52666)
Summary:
As per [this issue](https://github.com/actions/runner-images/issues/12416), Windows machine doesn't have access to D: drive anymore

## Changelog:
[Internal] -

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

Test Plan: GHA

Reviewed By: huntie

Differential Revision: D78484060

Pulled By: cipolleschi

fbshipit-source-id: 36d844f9d7d69f1d74a154b019307cc1e269ad66
2025-07-17 05:15:04 -07:00
Pieter De Baets b6f4142bb2 Reduce legacy arch warning for OnLayoutEvent (#52665)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52665

This API is being used by react-native-svg (https://github.com/software-mansion/react-native-svg/blob/main/android/src/main/java/com/horcrux/svg/VirtualView.java#L606) which is causing issues when enabling legacy arch minification.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D78478751

fbshipit-source-id: 7f48368c11ec855bbeb5e904628b082a5bc741ff
2025-07-17 04:39:41 -07:00
Nicola Corti 2f553ec7f6 Unbreak build_android due to missing dependency on rrc_view (#52661)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52661

The CI is currently red on main due to a missing dependency on `rrc_view`
from the recent TransformHelper.cpp addition.
This fixes it.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D78479785

fbshipit-source-id: 3d2b698d9ce46cf22c15ad43005f621526590145
2025-07-17 04:09:25 -07:00
Nicola Corti 7ef57163cb Make accessors inside HeadlessJsTaskService open again (#52660)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52660

The documentation for those methods mention that users should override them to
provide their own implementation.

However those vals are not `open` so users cannot really override them.
This fixes it.

See more context on https://github.com/facebook/react-native/pull/48800#issuecomment-3082665024

So this was practically a breaking change, that I'm attempting to mitigate.

Changelog:
[Android] [Fixed] - Make accessors inside HeadlessJsTaskService open again

Reviewed By: cipolleschi

Differential Revision: D78479162

fbshipit-source-id: eefc7332e2004198cd6bd64b60a66215f137ad4a
2025-07-17 04:05:47 -07:00
Moti Zilberman bbda71f2c8 Fix argv handling for packaged mode (#52641)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52641

Changelog: [Internal]

TSIA, missed this in D77591742

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D78413090

fbshipit-source-id: a02d604def172b531a89021496208171373ddd8c
2025-07-17 03:13:26 -07:00
Moti Zilberman 60efc757d9 Implement --version flag
Summary:
Changelog: [Internal]

Adds a basic `--version` command line flag to the RNDT shell. This will be used in code paths (including tests) that need to verify that the shell is executable, but do not need to actually display a window or hand over control to the main shell instance.

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D78351936

fbshipit-source-id: e8982cfea6435da0ac9ea5f50d57c7642a8e2edb
2025-07-17 03:13:26 -07:00
David Vacca 20baf2a992 Delete ReactNativeNewArchitectureFeatureFlags.isNewArchitectureStrictModeEnabled() (#52650)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52650

ReactNativeNewArchitectureFeatureFlags.isNewArchitectureStrictModeEnabled() is unused, let's delete it

changelog: [internal] internal

Reviewed By: arushikesarwani94

Differential Revision: D78438409

fbshipit-source-id: 8208ae0d3f59e6a3197643e4a7610db3116eb1c6
2025-07-16 18:06:29 -07:00
Rubén Norte 21cd09d4c0 Implement mechanism to prevent ShadowTree commit exhaustion (#52645)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52645

Changelog: [internal]

This add a new feature flag to test a fix for https://github.com/facebook/react-native/issues/51870

Reviewed By: cortinico, sammy-SC

Differential Revision: D78418504

fbshipit-source-id: 2792026b6936393d196fd1e3162f8b2c61a38ed6
2025-07-16 12:02:07 -07:00
Joe Vilches d00de31aef Use setter for accessibilityElements (#52644)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52644

There have been some hard to find crashes with iOS outlined in https://fb.workplace.com/groups/3615245781855602/permalink/23898365966450285/. Talking with lenaic this may be due to us not using the setter to set this property. Let's try that

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D78413954

fbshipit-source-id: a68b90a2276805283082ceaf1020e13bd8ef8eb6
2025-07-16 10:56:28 -07:00
generatedunixname89002005287564 de67d6ec67 Fix CQS signal modernize-use-using in xplat/js/react-native-github/packages (#52629)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52629

Reviewed By: javache

Differential Revision: D78404030

fbshipit-source-id: 553a9f26327c4b3439b773981c25b5e1d469d8f1
2025-07-16 10:23:13 -07:00
Nicola Corti 88bafeddab Add TransformHelper.cpp to reactnativejni_common (#52640)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52640

Not having `TransformHelper.cpp` included in CMake is causing the C++ code to fail compiling.
This diff fixes it.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi, javache

Differential Revision: D78414015

fbshipit-source-id: 4900427a86eb38bfec10e5e385296d89c73e9051
2025-07-16 09:52:04 -07:00
Mathieu Acthernoene 86994a6e22 Fix Dimensions window values on Android < 15 (#52481)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52481

This PR (initially created for edge-to-edge opt-in support, rebased multiple times) fixes the `Dimensions` API `window` values on Android < 15, when edge-to-edge is enabled.

Currently the window height doesn't include the status and navigation bar heights (but it does on Android >= 15):

<img width="300" alt="Screenshot 2025-06-27 at 16 23 02" src="https://github.com/user-attachments/assets/c7d11334-9298-4f7f-a75c-590df8cc2d8a" />

Using `WindowMetricsCalculator` from AndroidX:

<img width="300" alt="Screenshot 2025-06-27 at 16 34 01" src="https://github.com/user-attachments/assets/7a4e3dc7-a83b-421b-8f6d-fd1344f5fe81" />

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

## Changelog:

[Android] [Fixed] Fix `Dimensions` `window` values on Android < 15 when edge-to-edge is enabled

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

Test Plan:
Run the example app on an Android < 15 device.

Rollback Plan:

Reviewed By: cortinico

Differential Revision: D77906644

Pulled By: alanleedev

fbshipit-source-id: 121cd6bc4133973f06b28eb9e79c9387ac7070a1
2025-07-16 09:15:43 -07:00
Fabrizio Cucci b795d61592 Add skipActivityIdentityAssertionOnHostPause feature flag (#52639)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52639

Add feature flag in the attempt to address the pile of tasks reporting the following error in panelapps:

> Error: android_crash:java.lang.AssertionError:com.facebook.react.runtime.ReactHostImpl.onHostPause

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D78339196

fbshipit-source-id: 9ef748e7ea85f179d8f8c418a978bd5c99f70601
2025-07-16 08:42:41 -07:00
Samuel Susla 0fd060f558 disable view culling when accessibility API is detected (#52612)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52612

changelog: [internal]

View Culling is purely performance optimisation but it must work correctly with accessibility features like VoiceOver and Switch Control.
In this diff, View Culling is lazily disabled whenever use of an accessibility feature is detected to make sure all views are present in the view hierarchy.

Reviewed By: NickGerleman, philIip

Differential Revision: D78336010

fbshipit-source-id: 7a201afc8e2ffd8b586d75ed4de2c03d7966750c
2025-07-16 08:16:49 -07:00
Samuel Susla 9967908e89 introduce UpdateMode::unstable_Immediate (#52604)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52604

changelog: [internal]

For Fabric View Culling to work correctly, content offset changes must be applied synchronously to avoid UI flicker.

The flicker happens because content offset update happens asynchronously and the OS paints scroll position update before React Native has a chance to adjust view hierarchy for the new scroll position.

Reviewed By: lenaic

Differential Revision: D78334322

fbshipit-source-id: dc1f1b3f9db9f9547e5a588dc184fcf21cca2727
2025-07-16 08:16:49 -07:00
Pieter De Baets a9ece0c302 Use native helpers to accelerate transform processing (#52603)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52603

Processing transforms is expensive in Java, as it requires bridging the entire ReadableNativeArray/Map. Instead, we can use the existing parser logic `resolveTransform` logic to perform this operation in C++.

Ideally, we actually re-use the existing parsed transform from Props, that could be something we revisit after Props 2.0.

As a follow-up, we should consider also moving the matrix decomposition logic from MatrixMathHelper here, and make that the only information we send back to Java.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D78298588

fbshipit-source-id: a698ac8587ccfb2be04665747082398ccdde9294
2025-07-16 06:29:10 -07:00
Pieter De Baets 5d3d23b32e Use native implementation of equals in ReadableNativeArray (#52611)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52611

We compare the current transform (represented as a ReadableArray) with the incoming one to know whether to invalidate. This can be expensive as it requires to materialize the entire transform data structure over JNI. Instead, we can delegate this comparison to native code, which can compare the underlying folly::dynamic directly.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D78340288

fbshipit-source-id: f44a054e234694c316fb080fe2dbc2017780123a
2025-07-16 06:29:10 -07:00
Rubén Norte bd198324d8 Add support for details field and custom tracks in performance.mark and performance.measure for DevTools (#52613)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52613

Changelog: [internal]

This adds first-class support for the `detail` field in `performance.mark` and `performance.measure`.

Now that we have access the JS entry in native, we can access the `detail` field to propagate it to DevTools (and use it to extract track names for Perfetto).

In order to avoid the performance overhead of always having to extract the `detail` field from the entry, this is done lazily only if we're actively profiling with DevTools or Perfetto.

Reviewed By: sbuggay

Differential Revision: D78340911

fbshipit-source-id: 383dd1cb6fcc8a04be9e65038503986f196e23c9
2025-07-16 05:55:03 -07:00
Rubén Norte 2f67285545 Remove support for specifying track names for Perfetto and RNDT using the "Track:" prefix (#52614)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52614

Changelog: [internal]

We're adding first-class support for custom tracks, so we can remove the legacy mechanism to specify tracks with the "Tracks:" prefix in the event names.

Reviewed By: sbuggay

Differential Revision: D78340910

fbshipit-source-id: cbbadd519baf7bb50072cb97d8cd1ccc87a8a35c
2025-07-16 05:55:03 -07:00
Rubén Norte 4edc33e4e1 Refactor implementation of performance.mark and performance.measure (#52586)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52586

Changelog: [internal]

This fixes a "bug" (or spec-compliance issue) in the `performance.measure` method where `end` and `duration` couldn't be used together (only `start` and `duration`, and `start` and `end` could be used).

This also refactors the API to be "JS-first", preparing the native module methods to support passing instances of entries to fix other issues.

Verified performance impact: `mark` is slightly regressed (~7% slower) due to an additional JSI call to get the default start time and `measure` is significantly optimized (25/30% faster) due to simplified parameter handling in JSI calls.

* Before

| (index) | Task name                                                 | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | --------------------------------------------------------- | -------------------- | ------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'mark (default)'                                          | '1621.03 ± 1.17%'    | '1562.00'           | '636986 ± 0.01%'           | '640205'                  | 616890  |
| 1       | 'mark (with custom startTime)'                            | '1756.88 ± 1.15%'    | '1693.00'           | '586826 ± 0.01%'           | '590667'                  | 569190  |
| 2       | 'measure (default)'                                       | '2424.66 ± 1.35%'    | '2333.00'           | '426122 ± 0.02%'           | '428633'                  | 412429  |
| 3       | 'measure (with start and end timestamps)'                 | '2679.96 ± 1.23%'    | '2574.00'           | '385266 ± 0.02%'           | '388500'                  | 373140  |
| 4       | 'measure (with mark names)'                               | '2713.49 ± 0.50%'    | '2644.00'           | '375383 ± 0.02%'           | '378215'                  | 368530  |
| 5       | 'clearMarks'                                              | '691.13 ± 0.07%'     | '681.00'            | '1467016 ± 0.01%'          | '1468429'                 | 1446900 |
| 6       | 'clearMeasures'                                           | '706.00 ± 0.05%'     | '691.00'            | '1431489 ± 0.01%'          | '1447178'                 | 1416435 |
| 7       | 'mark + clearMarks'                                       | '2083.21 ± 1.14%'    | '2003.00'           | '497974 ± 0.01%'           | '499251'                  | 480028  |
| 8       | 'measure + clearMeasures (with start and end timestamps)' | '3085.14 ± 0.88%'    | '2974.00'           | '334337 ± 0.02%'           | '336247'                  | 324135  |
| 9       | 'measure + clearMeasures (with mark names)'               | '2949.45 ± 0.62%'    | '2884.00'           | '345335 ± 0.02%'           | '346741'                  | 339046  |

* After

| (index) | Task name                                                 | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | --------------------------------------------------------- | -------------------- | ------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'mark (default)'                                          | '1740.06 ± 1.01%'    | '1692.00'           | '587400 ± 0.01%'           | '591017'                  | 574695  |
| 1       | 'mark (with custom startTime)'                            | '1661.64 ± 1.16%'    | '1612.00'           | '617453 ± 0.01%'           | '620347'                  | 601815  |
| 2       | 'measure (default)'                                       | '1808.71 ± 1.28%'    | '1753.00'           | '566516 ± 0.01%'           | '570451'                  | 552882  |
| 3       | 'measure (with start and end timestamps)'                 | '1869.21 ± 1.00%'    | '1823.00'           | '546571 ± 0.01%'           | '548546'                  | 534987  |
| 4       | 'measure (with mark names)'                               | '2016.40 ± 0.74%'    | '1983.00'           | '502987 ± 0.01%'           | '504286'                  | 496075  |
| 5       | 'clearMarks'                                              | '682.18 ± 0.03%'     | '671.00'            | '1476364 ± 0.01%'          | '1490313'                 | 1465899 |
| 6       | 'clearMeasures'                                           | '686.78 ± 0.03%'     | '681.00'            | '1467264 ± 0.01%'          | '1468429'                 | 1456081 |
| 7       | 'mark + clearMarks'                                       | '2148.90 ± 1.28%'    | '2073.00'           | '480925 ± 0.01%'           | '482393'                  | 465356  |
| 8       | 'measure + clearMeasures (with start and end timestamps)' | '2277.26 ± 1.10%'    | '2204.00'           | '451016 ± 0.01%'           | '453721'                  | 439125  |
| 9       | 'measure + clearMeasures (with mark names)'               | '2277.82 ± 0.51%'    | '2243.00'           | '443853 ± 0.01%'           | '445831'                  | 439016  |

Reviewed By: hoxyq

Differential Revision: D78193072

fbshipit-source-id: 03b52927a1999f19a2baf0d02335a959525d7add
2025-07-16 02:48:43 -07:00
Rubén Norte 1b7c9ea523 Add 2 tests demonstrating broken behavior in performance.measure (#52588)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52588

Changelog: [internal]

This adds tests to show how `performance.measure` isn't spec compliant when `end` and `duration` are used. This will be fixed in the following diff.

Reviewed By: javache

Differential Revision: D78193069

fbshipit-source-id: 30ba4874c4d2b4adb20608fc8d5ed61bfd6d92d8
2025-07-16 02:48:43 -07:00