Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54222
Changelog: [internal]
Reduce boilerplate in some tests now that we can pass refs to some Fantom APIs.
Reviewed By: javache
Differential Revision: D85143176
fbshipit-source-id: 0e107891f1027a185821e21e5fa76f019cec5bb1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54221
Changelog: [internal]
Small change in the Fantom API to accept refs and reduce boilerplate. See next diff for examples
Reviewed By: javache
Differential Revision: D85143177
fbshipit-source-id: fd65abcc1b107df8726fee172b284f5dc96e88a6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54129
Changelog: [Internal]
The team maintaining gmock is [uninterested, as a matter of principle,](https://github.com/google/googletest/issues/2646#issuecomment-630919122) in improving the ergonomics of writing helper functions around `EXPECT_CALL`. However, such helpers have proven very useful for the `jsinspector-modern` C++ test suite. The out-of-the-box ergonomics *are* pretty bad, though, so this diff tries to improve the situation.
The biggest offender in our test suite is the `expectMessageFromPage` helper function - if a test fails because an expectation isn't met, the error message points to the `EXPECT_CALL` line inside `expectMessageFromPage`, which is utterly useless compared to the line of test code that *called* `expectMessageFromPage`.
Here, we reach into gmock's internals slightly to create a variant of the `EXPECT_CALL` macro that allows passing in a [`std::source_location`](https://en.cppreference.com/w/cpp/utility/source_location.html) (thanks, C++20!). We then teach `expectMessageFromPage` and other such helpers to capture a source location at the call site (using a parameter with a default value to `source_location::current()`) and use the modified macro to pass it into gmock.
Reviewed By: huntie
Differential Revision: D84368993
fbshipit-source-id: 62f64b6c5f626a54bc3da7143d84ee2d75d16ac6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54128
Changelog: [Internal]
Adds an integration test for `NetworkReporter`'s CDP Tracing domain output (via `PerformanceTracer` behind the scenes), i.e. the traces that power the Network track in the Performance panel in React Native DevTools.
The test covers the `Tracing` and `Network` domains being enabled simultaneously, as well as `Tracing` on its own.
Reviewed By: huntie
Differential Revision: D84337901
fbshipit-source-id: f82af33575806fc3b99636cdb1eb9803c04c8c07
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54218
Observed some crashes coming from `schedulerDidRequestPreliminaryViewAllocation` which seemed to point at the FabricMountingManager being destroyed from the Hades GC thread. That thread is not attached to the JVM, so would crash when trying to destroy this global_ref.
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D85143603
fbshipit-source-id: 2ecd42d57188e6f3d69a6124e21ee8913b3d5b89
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54214
# Changelog: [Internal]
React started using `clearMeasures` in https://github.com/facebook/react/pull/34803. It only does it if `performance.measure()` is defined. This should be enough for a feature check of User Timings API presence, but out stub doesn't follow the same spec.
Adding `clearMarks()` and `clearMeasures()` stubs to the object.
Reviewed By: rubennorte
Differential Revision: D85082720
fbshipit-source-id: 3b117a6545e131cdbb2d5efb73d500a928469864
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54213
## Changelog: [Internal]
Modifies `VirtualViewContainerStateExperimental` to use an interval tree to store the container's VirtualViews. Interval tree's query allows us to lower the frequently-used updateModes() operation from `O(n)` to `O(m + log n)`, where `m` is the number of VirtualViews in the hysteresis range. General layout changes incur a penalty due to the requirement of maintaining a balanced BST.
Performance Changes:
* updateModes(): `O(n) -> O(m + log n)` (new algo)
* updateMode(): `O(1) -> O(1)`
* add VV: `O(1) -> O(log n)`
* update VV: `O(1) -> O(log n)`
* delete VV: `O(1) -> O(log n)`
We expect scrolling to be much more frequent than a total layout change/updating many of the elements in the container at once. However, the initial load of a page will take `O(n log n)` time rather than `O(n)` time.
We also include some bookkeeping sets for "old" hysteresis, prerender, and visible VVs. This will increase the memory footprint of `VirtualViewContainerState` by `O(m)`.
More details are in https://docs.google.com/document/d/1Cmamx6fNfruoHLApX8tedqNVZsCEUyoBvQWpMvBsfcY/edit?tab=t.gqla6vu3231k.
### Note
This diff only covers the Android version. iOS may follow after experimentation.
Reviewed By: lunaleaps
Differential Revision: D83783201
fbshipit-source-id: 93a7a93784d668e09d8ddacc7e30d289ccd8b7a2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54162
Changelog [Internal]:
Splits VirtualViewContainerState implementation into three parts: (1) an abstract parent class, (2) the "classic" version (existing version), and (3) the "experimental" version (new changes to be made). The experimental version is a copy of the classic version for now.
Reviewed By: lunaleaps
Differential Revision: D84569206
fbshipit-source-id: b41cd9faf06d2de0dff17148ded72193107e5b9e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54156
Changelog: [Internal]
Introduces new React Native feature flag for VirtualViewContainerState versioning changes.
Follow up diffs will create classic and experimental versions of VirtualViewContainerState. This feature flag is meant to eventually be overridden with MetaConfig variables.
Reviewed By: lunaleaps
Differential Revision: D84569199
fbshipit-source-id: aaca31bd1946c56f7de3d7fd52a126b0165e59d4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54209
Changelog: [Internal]
This diff reverts D84624705
The marker is logged even if there is a full bundle reload.
Depends on D84624705
Reviewed By: hoxyq
Differential Revision: D85048405
fbshipit-source-id: 0d634a034efe42b404abe1992a4f82280dbeedec
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54186
The `marchingFallback` directive is applied directly on the build type.
However here is invoked inside the `externalNativeBuild` making it confusing, because in reality
it has nothing to do with `externalNativeBuild`. So I'm moving it to the correct location
(this has no effect on the build setup, is just to make the code easier to read).
Changelog:
[Internal] [Changed] -
Reviewed By: cipolleschi
Differential Revision: D84921628
fbshipit-source-id: 064336ad64a8e1de20b747276f6e5ca7ce7cb677
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54185
Validate that the changes in D83341309 work across both experiment variants.
Changelog: [Internal]
Reviewed By: andrewdacenko
Differential Revision: D84924308
fbshipit-source-id: 7bf13d00f32c7af778b142ff3abdd0c2f7a5ba24
Summary:
This PR adds native CSS parser for `backgroundImage` property. Currently, it supports linear-gradient and radial-gradient spec compliant CSS syntax.
## Changelog:
[GENERAL] [ADDED] - background image native parser.
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
Pull Request resolved: https://github.com/facebook/react-native/pull/53609
Test Plan:
- Replicated existing testcases from JS. Currently i've added CSS syntax testcases. Checkout `CSSBackgroundImageTest.cpp`
### Verify example screens in RNTester
- Set `enableNativeCSSParsing` to true in `ReactNativeFeatureFlags.config.js` and run `yarn featureflags --update`
- Rebuild the project and verify `LinearGradientExample` and `RadialGradientExample` screens on both platforms.
### Notes
- Currently it is difficult to run CSS renderer tests. I made a custom cmake config to get it working, some steps would be helpful.
- Right now the new CSS renderer seems to be only working on iOS. NickGerleman mentioned there is some WIP to get it working on android. So please test this PR on iOS.
Reviewed By: mdvacca
Differential Revision: D83341309
Pulled By: javache
fbshipit-source-id: 91b88e3df164766c1f0021283697b1e5f9b44bfc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54180
in iOS 26, the tintColor prop is not applied by default to the action sheets buttons.
This change fixes it by restoring the same behavior we had before iOS 26.
## Changelog:
[iOS][Fixed] - Apply tint color to Actions sheets buttons
Reviewed By: cortinico
Differential Revision: D84844319
fbshipit-source-id: e211d0a735ea2da35f825c3568d66ba83e4ad832
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54179
iOS 26 changed how the `popoverPresentationController.sourceView`and the `popoverPresentationController.sourceRect` are handled by iOS.
Before iOS 26, those two properties were ignored by iPhones but used by iPads.
After iOS 26, those two properties are used by both iPhones and iPads.
This introduced an issue where users presenting an action sheet were actually able to interact with the back button on iPhone even ehwn they were not supposed to.
This change adds a condition over the idiom used (iPhone/iPad) to make sure that we use the anchors only with the iPad idions as it used to be before.
## Changelog:
[iOS][Fixed] - Revert action sheet behavior not to break apps on iOS 26
Reviewed By: RSNara
Differential Revision: D84842625
fbshipit-source-id: 347dfc21ee478abd02ba26078cb27d05e9cb64c5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54184
In Expo, someone reported (https://github.com/expo/expo/issues/40158) that `expo-image-manipulator` causes memory crashes when processing large images (> 30MB).
Image manipulator uses `RCTImageLoader` to load and decode images. As opposed to the Image component, it always requests for images in full size. For large images it may crash at `CGImageSourceCreateThumbnailAtIndex` which in the provided repro slowly increases memory usage until it finally crashes after a few seconds of running.
I figured out that not including the `kCGImageSourceThumbnailMaxPixelSize` option works much better, but using `CGImageSourceCreateImageAtIndex` instead of `CGImageSourceCreateThumbnailAtIndex` works even better – it's faster and consumes less memory during decoding. This is more or less what `SDWebImage` library does, see [`SDImageIOAnimatedCoder`](https://github.com/SDWebImage/SDWebImage/blob/master/SDWebImage/Core/SDImageIOAnimatedCoder.m#L488-L509).
With the proposed changes, it's still crashing but only for the largest image (64MB), other images (40MB and 50MB) are now working fine. Obviously, it cannot be fixed entirely and it's not recommended to load such big images without downscaling them.
## Changelog:
[IOS] [CHANGED] - Use `CGImageSourceCreateImageAtIndex` instead of `CGImageSourceCreateThumbnailAtIndex` to decode full-sized images
Pull Request resolved: https://github.com/facebook/react-native/pull/54127
Test Plan: I've tested the examples of the `Image` component in RNTester as well as the repro provided in https://github.com/expo/expo/issues/40158
Reviewed By: javache
Differential Revision: D84835416
Pulled By: cipolleschi
fbshipit-source-id: a182dd00f00194f0463ad4f583cc695647414fca
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54175
Changelog: [Internal] - Fix a bug with IntersectionObserver where we weren't considering edge-adjacent intersections.
So it is valid for `intersectionRatio` to be 0, but still be intersecting.
Reviewed By: mdvacca
Differential Revision: D84787414
fbshipit-source-id: ef6ab35be594f5b734c8c25d2475ee2a6dba1fe5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54177
Changelog: [Internal] - Rename the term "custom root" to "explicit root" to align with w3c spec. And "implicit root" for the document root.
Reviewed By: mdvacca
Differential Revision: D84795887
fbshipit-source-id: afec23f6763af56c6de1d3fce2f9501187559fb9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54170
This diff extracts the `toString(double, char)` function used to format percent values from `ValueUnit` into a separate `DoubleConversions` file.
This was added to graphics directly instead of moving it to core to avoid introducting cyclic dependencies since core depends on graphics.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D84714535
fbshipit-source-id: e41be90d211c28dba12e0920293698b3e1d3a1c7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54178
The `resizeMethod` prop was reading from `internal_analyticTag` and not setting on the backing image, this change remaps it
Changelog: [General][Fixed] resizeMethod was not propagated correctly on Android with Props 2.0
Reviewed By: javache
Differential Revision: D84716400
fbshipit-source-id: 320aded79cba787585d875fc46111bca34c0c30c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54143
This will become the default in AGP 9.x so let's update it inside RNTester as well.
Changelog:
[Internal] [Changed] -
Reviewed By: cipolleschi
Differential Revision: D84548388
fbshipit-source-id: 755344b93204f074926e47ef2a5c980b60e9121b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54164
Adding `fadingEdgeLength` prop to the Android scroll view props together with prop diffing support for Props 2.0.
Changelog: [Internal]
Differential Revision: D84788963
fbshipit-source-id: 6cf8011816311797fe0d805f68ccb026e32d7bff
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54158
Changelog: [Internal]
Animated was capturing `self` directly in C++ std::function contexts. When capturing Objective-C objects in C++ lambdas, they aren't automatically retained. When these lambdas were invoked later (potentially after `self` was deallocated), accessing `_onRender` and other instance variables caused the crash.
Reviewed By: zeyap
Differential Revision: D84638972
fbshipit-source-id: 38f8630cf4f677e29afff07348c2d5dbb1f5cd08
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54154
Adds a prominent vertical "Fast Refresh ⚛︎" marker entry in the performance timeline when a Fast Refresh update is complete.
This is available in apps with `performance.mark()` enabled (Canary feature).
Changelog: [Internal]
Reviewed By: hoxyq
Differential Revision: D84624705
fbshipit-source-id: 6c0ae0b8ae0acaaaba559a1854f64218bf5feabb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54126
The binary size for RN builds increased by ~180KiB due to the implementation of the `experimental_backgroundImage` property diffing.
This diff removes default inlining for the `toDynamic` serialization functions of the structs used by the linear and radial gradient styles.
Combined with the binary size improvements done previously for `ColorStop` and `ValueUnit`, the binary size has been reduced by 176.0KiB
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D84214151
fbshipit-source-id: 58b045eee839beb4f944689e752096df8f310e77
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54125
With ColorStop and ValueUnit being used at multiple locations, inlining the `toDynamic` conversion used for RN Android and using `std::format` to convert floating point values to string increased the binary size of RN Android by ~180KiB. This diff declares the functions outside the header to avoid inlining the functions and removes the dependency on `std::format` for the percent value string formatting.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D84349391
fbshipit-source-id: 2aab6f057f8b69d0af3779f6edabdd42705d0445
Summary:
Fixes: https://github.com/facebook/react-native/issues/53887
Fixes: https://github.com/expo/expo/issues/39480
In the latest Android 16 update, requesting permissions does not always change the app's state (the `onPause` and `onResume` functions aren't called). For instance, when you deny permission 3 times, the last promise won't resolve until you move the app to the background. The current logic inside the `ReactActivityDelegate` assumes that Android will call `onResume` after receiving permission state information from the system, which is no longer the case.
Probably connected with [this commit](https://android.googlesource.com/platform/packages/modules/Permission/%2B/5dca0ccb26f2b99d706a1d3e9402f851e849c913)
## Changelog:
[ANDROID] [FIXED] - Fix request permission not always resolving in Android 16
Pull Request resolved: https://github.com/facebook/react-native/pull/53898
Test Plan:
- I've tested it in the RNTester by denying the camera permission three times.
- I've also checked if the patch works with the Expo permissions code.
Reviewed By: javache
Differential Revision: D83059478
Pulled By: cortinico
fbshipit-source-id: 7bf33b379a1b6606ad2da2f75d337bf951e3986b