Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53057
Changelog: [internal]
This adds a Fantom test to ensure that `setUpDefaultReactNativeEnvironment` doesn't read any feature flags. This prevents catching this as a runtime issue when the feature flag system complains that feature flags were accessed before being overridden, which always would happen if this module read any flags (as it runs before any product code that sets overrides).
Reviewed By: rshest
Differential Revision: D79639890
fbshipit-source-id: 6997609b7bf84947a6da53b58e68f9edd5654912
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53056
Changelog: [internal]
This exposes a utility method in `ReactNativeFeatureFlagsBase` to reset its internal state for testing purposes.
This is intentionally not exposed through `ReactNativeFeatureFlags` to avoid it being used at runtime.
Reviewed By: rshest
Differential Revision: D79639889
fbshipit-source-id: adfb6125d991994c9706d5952d309915fec8f815
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53026
This change prevents users from opting out of the New Architecure.
The change is non breaking with respect to building an app: all the functions are still there, even if they are unreachable, in case users will still call them explicitly.
We hardcoded all the values to enable the New Architecture, so there is no way to disable it.
This is a behavioral breaking change, though.
## Changelog:
[iOS][Removed] - Removed the opt-out from the New Architecture.
Reviewed By: cortinico
Differential Revision: D79090048
fbshipit-source-id: 9779bfedf50748d7adbef5f7ef038f469e30efc2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53063
Update `IO.read` CDP method handler to validate the received `size` parameter.
This now accepts a max value of 10MB — adding a layer of safety in front of our current Android implementation, which fails at around ~15MB due to OkHttp limits.
Changelog: [Internal]
Reviewed By: vzaidman
Differential Revision: D79646155
fbshipit-source-id: c777802105dc31cdcc7e9e960c880e689540fddd
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53003
The new `onChildStartedNativeGesture` method accepts a nullable `ReactContext` value for the purpose of flushing active touch events. This change updates all callsites of that method to pass a `ReactContext`
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D79258727
fbshipit-source-id: 7b2950f514295dbe26822442c98079b8121cb3bf
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52925
# Changelog:
[Internal] -
This adds an extra "ranking" report when running Fantom benchmark vs different React Feature flag configurations.
It can be very useful when implementing some particular optimization, to streamline the before/after comparison wit this optimization enabled/disabled.
Reviewed By: andrewdacenko
Differential Revision: D79269601
fbshipit-source-id: f29e761e313d6857e5b3ac65faf2a387a84be9df
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53053
Changelog: [internal]
This adds a Fantom test to ensure that setting up the RN environment doesn't trigger the initialization for React components like View and Text, which should be lazy loaded when necessary.
Reviewed By: rshest
Differential Revision: D79636160
fbshipit-source-id: ef1fbd6cd531eb7082dce000ba74a5eed451e259
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53054
Changelog: [internal]
We eagerly require `AppRegistry` from environment initialization (`InitializeCore`) because it has some side-effects that are necessary for error reporting (see https://github.com/facebook/react-native/issues/34649 and https://github.com/facebook/react-native/pull/34650), but this change makes a lot of modules to be eagerly initialized.
This reduces that to avoid loading modules that not necessary for environment setup, which allows us to do things like setting up feature flags before modules like `View` and `Text` have been initialized.
Reviewed By: rshest
Differential Revision: D79636159
fbshipit-source-id: a3f1e0db3dd69112ceef3ea339167694e2457454
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/53034
Changelog: [internal]
This is just a refactor to make sure that the constants we pass from the Fantom runner to its runtime are correct by using Flow to typecheck it.
Reviewed By: andrewdacenko
Differential Revision: D79565574
fbshipit-source-id: cbbab9cdec5ef5b3c82b929b8939c76c0ef41823
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:
This Diff simply adds some docs on how the secret must be formatted, and removes a print that would expose the triager IDs is anyone would look at the logs (not a big deal given that the ids are public on Discord, though).
## Changelog:
[Internal] -
Reviewed By: cortinico
Differential Revision: D79556988
fbshipit-source-id: 23d6e72141dff4e91242cc1d9f5b95ebaf5ca858
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/52829
Changelog: [internal]
Just a small refactor to move the definitions of output paths to a specific module. We'll add more to this in a latter diff.
Reviewed By: sammy-SC
Differential Revision: D78905645
fbshipit-source-id: 011e6cec13396301dad8e76400b6f2b9e13568f0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52786
Changelog: [internal]
It takes around 300ms to generate each source map file, and we really only need them if tests throw errors. Requesting source maps also increases contention to access the Metro server from each test worker.
This refactors the code so we only generate them in that case, which could save up to 20s in test execution time.
Reviewed By: rshest
Differential Revision: D78807672
fbshipit-source-id: af9f0f0377ddcf05014b5aca0b28db938dfb4ce2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52777
Changelog: [internal]
This significantly speeds up test execution in Fantom (around 2x in OSS and 6x at Meta) by starting a Metro server before all tests runs and reusing it across all tests to build test bundles, instead of spinning up a new Metro instance every time we run each test.
The architecture change (also considering the previous change in buck prebuilds) looks like this:
{F1980689532}
This is how is impacts execution times (compared to the baseline):
* OSS
* Before: 62s {F1980564286}
* After: 30s (**2x faster**) {F1980564265}
Reviewed By: andrewdacenko
Differential Revision: D78741903
fbshipit-source-id: b209f88925e49cc2a2067e8df9b7fa9a29b4c8d2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52758
Changelog: [internal]
This is a change to how Fantom tests run in Meta infra via Buck.
After this, the biggest opportunity will be optimizing how we generate bundles with Metro.
Reviewed By: christophpurrer
Differential Revision: D78672863
fbshipit-source-id: 1152907f3ba60e7d2e48bcc588f3c07aef7bb393
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/53010
Changelog: [internal]
Exposing this value so we can disable some tests in some scenarios in a following this.
Reviewed By: cipolleschi
Differential Revision: D79510481
fbshipit-source-id: 632d9a008943ed40c24878b5561065b6ede1d689