Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52827
Changelog: [internal]
This adds **support for creating Hermes/JS sampling profiler traces in Fantom**, which is especially useful when running benchmarks.
Usage:
```
FANTOM_PROFILE_JS=1 yarn fantom Animated-benchmark
```
Output:
{F1980642216}
After this, the trace is fully symbolicated.
Can be opened directly in Google Chrome:
{F1980642229}
Or in the built-in viewer in VSCode:
{F1980642242} {F1980642240} {F1980642241}
When collapsing frames in the Flame Chart viewer in VSCode, we can quickly identify opportunities for optimizations.
This also supports multi-config environments. In that case, trace file names are created using a short representation of the configuration.
User guide for benchmarks in Fantom, including how to use this, will be done in a future diff.
NOTE: This still doesn't work in OSS because we don't support optimized mode there. In dev mode, there's a segmentation fault coming from this line: `hermesRuntime->sampledTraceToStreamInDevToolsFormat(fileStream)`
Reviewed By: sammy-SC
Differential Revision: D78905646
fbshipit-source-id: 382ddd5034db601309bd118cedde2fe0d57fde98
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52985
This class is essentially a wrapper of LayoutShadowNode with no extra logic added.
Let's remove it.
Changelog:
[Internal] [Changed] -
Reviewed By: alanleedev
Differential Revision: D79450688
fbshipit-source-id: 943e10e602cb9a5b77fca81e11d2333828b27813
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53025
It's now time to say goodbye to the Legacy Architecture :')
This change hardcodes the `newArchEnabled` property to true, and warns the users
if they're attempting to set it to false.
Changelog:
[Android] [Breaking] - Remove possibility to newArchEnabled=false in 0.82
Reviewed By: cipolleschi
Differential Revision: D78560296
fbshipit-source-id: ccfc45d2f7f21cc20e063cb901d76be3d41458d6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53030
Changelog: [internal]
Removes `PerformanceEntryReporter::getCurrentTimeStamp` in favor of `HighResTimeStamp::now`, to make the source of truth more explicit.
Reviewed By: hoxyq
Differential Revision: D79560370
fbshipit-source-id: 0ccf2bf511781d3c47c6ddb4dd7f2061aab152b5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53028
Changelog: [internal]
Now that we have mocking at a more fundamental level (`HighResTimeStamp` API) we can replace other timing mocks with that one.
This does it for `PerformanceEntryReporter` and the `NativePerformance` module.
Reviewed By: hoxyq
Differential Revision: D79557640
fbshipit-source-id: 86579b8bb586190ab7cc8721f30e60b3ef789798
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53018
Changelog: [internal]
This makes the test for LongTasks API use the new API for mocking timers in Fantom to make it deterministic, and re-enables it on Github.
Reviewed By: rshest
Differential Revision: D79554724
fbshipit-source-id: 984c66ecd7c20eb972ba1e6b19944532acb82246
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53019
Changelog: [internal]
This adds support for mocking `HighResTimeStamp` values in Fantom tests via a new `Fantom.installHighResTimeStampMock` function.
See new tests for more details on how it works.
Reviewed By: rshest
Differential Revision: D79554723
fbshipit-source-id: 8b0fb292948be118c7616fde1a8a84014af82de8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53020
Changelog: [internal]
This adds a new feature to `HighResTimeStamp` to set a custom timestamp provider for "now" that can be useful for testing, only in debug builds to avoid potentially regressing performance.
Reviewed By: hoxyq, rshest
Differential Revision: D79554725
fbshipit-source-id: c325d05999b9e2d69f769b61f15c763446777a0a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53021
Changelog: [internal]
Moving the logic to set the default value for `HighResTimeStamp` to a shared function, to simplify further changes.
Reviewed By: rshest
Differential Revision: D79554726
fbshipit-source-id: cd0d4567ef63d386d28e0325203169323e97b207
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53033
This diff replaces the logic introduced in D72078450 to prevent `onPointerEnter`/`onPointerLeave` from firing when a button is pressed. The new approach trades off some complexity for reliability: instead of deferring `ACTION_HOVER_EXIT` handling to the next frame, we now suppress it immediately if any button is pressed (`buttonState != 0`). This simpler logic appears to work reliably on Quest devices, though it may behave differently on the Android emulator (something we’ll monitor).
The main reason for this change is that deferring ACTION_HOVER_EXIT introduces problems in newer Spatial React use cases, particularly when a single component hierarchy spans multiple roots. For example, when hovering between ReactSurfaceRoot and another root like VolumetricWindow, deferring ACTION_HOVER_EXIT can lead to incorrect enter/exit ordering:
* Cursor starts hovering over `ReactSurfaceRoot`
* Cursor moves to `VolumetricWindow`
* `ACTION_HOVER_EXIT` (`ReactSurfaceRoot`) — deferred
* `ACTION_HOVER_ENTER` (`VolumetricWindow`) — processed
* `ACTION_HOVER_EXIT` (`ReactSurfaceRoot`) — processed (too late)
This results in inconsistent hover state updates across roots, which this diff resolves by handling `ACTION_HOVER_EXIT` immediately when appropriate.
Changelog: [Internal]
Reviewed By: Abbondanzo
Differential Revision: D79504775
fbshipit-source-id: ea97bff48ddf4d3d09caf56ca29057c202b12409
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53027
Tweaks MIME type parsing in CDP Network messages, now matching Chrome.
This fixes response preview behaviour by the frontend for text response previews that are `base64Encoded` 🙌🏻 (we were observing these for JSON `fetch` calls on iOS).
Changelog: [Internal]
Reviewed By: vzaidman
Differential Revision: D79559495
fbshipit-source-id: 2565af7587fc6fbdd3ef6fcbb10c558341ddfbdc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53022
Following D77799617, D77927896, updates `InspectorNetworkReporter.kt` to check `isDebuggingEnabled` internally and avoid work/communication over the JNI layer — to minimise impact on the Android Network stack.
Changelog: [Internal]
Reviewed By: hoxyq
Differential Revision: D78004462
fbshipit-source-id: 2bea2ee0592d68d1cb330ac82e8b3b227b54a675
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53031
# Changelog:
[Internal] -
This partially reverts https://github.com/facebook/react-native/pull/52905, as in some configurations we don't appear to be able to use RN feature flags on the module level.
The usage is removed for now to unbreak the builds, with a follow up to resolve it in an adequate manner.
Reviewed By: hoxyq
Differential Revision: D79562056
fbshipit-source-id: 45bd896d572ff926a4c2dfa98334bf998718d86b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52989
Adds a call to `NativeAnimatedModule`'s `userDrivenScrollEnded` method whenever a scroll event completes a smooth scroll animation. This is necessary in cases where Animated events control any layout properties of children and we need to force the shadow tree to resync with the native tree. For example, if a scroll view's child transforms its scale based on the scrollX or scrollY properties and the user triggers a `scrollToOffset` or `scrollToIndex` call, we don't update the layout of that child until the next state change.
Changelog: [Android][Fixed] - Fixed an issue where shadow tree and native tree layouts mismatch at the end of a scroll event
Reviewed By: sammy-SC
Differential Revision: D79464176
fbshipit-source-id: fee5f1c522714dbcddf8836de291c05d10e6e90e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53024
This class is Legacy Arch and is not used in OSS. Let's make it internal.
Changelog:
[Internal] [Changed] -
Reviewed By: RSNara
Differential Revision: D79556615
fbshipit-source-id: d157fe8f04784038d64657c6d240b0c51e41d82d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53014
# Changelog: [Internal]
This doesn't make sense, I've probably overlooked it while applying this to other methods.
Reviewed By: rubennorte
Differential Revision: D79552990
fbshipit-source-id: a7dc428dfcc86a08a9e52655f9878795b8e58c1c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52905
Similarly to [this PR](https://github.com/facebook/react-native/pull/51225), we do it for the Text component now: we don't set any non-default value props (most prominently, the accessibility ones) before passing this to native.
This saves bandwidth and potentially improves the prop parsing time, which existing Fantom benchmarks do confirm.
This is implemented behind a feature flag, which is false by default (will use it to run an experiment before rolling out).
**NOTE:** This implementation forks the whole text component, as suggested by rubennorte, in order to isolate the changes and with the ultimate goal of removing the old version once the experiment is concluded.
## Changelog:
[Internal] - Text no longer sets any default accessibility props, which should not result in visible changes in behaviour but may affect snapshot tests.
Reviewed By: rubennorte
Differential Revision: D79177652
fbshipit-source-id: a39430464fd5edec953b4c91be7ef9620ebd75ac
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52987
This class is unnecessary. Is also public for no real reason.
Instead we should use `ReactNoCrashSoftException` directly.
I'm not marking this as breaking as users hsould not be catching this class.
Changelog:
[Internal] [Changed] -
Reviewed By: mdvacca
Differential Revision: D79451567
fbshipit-source-id: 4d6f45b3006c79969fcf141002d34a72bf88901a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53009
Changelog: [internal]
This disables the test for LongTasks API on Github CI as the execution speed there is unreliable and makes the current tests flaky.
This happens because the test is timing dependent, but the alternative would be to mock some core behaviors that I think might be even worse.
Reviewed By: cortinico
Differential Revision: D79510480
fbshipit-source-id: 277e42e36aa6dfebf4745d094541a667f58a0996
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52988
This class should be marked as `LegacyArchitecture` while it was not.
Changelog:
[Internal] [Changed] -
Reviewed By: mdvacca
Differential Revision: D79451041
fbshipit-source-id: 62c5d35821e354ea851eaccac909bf6bd9157f09
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52995
Fabric retains views by ID when `JSTouchDispatcher` receives a touch event, but does not sweep these same views if a child native gesture is started between the `ACTION_DOWN` and `ACTION_UP` actions of the touch. As a result, we never end up calling into that view's manager's `onDropViewInstance` method and can't perform reliable teardown of the view since it's stuck in this "touched" state.
This is change adds a new condition to check if `JSTouchDispatcher` should sweep active touches when a child native gesture is started, and only applies the check to `ReactSurfaceView` to start. The check is also only enabled if the `sweepActiveTouchOnChildNativeGesturesAndroid` flag is set.
Changelog: [Internal]
Reviewed By: jehartzog
Differential Revision: D79230277
fbshipit-source-id: c15b888ec932319f1bda05b8ef5eec39e5d08710
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52972
Fabric retains views by ID when `JSTouchDispatcher` receives a touch event, but does not sweep these same views if a child native gesture is started between the `ACTION_DOWN` and `ACTION_UP` actions of the touch. As a result, we never end up calling into that view's manager's `onDropViewInstance` method and can't perform reliable teardown of the view since it's stuck in this "touched" state.
This is the first of a few changes to add a new feature flag `sweepActiveTouchOnChildNativeGesturesAndroid` to allow the `JSTouchDispatcher` to sweep active touches when a child native gesture is started. Running experiments internally to confirm that there are no unintended side effects from flushing the active touch.
Changelog: [Internal]
Reviewed By: jehartzog
Differential Revision: D79257465
fbshipit-source-id: 1ca79e77b21d8086c4df6753b16b1d8d922cd8d5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52992
changelog: [internal]
do not log on every frame to make logs more readable. The callbacks are only set during construction and there is no value in logging on every commit props.
Reviewed By: rshest
Differential Revision: D79436988
fbshipit-source-id: 26c6cbadd5ae0efa8575c7f85e4c0d90e2ef6215
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52982
Changelog: [internal]
Just adding a few tests for `View` refs, to show as an example of what a test for a public component should have.
Reviewed By: rshest
Differential Revision: D79447449
fbshipit-source-id: 75b9dbb45824d927bcf63472da25c7c5a52c7eb6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52983
Changelog: [internal]
Just moving some tests that were defined under `<View>` that were related to styles, to under `<View> > props > style`.
Reviewed By: rshest
Differential Revision: D79447450
fbshipit-source-id: e97cc4e058ffc8170b7fa74176cc8dc27e26cfde
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52974
Changelog: [internal]
The test for LongTasks is flaky on Github and I made a change to figure out why (D79366370 / https://github.com/facebook/react-native/pull/52948). It seems that the long task happens before the artificial task we're using for testing, so we can update the test to filter those out.
Reviewed By: cortinico
Differential Revision: D79441987
fbshipit-source-id: 99296d704cfec2e61ca29d06878df171231f4e78
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52944
changelog: [internal]
this should be in ReactCommon, not in cxx platform as it is not platform specific.
Reviewed By: rubennorte, christophpurrer
Differential Revision: D79184118
fbshipit-source-id: 141f0ce7b993d229c5d832d22c54471d32681173