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
Summary:
Instead of copying the `std::function` into `invokeAsync`, we now move it.
## Changelog:
[GENERAL] [CHANGED] - Move `std::function` into `CallInvoker::invokeAsync` instead of copying it
<!-- 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/54141
Test Plan: Build, run. A lot of code still uses the old `invokeAsync` function.
Reviewed By: christophpurrer
Differential Revision: D84563949
Pulled By: javache
fbshipit-source-id: 283be3d12f1ac1c7f3da528c6b50b36cc81cd82a
Summary:
Avoid data loss during conversion which fixes https://github.com/microsoft/react-native-windows/issues/14698
## Changelog:
Added a one-line fix to static_cast to a float
Pick one each for the category and type tags:
[GENERAL] [FIXED] - Avoid data loss during conversion
Pull Request resolved: https://github.com/facebook/react-native/pull/54132
Test Plan: Working in react native windows
Reviewed By: javache
Differential Revision: D84510049
Pulled By: cortinico
fbshipit-source-id: 37691a9169bf143d19d438e2ce2bbea67f711b3a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53778
I've been looking into the next major bump of AGP to 9:
https://developer.android.com/build/releases/agp-preview#android-gradle-plugin-built-in-kotlin
This change adapts our project so that it keeps on buildign with AGP 8
(as the bump to 9 would be a breaking change), but it addresses some of the build
failures we'll be having with AGP 9:
- Set `resValues` build option to true (default was changed true -> false in AGP 9)
- Opts out our project from `android.builtInKotlin` and `android.newDsl` for the time being.
Changelog:
[Android] [Fixed] - Fix build failures with RNGP due to AGP 9.0.0-alpha05
Reviewed By: alanleedev
Differential Revision: D82452555
fbshipit-source-id: 99561f039bf943f5ce99008ce073ca86431cfaed
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53677
## Context
When configuring an app to build with SwiftPM from source, there is a sequence of operations we need to run in order to prepare the project correctly.
## Changed
Add a function that runs `prepareHeaders` that configures the headers for React Native and Codegen targets.
## Changelog:
[Internal] -
Reviewed By: cortinico
Differential Revision: D81778440
fbshipit-source-id: 26b973c07e82f30663e51c4a8e0e72f54765115e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53676
## Context
When configuring an app to build with SwiftPM from source, there is a sequence of operations we need to run in order to prepare the project correctly.
## Changed
Add a function that generates codegen artifacts. Those are required by React Native and by the app to build properly.
## Changelog:
[Internal] -
Reviewed By: cortinico
Differential Revision: D81778439
fbshipit-source-id: 7fe5cc0b612d2d9324d68fe04ec556e986ec14af
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53675
## Context
When configuring an app to build with SwiftPM from source, there is a sequence of operations we need to run in order to prepare the project correctly.
## Changed
Add a function that create hardlinks for React Native so it can build from source
## Changelog:
[Internal] -
Reviewed By: cortinico
Differential Revision: D81778454
fbshipit-source-id: 702a603629e4fad154b5d79dea6d96fcd80235b9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53674
## Context
When configuring an app to build with SwiftPM from source, there is a sequence of operations we need to run in order to prepare the project correctly.
## Changed
Add a function updates the PAckage.swift file to set BUILD_FROM_SOURCE to true
## Changelog:
[Internal] -
Reviewed By: cortinico
Differential Revision: D81778460
fbshipit-source-id: b06ebc546aa8e87acdb15706a0559e9046173784
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53673
## Context
When configuring an app to build with SwiftPM from source, there is a sequence of operations we need to run in order to prepare the project correctly.
## Changed
Add a function that configure React Native to be swift compatible by creating the React-umbrella and modulemap
## Changelog:
[Internal] -
Reviewed By: cortinico
Differential Revision: D81778437
fbshipit-source-id: 8bfd0df3abed813a221e5ef7972f4b7a6e292e76
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53667
This change updates the Package.swift file to enable building RNTester and HelloWorld from source.
The set of changes is the following:
- add a BUILD_FROM_SOURCE flag to toggle between building for creating prebuilds and building an app from source
- configure the proper header search path based on whether we want to build an app from source or not
- split the ReactFabricComponents target in multiple subtargets. This is required because when building from source we can't have targets whose Source folder is overlapping.
## Changelog:
[Internal] -
Reviewed By: cortinico
Differential Revision: D81778452
fbshipit-source-id: 00553a9966e7d96177e70d45179e712536c23124
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53671
## Context
When configuring an app to build with SwiftPM from source, there is a sequence of operations we need to run in order to prepare the project correctly.
## Changed
Add a function that prepares the prebuilds for ios so we can leverage them when building from source
## Changelog:
[Internal] -
Reviewed By: cortinico
Differential Revision: D81778467
fbshipit-source-id: bacfcfd3d646bfa27dcd800417e4787308a51a86
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53706
## Context
When configuring an app to build with SwiftPM from source, there is a sequence of operations we need to run in order to prepare the project correctly.
## Changed
Add a function that runs `pod deintegrate` to remove remainings of cocoapods
## Changelog:
[Internal] -
Reviewed By: cortinico
Differential Revision: D81778468
fbshipit-source-id: 20e1cfefcef8318d63d4a6ff92050ced0f91ef53
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53669
## Context
When configuring an app to build with SwiftPM from source, there is a sequence of operations we need to run in order to prepare the project correctly.
## Changed
Add a function that given the root of the app and the name of the xcodeproject file, can return the path to the Xcode project file
## Changelog:
[Internal] -
Reviewed By: cortinico
Differential Revision: D81778456
fbshipit-source-id: f7050bcb049d75a5b1cabf340a5b98f4736e60b3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54084
Android port of D83754145.
1. Teaches the native networking module on IOS to track a `devToolsRequestId` along with each request, and use it instead of the internal `requestId` to identify the request to `NetworkReporter`.
2. Uses `__NETWORK_REPORTER__.createDevToolsRequestId` (D83238216) to generate a `devToolsRequestId` from JS and pass it into native. This records a JavaScript call stack as the [initiator](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Network#type-Initiator) of the request.
Changelog: [Internal]
Reviewed By: huntie
Differential Revision: D83981793
fbshipit-source-id: b4b8828433881c15e44a0468275a5cf398e7d050
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54114
This setup script will be published in the react-native package.
Other people might not have prettier installed, so it will crash the mock below.
Therefore, we wrap this mock in a try-catch.
Changelog: [General][Fixed] Fixed https://github.com/facebook/react-native/issues/54102
Reviewed By: cortinico
Differential Revision: D84292458
fbshipit-source-id: e884b02eec6abb7a964e01dd01f72f6e2ee31dab