Commit Graph

12270 Commits

Author SHA1 Message Date
Zeya Peng 504cf3e933 cleanup TODOs in fantom tests around cxxNativeAnimatedRemoveJsSync (#52949)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52949

## Changelog:

[Internal] [Changed] - cleanup TODOs in fantom tests around cxxNativeAnimatedRemoveJsSync

Previous attempt to remove js sync so far is working expectedly since https://github.com/facebook/react-native/pull/52904 / D79080739

Reviewed By: sammy-SC

Differential Revision: D79373130

fbshipit-source-id: e310b9250ba5da2e55435468f46b75977e46f111
2025-07-31 15:20:54 -07:00
Rubén Norte 707a8631ca Implement maxDuration option for PerformanceTracer (#52935)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52935

Changelog: [internal]

This implements a new option for `PerformanceTracer::startTracing` to specify a maximum duration for the recording, keeping only the last record events.

This will allow us to implement an "always-on" profiling mode for RN with a low overhead. In the future, we can extend this with a `maxBufferSize` option.

See the comment in `PerformanceTracer.cpp` for implementation details.

Reviewed By: hoxyq

Differential Revision: D79340014

fbshipit-source-id: 3260724a775a574fe5e52d47358a3a5abd0d2ee7
2025-07-31 14:29:24 -07:00
Rubén Norte 30e2b35d2d Extract logic to enqueue trace event to its own method (#52938)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52938

Changelog: [internal]

Minor refactor to simplify changing the logic for how events are buffered.

Reviewed By: hoxyq

Differential Revision: D79340013

fbshipit-source-id: efd295b1583929580fbe7441ec7eb06e828ca514
2025-07-31 14:29:24 -07:00
Rubén Norte 00debea508 Log synthetic events for trace start/end when the trace finishes (#52937)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52937

Changelog: [internal]

Minor refactor to log the synthetic events for trace start when the trace finishes. This is to simplify future work to implement a sliding window for trace events.

Reviewed By: hoxyq

Differential Revision: D79271692

fbshipit-source-id: 9e923ac36fff850a3aeede7304fb2d721bb9f16c
2025-07-31 14:29:24 -07:00
Rubén Norte 9f6440d8c8 Simplify PerformanceTracer API and move processing to TracingAgent (#52934)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52934

Changelog: [internal]

Right now, the `PerformanceTracer` API has a method to stop the trace and a separate one to collect serialized events. This refactors the API to return the collected events when calling `stopTracing` instead.

The caller (in this case `TracingAgent`) is responsible for serializing and sending the events in chunks through CDP.

Reviewed By: hoxyq

Differential Revision: D79271690

fbshipit-source-id: bdb48c80be4fd07d96e381e6bb4d099cae91f8de
2025-07-31 14:29:24 -07:00
Rubén Norte f7185715df Remove unnecessary collectEvents method from PerformanceTracer (#52936)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52936

Changelog: [internal]

This method is unused and we're no longer planning to use it.

Reviewed By: hoxyq

Differential Revision: D79271691

fbshipit-source-id: 1a0be464928a199cfe4a57cb5c44255b127264c2
2025-07-31 14:29:24 -07:00
Rubén Norte 384fc5447d Make observer go through Fanton.runTask in LongTasksAPI test (#52948)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52948

Changelog: [internal]

Not sure why this test is flaky, but this tries to add some more assertions to see where the problem comes from.

Reviewed By: hoxyq

Differential Revision: D79366370

fbshipit-source-id: d66b30e502dbc80d3e972ed93a91bb7f703de9c4
2025-07-31 11:28:57 -07:00
Ruslan Shestopalyuk 9d6d8a6e65 Add Text benchmark clause for elements without props (#52942)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52942

# Changelog:
[Internal] -

Adds another test clause to the Text benchmark test, to test the case when the component doesn't have any props altogether, which can be useful to establish a baseline.

Reviewed By: rubennorte

Differential Revision: D79352849

fbshipit-source-id: fbfeb53d3ede59631548eb2fe76a4debd5927900
2025-07-31 10:50:31 -07:00
Wandji Emmanuel junior 626568f9a3 fix(android): Stabilize custom accessibility action IDs for TalkBack (#52724)
Summary:
This pull request resolves a critical accessibility bug on Android where custom `accessibilityActions` fail to execute when activated via TalkBack's swipe gestures.

**The Problem:**
- When a user focuses a component with custom `accessibilityActions` (like a `TouchableOpacity`), TalkBack correctly announces the action labels as the user swipes up or down.
- However, when the user double-taps to activate the selected action, TalkBack reports an "incompatible action," and the `onAccessibilityAction` event is never triggered.

**The Root Cause:**
The investigation revealed that the `ReactAccessibilityDelegate` was generating **new, unstable IDs** for custom actions on every UI update. This instability prevents the Android accessibility service from reliably tracking and invoking the selected action.

**The Solution:**
This change introduces a static, thread-safe cache (`ConcurrentHashMap`) within `ReactAccessibilityDelegate`. This ensures that each unique action name is mapped to a single, stable ID for the entire lifecycle of the application. This provides the consistency required by TalkBack to function correctly.

This addresses the issue described in https://github.com/facebook/react-native/issues/47268.

 ---

## Changelog:

[Android] [Fixed] - Stabilize custom accessibility action IDs to prevent "incompatible action" errors in TalkBack.
 ---

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

Test Plan:
The fix was validated extensively using the RNTester app on a physical Android device and an Android emulator.

### Steps to Reproduce (Before Fix)

1.  Enable TalkBack on an Android device.
2.  Navigate to a `TouchableOpacity` component with several custom `accessibilityActions`.
3.  Swipe up or down to cycle through the actions. TalkBack correctly announces them (e.g., "add to cart").
4.  Double-tap to execute the selected action.
5.  **Result (Bug):** TalkBack announces *"incompatible action"*, and the `onAccessibilityAction` event is not triggered.

### Validation Steps (After Fix)

1.  Follow the same steps as above on the patched version.
2.  **Result (Fixed):** After double-tapping, the `onAccessibilityAction` event is **correctly triggered** with the appropriate action name. The "incompatible action" issue is fully resolved.

*A screen recording demonstrating the successful fix can be provided if needed.*

Uploading fixed bugs view problems (1).mp4…

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

Reviewed By: jorge-cab

Differential Revision: D78737471

Pulled By: cipolleschi

fbshipit-source-id: 877b196597472ac6a4f6df81a05a43956fb34629
2025-07-31 10:28:28 -07:00
Ruslan Lesiutin 2c540ac35a Add a method for transfering an ownership of captured TraceEvents (#52940)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52940

# Changelog: [Internal]

This is required for storing these Trace Events somewhere outside of PerformanceTracer, in case these events will be dispatched later.

Reviewed By: rubennorte

Differential Revision: D78741192

fbshipit-source-id: 3cc2eacd922855231fafb93c32d326b150b3c19b
2025-07-31 07:43:31 -07:00
Ruslan Lesiutin b58c2ffd72 refactor RuntimeSamplingProfile serializer (#52916)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52916

# Changelog: [Internal]

Align with other serializers in `jsinspector-modern` to have just static public method.

Reviewed By: rubennorte

Differential Revision: D79131985

fbshipit-source-id: 3f1f08641bb96a9fbd067992b8ce294af9d27688
2025-07-31 07:43:31 -07:00
Ruslan Lesiutin a8f6c96bc2 Static generators for Profile Trace Events (#52915)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52915

# Changelog: [Internal]

This removes the use of `PerformanceTracer` instance in a serialization logic.

Reviewed By: rubennorte

Differential Revision: D78919220

fbshipit-source-id: 5c663ea77eb36eb7664623c1595308a9450f7825
2025-07-31 07:43:31 -07:00
Ruslan Lesiutin 3ed6def874 Create aliases for ProcessId, ThreadId, RuntimeProfileId (#52917)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52917

# Changelog: [Internal]

Just an aliases for referencing these ids, instead of raw uint64_t.

Reviewed By: rubennorte

Differential Revision: D78741191

fbshipit-source-id: 1ee403ff19ed95361366c76c1fb52e70ec67f16e
2025-07-31 07:43:31 -07:00
Ruslan Lesiutin f1e5c84ea7 Remove methods for capturing Processes and Threads (#52914)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52914

# Changelog: [Internal]

We can't rely on RuntimeExecutor to actually tell us what JavaScript thread number is. Although this would work correct in most of the cases, this is not the solution we should go with.

Instead, we should fetch a map <id, name> of threads from the Host. This is what we will lazily call at the start of the Trace. I will add later on top of the stack.

Reviewed By: rubennorte

Differential Revision: D78990872

fbshipit-source-id: e41ebd35273c6741ebbc3fe3b851018c9f3275dc
2025-07-31 07:43:31 -07:00
generatedunixname89002005287564 5f3eccb04f Fix CQS signal readability-redundant-control-flow in xplat/js/react-native-github/packages (#52931)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52931

Reviewed By: dtolnay

Differential Revision: D79327593

fbshipit-source-id: 39e2b3e54f156199fc12b9633ffafeeef8343caa
2025-07-31 05:29:11 -07:00
Devan Buggay 807f0b6882 Isolate NativeDevSettings load (#52821)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52821

Hardens RN to running in mismatched opt/dev modes.

While adding an opt native/dev js mode to fantom, LogBox was trying to load NativeDevSettings when it didn't exist because of mode mismatch.

This is the only location it's happening, so this just moves the NativeDevSettings load into the one function that needs it.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D78952284

fbshipit-source-id: e68667cb28fae7cb6f985305e8885f271ef5d3af
2025-07-30 14:22:22 -07:00
Alex Hunt 364e71b159 Fix CMake dependency error (#52923)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52923

Follow-up to D78904748, where CI was broken on `main` for the `run_fantom_tests` job. It turns out this Android build uniquely included the new `react_performance_cdpmetrics` dependency, and this had an incorrect dep.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D79263124

fbshipit-source-id: 3e38e0cebe53520ea50e6d11a571e01c52e34874
2025-07-30 10:30:08 -07:00
Zeya Peng 5b38bb4745 Avoid unnecessary copy of view props map in UIManager::updateShadowTree (#52908)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52908

## Changelog:

[General] [Changed] - Avoid unnecessary copy of view props map in UIManager::updateShadowTree

Reviewed By: christophpurrer

Differential Revision: D79193215

fbshipit-source-id: 6a55dc2bf3bcf95eebeeddf2d747fe11ae56bf78
2025-07-30 08:58:11 -07:00
Alex Hunt 2dd72f956b Align InteractionEntry payload to match Chrome (#52840)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52840

**Context**

Experimental V2 Performance Monitor prototype, beginning by bringing the [Interaction to Next Paint (INP)](https://web.dev/articles/inp) metric to React Native.

**This diff**

Completes populating a full `InteractionEntry` Live Event payload by implementing remaining fields sufficient to be rendered by Chrome DevTools.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D78904747

fbshipit-source-id: 7473602f6f1efe3ac71e07a2b88e6ad7020dcbbf
2025-07-30 07:13:58 -07:00
Alex Hunt a3bf989450 Implement reporting InteractionEntry live metrics to runtime (#52839)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52839

**Context**

Experimental V2 Performance Monitor prototype, beginning by bringing the [Interaction to Next Paint (INP)](https://web.dev/articles/inp) metric to React Native.

**This diff**

Adds and configures a `CdpMetricsReporter` class to report `InteractionEntry` live metrics over CDP via the `"__chromium_devtools_metrics_reporter"` runtime binding.

**Notes**

- Introduces a new `react/performance/cdpmetrics` package, and a listener API on `PerformanceEntryReporter` (both to avoid a `jni` dependency in `react/performance/timeline`).

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D78904748

fbshipit-source-id: c75971aba43d9929912b3d1dba7576c2a2342214
2025-07-30 07:13:58 -07:00
Samuel Susla f711d1776c Micro-optimise JavaScript part of Animated (#52906)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52906

changelog: [internal]

Micro-optimise JavaScript part of Animated by avoiding JS syntax for private variable/method - #foo. Instead, use double underscores. Benchmarks indicate ~10% improvement.

# Before
### Animated (mode 🚀) ###

| (index) | Task name                                                                    | Latency average (ns)  | Latency median (ns)      | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | ---------------------------------------------------------------------------- | --------------------- | ------------------------ | -------------------------- | ------------------------- | ------- |
| 0       | 'render 1 views'                                                             | '84990.06 ± 1.49%'    | '80691.00'               | '12164 ± 0.14%'            | '12393'                   | 11767   |
| 1       | 'render 10 views'                                                            | '373372.50 ± 1.00%'   | '363786.00'              | '2727 ± 0.26%'             | '2749'                    | 2679    |
| 2       | 'render 100 views'                                                           | '3099588.37 ± 0.92%'  | '3017559.00'             | '324 ± 0.74%'              | '331'                     | 323     |
| 3       | 'render 1 animated views (without animations set up)'                        | '174636.87 ± 0.67%'   | '168783.00'              | '5808 ± 0.17%'             | '5925'                    | 5727    |
| 4       | 'render 10 animated views (without animations set up)'                       | '1054481.51 ± 0.61%'  | '1036686.00'             | '953 ± 0.37%'              | '965'                     | 949     |
| 5       | 'render 100 animated views (without animations set up)'                      | '9176283.60 ± 1.12%'  | '8932316.00'             | '109 ± 0.95%'              | '112'                     | 109     |
| 6       | 'render 1 animated views (with a single animation set up - JS driven)'       | '204383.77 ± 0.52%'   | '199109.00'              | '4943 ± 0.17%'             | '5022'                    | 4893    |
| 7       | 'render 10 animated views (with a single animation set up - JS driven)'      | '1315894.97 ± 0.36%'  | '1300562.00 ± 40.00'     | '762 ± 0.30%'              | '769'                     | 760     |
| 8       | 'render 100 animated views (with a single animation set up - JS driven)'     | '11924031.45 ± 1.36%' | '11753334.50 ± 30040.50' | '84 ± 1.18%'               | '85'                      | 84      |
| 9       | 'render 1 animated views (with a single animation set up - native driven)'   | '318103.70 ± 0.37%'   | '311657.50 ± 0.50'       | '3162 ± 0.20%'             | '3209'                    | 3144    |
| 10      | 'render 10 animated views (with a single animation set up - native driven)'  | '2230305.96 ± 0.51%'  | '2191890.00'             | '449 ± 0.41%'              | '456'                     | 449     |
| 11      | 'render 100 animated views (with a single animation set up - native driven)' | '21983695.16 ± 0.75%' | '21945687.00 ± 17186.00' | '46 ± 0.74%'               | '46'                      | 64      |

# After

### Animated (mode 🚀) ###

| (index) | Task name                                                                    | Latency average (ns)  | Latency median (ns)     | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | ---------------------------------------------------------------------------- | --------------------- | ----------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'render 1 views'                                                             | '82684.75 ± 1.11%'    | '80231.00'              | '12331 ± 0.08%'            | '12464'                   | 12095   |
| 1       | 'render 10 views'                                                            | '378798.65 ± 1.16%'   | '365378.50 ± 9.50'      | '2703 ± 0.31%'             | '2737'                    | 2640    |
| 2       | 'render 100 views'                                                           | '3124253.51 ± 0.95%'  | '3039842.00'            | '322 ± 0.76%'              | '329'                     | 321     |
| 3       | 'render 1 animated views (without animations set up)'                        | '165580.70 ± 0.73%'   | '161562.00'             | '6131 ± 0.14%'             | '6190'                    | 6040    |
| 4       | 'render 10 animated views (without animations set up)'                       | '979127.10 ± 0.60%'   | '962509.50 ± 5.50'      | '1027 ± 0.36%'             | '1039'                    | 1022    |
| 5       | 'render 100 animated views (without animations set up)'                      | '8487740.98 ± 1.32%'  | '8235139.50 ± 3244.50'  | '118 ± 1.05%'              | '121'                     | 118     |
| 6       | 'render 1 animated views (with a single animation set up - JS driven)'       | '185333.93 ± 0.52%'   | '181582.00'             | '5451 ± 0.15%'             | '5507'                    | 5396    |
| 7       | 'render 10 animated views (with a single animation set up - JS driven)'      | '1145679.81 ± 0.37%'  | '1131668.00'            | '875 ± 0.29%'              | '884'                     | 873     |
| 8       | 'render 100 animated views (with a single animation set up - JS driven)'     | '10451056.69 ± 1.60%' | '10064069.50 ± 826.50'  | '96 ± 1.39%'               | '99'                      | 96      |
| 9       | 'render 1 animated views (with a single animation set up - native driven)'   | '292243.89 ± 0.40%'   | '286740.00'             | '3447 ± 0.21%'             | '3487'                    | 3422    |
| 10      | 'render 10 animated views (with a single animation set up - native driven)'  | '1993053.78 ± 0.47%'  | '1958960.00 ± 20.00'    | '503 ± 0.39%'              | '510'                     | 502     |
| 11      | 'render 100 animated views (with a single animation set up - native driven)' | '19528221.48 ± 0.95%' | '19383511.00 ± 7431.00' | '51 ± 0.92%'               | '52'                      | 64      |

Reviewed By: rubennorte

Differential Revision: D79179369

fbshipit-source-id: e641be0e8ec313b58bcae8330f127e707cd4fffc
2025-07-30 02:49:37 -07:00
David Vacca 0d3791ca0a Throw Exception if ReactApplication.reactNativeHost is not overriden (#52912)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52912

This diff throws an Exception if ReactApplication.reactNativeHost is not overriden. This field is deprecated and it will be deleted in the near future.
The goal of this diff is to be able to remove usages of reactNativeHost for classes that implement ReactApplication

changelog: [Android][Breaking] Throw Exception if ReactApplication.reactNativeHost is not overriden

Reviewed By: mlord93

Differential Revision: D79186336

fbshipit-source-id: 9f8f34739c0f04056ff3d795bda45bc0dbca7624
2025-07-29 18:22:53 -07:00
Samuel Susla 4614a0bc17 move fabric sync in C++ Animated to JS thread (#52904)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52904

changelog: [internal]

There is a race condition in `FabricUIManagerBinding::schedulerDidFinishTransaction`. Until it is addressed properly, let's do synchronisation Fabric commits through JavaScript thread.

It can have pretty serious consequences: a crash in better case and undefined behaviour in worse case.

The race is between acquiring two mutexes:
1. One inside of `MountingCoordinator::pullTransaction`
2. Second one inside of `FabricMountingManager::executeMount`

The logic inside of `FabricUIManagerBinding::schedulerDidFinishTransaction` depends on the fact that whichever thread acquires mutex number 1, will acquire mutex number 2 without interruption. But that is not always the case as threads may be interrupted.

Reviewed By: zeyap

Differential Revision: D79080739

fbshipit-source-id: c86885aba25825030dc44b60144beb3e3ba18306
2025-07-29 14:26:09 -07:00
Samuel Susla 7afb8ab305 disable subview clipping traversal when view culling is enabled (#52903)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52903

changelog: [internal]

disable subview clipping traversal when view culling is enabled.
Subview clipping is already disabled by preventing prop from being set to true: https://fburl.com/code/bynvtwfs but we found a crash where the traversal leads to memory corruption with view culling enabled.

Reviewed By: lenaic

Differential Revision: D79168116

fbshipit-source-id: 9dcb624ca12bc2d94b265681795604ee0ac3fe00
2025-07-29 09:43:44 -07:00
Samuel Susla 4b07edd6ea make instance variables const in RCTComponentViewDescriptor (#52902)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52902

changelog: [internal]

These values must not change during view's life cycle.

Reviewed By: rshest

Differential Revision: D79165823

fbshipit-source-id: dff85d369e4f79ba88740b0f3a23b71af5ec0c5e
2025-07-29 09:19:16 -07:00
Nicola Corti 04ae15d99b Remove the com.facebook.react.bridge.JSONArguments class (#52901)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52901

I'm removing this class as we should not expose it publicly.
It's not used at all inside react-native and can potentally be moved internally.

The only usage I've found in OSS is patched with this PR:
- https://github.com/fabOnReact/react-native-wear-connectivity/pull/46

Changelog:
[Android] [Removed] - Remove the `com.facebook.react.bridge.JSONArguments` class

Reviewed By: javache, mdvacca

Differential Revision: D78265165

fbshipit-source-id: 704575e7b9cfd6d40980511d6064d39991b3eb48
2025-07-29 08:54:10 -07:00
Riccardo Cipolleschi ec5a98b1f5 Sync React 19.1.1 into React Native (#52887)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52887

Syncs Reac 19.1.1 into React Native.

This commit should contains the fix for:
- React owner stack in React Native
- An issue with React holding shadow node for longer than it needed
- An issue that made `startTransition` not working with React Native.

## Changelog:
[General][Changed] - Bumped React to 19.1.1

bypass-github-export-checks

Reviewed By: cortinico

Differential Revision: D79096406

fbshipit-source-id: cbb2f846b1f08ba5ff482cfed5aaddc16df075cc
2025-07-29 08:05:38 -07:00
Rubén Norte 3bff471738 Reduce flakiness of LongTasksAPI Fantom test (#52898)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52898

Changelog: [internal]

This test is flaky on Github and I haven't been able to reproduce it locally to debug exactly why, but I think it might be because there might be cross-tests pollution.

This tries to reduce that making sure we clean up everything between tests.

Reviewed By: cortinico

Differential Revision: D79163809

fbshipit-source-id: fe59315373ab74ccedd7e031816a84f0566b4aa0
2025-07-29 03:50:32 -07:00
Nicola Corti dde4d34a02 Add more tests for MatrixMathHelper (#52885)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52885

Since we recently touched the `MatrixMathHelper` class, as we're looking into moving more matrix operations from Kotlin to C++,
I'm going to add more tests to make sure that those matrix math function are behaving correctly.

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D79094323

fbshipit-source-id: 34967b42dc92338724dd20fb7f70a68734f6db28
2025-07-29 02:35:27 -07:00
Riccardo Cipolleschi dd00c9055a Fix react-native vulnerabilities in package.json (#52876)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52876

Our tooling detected a couple of vulnerabilities in our package.json.
- undici
- on-headers

This change fixes these vulnerabilities.
For the on-headers vulnerabilitiy specifically, it comes from the following dependency chain:
- rn-tester > react-native-community/cli > compression > on-headers.

To fix it, we have to force the resolution to both on-headers and compression.

## Changelog:
[General][Fixed] - Fixed vulnerability on undici and on-headers

Reviewed By: cortinico

Differential Revision: D79086335

fbshipit-source-id: 44f14403196165f5f823030304102dbd0facd0ce
2025-07-29 00:45:24 -07:00
Danny Su fb0e4ee6d1 Enable regenerator for Hermes dev mode transform profile (#52651)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52651

Changelog: [Internal]

Last year the `hermes-canary` profile was used to enable certain apps to use Static Hermes by enabling regenerator because debugger support for generator wasn't finished yet. However, we actually could have just keyed off of `options.dev` and still kept using `hermes-stable`.

The `hermes-canary` profile is actually meant to be used to run experiments. We should free up this profile to return it to the original intended purpose.

This diff makes all hermes profiles' dev mode use regenerator. Existing SH apps using `hermes-canary` should be unaffected. And apps using Hermes will change to use regenerator in dev mode, but that should be ok.

Reviewed By: robhogan

Differential Revision: D78450695

fbshipit-source-id: eb6a87fbc1f0e08d490fd0d1baa3611248f95764
2025-07-28 21:44:45 -07:00
Joe Vilches e17e3e3f38 Decouple ReactAndroidHWInputDeviceHelper from ReactRootView (#52891)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52891

Right now these are tightly coupled for no reason. The device helper just asks the root view to send the event out, which it uses ReactContext for. We can just have that be passed in and accomplish the same task.

Changelog: [Internal]

Reviewed By: Abbondanzo, rozele

Differential Revision: D79007328

fbshipit-source-id: ef0a5ac4ec0acb52fc7c2a26010811767e3c1e67
2025-07-28 19:31:02 -07:00
Aakash Patel b4a10f01fb Use == instead of EXPECT_EQ in testlib
Summary:
The `EXPECT_EQ` was leading to potentially ambiguous use of `<<` when
gtest tries to print information.

Changelog: [Internal]

Reviewed By: tsaichien

Differential Revision: D78823354

fbshipit-source-id: d26de07f02eb8bb53a4dec34b5fb302681bfbef8
2025-07-28 19:14:54 -07:00
David Vacca 8c1d191f1a EZ cleanup of unnecessary variable (#52892)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52892

 EZ cleanup of unnecessary variable

changelog: [internal] internal

Reviewed By: mlord93

Differential Revision: D79119092

fbshipit-source-id: 10b8675763dd203a832648ef3c99520dcdaa08da
2025-07-28 18:16:05 -07:00
Christoph Purrer daeb6e99ab Bring back ContextContainer::Shared (#52889)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52889

This brings back ContextContainer::Shared (but marks it as deprecated which was removed in https://github.com/facebook/react-native/pull/52750

Changelog: [General][Fixed] Bring back ContextContainer::Shared = std::shared_ptr<const ContextContainer> alias

Reviewed By: lenaic

Differential Revision: D79112609

fbshipit-source-id: 1cb9114b98d745b846d5ddc56a01786527049e50
2025-07-28 17:21:34 -07:00
Nicola Corti 48bf59c85e Use by lazy(LazyThreadSafetyMode.NONE) for RNTester (#52886)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52886

RNTester was using just a plain `by lazy{}` which gets flagged by our internal linter over and over.
This fixes it.

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D79094496

fbshipit-source-id: 856864bf8b5e4ec1254d1793dba9e97377696408
2025-07-28 15:11:35 -07:00
Christoph Purrer 4718b35259 Bring back SharedImageManager = std::shared_ptr<ImageManager> alias to allow gradual API migration (#52888)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52888

This brings back the type erased in  https://github.com/facebook/react-native/pull/52747 to fix build breaks in consuming libraries as: `react-native-svg`

https://github.com/facebook/react-native/actions/runs/16560124464/job/46828273956?fbclid=IwY2xjawL0f1dleHRuA2FlbQIxMQBicmlkETFXVnFJUkhXMDNkSlJhY1c1AR6vMc_wUFxgfUN-JsCFMzl4L2V2JaSfX37gKIoUu8U9WGGmb0JBG1LNl0Ogjg_aem_aM4XSISUjhqE7S8_QA2KfA

Changelog: [General][Fixed] Bring back SharedImageManager = std::shared_ptr<ImageManager> alias

Reviewed By: cipolleschi

Differential Revision: D79097253

fbshipit-source-id: afec0b4dd706fac91ba296d2bf2a50fb27200597
2025-07-28 11:42:19 -07:00
Artur Kalach eb08f54594 Update RCTTextInputComponentView to recycle and properly clean the inputAccessoryView dependency. (#52825)
Summary:
Update `RCTTextInputComponentView` to recycle and properly clean its `inputAccessoryView` dependency. Currently, `RCTTextInputComponentView` does not clean up this dependency during recycling, which can result in the `inputAccessoryView` being incorrectly applied to `TextInput` components that do not use an accessory view."

Related issue: https://github.com/facebook/react-native/issues/52824
Snack of the issue: https://snack.expo.dev/arturkalach/privileged-blue-soda

https://github.com/user-attachments/assets/46a1f172-a75c-4e88-beee-059d4d2e1d0c

## Changelog:
[IOS][FIXED] Update recycling logic to clean up the `inputAccessoryView` dependency.
<!-- 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

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

Test Plan:
```
1. Render more than eight TextInput components on the screen, each with an AccessoryView.
2. Unmount the TextInput components using conditional rendering.
3. Open a Modal that contains a KeyboardAvoidingView and a TextInput.
4. Focus on the TextInput inside the Modal.
```

https://github.com/user-attachments/assets/8be1fdef-e8ab-4030-a2c5-e952c22ef743

Reviewed By: christophpurrer

Differential Revision: D78966221

Pulled By: cipolleschi

fbshipit-source-id: 35b6748cc44c41056051b2eecd626d61c4641cdf
2025-07-28 10:33:48 -07:00
Rubén Norte d2fa1cd900 Create basic benchmark for Animated (#52874)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52874

Changelog: [internal]

This creates a basic benchmark for the Animated API, which shows that **using Animated**, even without setting up animations, **makes rendering 3x slower** (similar when setting up a JS driven animation), but **6x slower when it sets up a native animation.**

Baseline:
### Animated (mode 🚀) ###

| (index) | Task name                                                                    | Latency average (ns)  | Latency median (ns)     | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | ---------------------------------------------------------------------------- | --------------------- | ----------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'render 1 views'                                                             | '85320.76 ± 1.27%'    | '82484.00'              | '11994 ± 0.09%'            | '12124'                   | 11721   |
| 1       | 'render 10 views'                                                            | '399462.22 ± 1.03%'   | '387702.00'             | '2552 ± 0.29%'             | '2579'                    | 2505    |
| 2       | 'render 100 views'                                                           | '3317795.78 ± 0.90%'  | '3232351.00 ± 70.00'    | '303 ± 0.74%'              | '309'                     | 302     |
| 3       | 'render 1 animated views (without no animations set up)'                     | '172534.31 ± 0.67%'   | '168423.00'             | '5874 ± 0.14%'             | '5937'                    | 5796    |
| 4       | 'render 10 animated views (without no animations set up)'                    | '1050582.87 ± 0.63%'  | '1031899.00 ± 20.00'    | '957 ± 0.37%'              | '969'                     | 952     |
| 5       | 'render 100 animated views (without no animations set up)'                   | '9255133.10 ± 1.06%'  | '8990333.00'            | '108 ± 0.94%'              | '111'                     | 109     |
| 6       | 'render 1 animated views (with a single animation set up - JS driven)'       | '203422.03 ± 0.50%'   | '198478.00'             | '4966 ± 0.17%'             | '5038'                    | 4916    |
| 7       | 'render 10 animated views (with a single animation set up - JS driven)'      | '1305600.39 ± 0.37%'  | '1288088.00 ± 15.00'    | '768 ± 0.30%'              | '776'                     | 766     |
| 8       | 'render 100 animated views (with a single animation set up - JS driven)'     | '12084658.14 ± 1.51%' | '11854181.00 ± 8493.00' | '83 ± 1.27%'               | '84'                      | 84      |
| 9       | 'render 1 animated views (with a single animation set up - native driven)'   | '313494.69 ± 0.32%'   | '308673.00'             | '3206 ± 0.19%'             | '3240'                    | 3190    |
| 10      | 'render 10 animated views (with a single animation set up - native driven)'  | '2223507.22 ± 0.50%'  | '2184839.00 ± 70.00'    | '451 ± 0.41%'              | '458'                     | 450     |
| 11      | 'render 100 animated views (with a single animation set up - native driven)' | '21352575.02 ± 0.71%' | '21239136.00 ± 2824.00' | '47 ± 0.69%'               | '47'                      | 64      |

Reviewed By: christophpurrer

Differential Revision: D79085920

fbshipit-source-id: 1dc13208da49cc325995f3455eaf86c4eb1e4d47
2025-07-28 10:02:25 -07:00
Zeya Peng 6e4d23ded2 Allow setting blockNativeResponder on Pressable (#52819)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52819

## Changelog:

[General] [Added] - Allow setting blockNativeResponder on Pressable

To expose the same prop on Pressability https://github.com/facebook/react-native/blob/b2d9f5f28045fd89bba2dca41274c7cd7abe2ecc/packages/react-native/Libraries/Pressability/Pressability.js#L137

Reviewed By: christophpurrer

Differential Revision: D78896178

fbshipit-source-id: 36637842ac15c54de325975d416efce1448e8ab7
2025-07-28 08:34:04 -07:00
Ruslan Lesiutin 253249611c Extract serializers for ProfileChunk (#52870)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52870

# Changelog: [Internal]

Defines a set of static serializers for parts of the "Profile" and "ProfileChunk" Trace Events.

Mainly for 2 reasons:
1. To follow the same pattern of static serializers for Tracing.
2. To save on string copying, since ProfileChunk could contain hundreds of unique frames, all of them could have unique function names. The previous approach would copy the strings and populate a new `folly::dynamic` object.

Reviewed By: huntie

Differential Revision: D78919218

fbshipit-source-id: 303a4fc259d6b1720ce982e144037ee56cd47e9b
2025-07-28 07:12:17 -07:00
Ruslan Lesiutin 7488097872 Extract TraceEvent serialization logic (#52869)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52869

# Changelog: [Internal]

We are exctracting a logic for serialization of TraceEvent into a dedicated serializer class.

Conceptually:
- PerformanceTracer would be a local TraceEvent engine that is responsible for constructing and buffering TraceEvents.
- TraceEventSerializer will have a single responsibility: transforming from local structs to serialized json objects that are ready to be dispatched over CDP Tracing domain.

This would help avoid scenarios, where we are passing around `folly:dynamic` between internal subsystems: serialization should only happen right before emtting a CDP message.

Reviewed By: huntie

Differential Revision: D78738370

fbshipit-source-id: a8e33e857192a02dc048d504abe072679ef8ce82
2025-07-28 07:12:17 -07:00
Ruslan Lesiutin 75d6cb1138 Avoid copies when dispatching TraceEvent chunks (#52868)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52868

# Changelog: [Internal]

Mainly, 2 changes:
- Callback that emits `Tracing.dataCollected` events will receive chunks as rvalues refs (`&&`), instead of `const &`.
- The RuntimeSamplingProfile will be passed to the serializer as rvalue ref.

Reviewed By: huntie

Differential Revision: D78919223

fbshipit-source-id: 7f65e0627c8839d507e6b2d088fdb0b560906b6a
2025-07-28 07:12:17 -07:00
Ruslan Lesiutin 3cf11a3113 Flatten struct (#52867)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52867

# Changelog: [Internal]

There are currently no reasons for these struct not to be plain, plus this would allow us avoiding potentially expensive copying, when returning `const &`.

Reviewed By: huntie

Differential Revision: D78919222

fbshipit-source-id: 7b39d754c05b25915f07202d7e4839b10a08a47c
2025-07-28 07:12:17 -07:00
Ruslan Lesiutin 4023800b39 Flatten Sample and Profile structs (#52866)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52866

# Changelog: [Internal]

There are currently no reasons for these struct not to be plain, plus this would allow us avoiding potentially expensive copying, when returning `const &`.

Reviewed By: huntie

Differential Revision: D78919221

fbshipit-source-id: 7d3628bb213fdecadbdafa9b2b5c42472ebd77be
2025-07-28 07:12:17 -07:00
Ruslan Lesiutin 7d17a3f61f Flatten SampleCallStackFrame and use designated serializers (#52865)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52865

# Changelog: [Internal]

These doesn't have any custom internal logic, so can be flattened for simplicity.

Reviewed By: huntie

Differential Revision: D76986727

fbshipit-source-id: cf23adf43eefda92674a46217a7269399cf81f0a
2025-07-28 07:12:17 -07:00
Ruslan Shestopalyuk 0c06ccc78f Add benchmark Fantom test for Image component (#52871)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52871

## Changelog:
[Internal] -

As in the title, this adds a basic Fantom benchmark test for the Image component.

Reviewed By: rubennorte

Differential Revision: D79085957

fbshipit-source-id: 4098415353c8a04992c39e39d9a1dd20270f20d7
2025-07-28 06:49:32 -07:00
Sam Zhou 869a976a5d Bump to prettier v3 across xplat (#52844)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52844

Changelog: [Internal]

Reviewed By: pieterv

Differential Revision: D78787920

fbshipit-source-id: fc2582001ee6775f53b452dd3659e37521ea6387
2025-07-27 18:50:47 -07:00
Nick Lefever 7fe3b2c902 Add dataDetectorType paragraph prop (#52848)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52848

This diff declares the `DataDetectorType` enum and defined the `dataDetectorType` property on the Android Paragraph props.

The conversions.h file holding the state conversion to MapBuffer was renamed to stateConversions.h so that it wouldn't clash with the Android conversions.h file.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D79025294

fbshipit-source-id: 52dc519ea51191f28745d91fe31e36eaba29a731
2025-07-27 17:20:44 -07:00
Nick Lefever 94d2e0a39b Add selectionColor paragraph prop (#52847)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52847

Adding the missing Android Text selectionColor prop to the `ParagraphProps` to correctly support the prop with Props 2.0

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D79023868

fbshipit-source-id: 10e04d438d9d118e6b80e8d8854e0bbb76b430ee
2025-07-27 17:20:44 -07:00