Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45242
tsia, comments should explain how this works but tldr is
* Set up cropping region to only draw within the view's bounds
* Draw 2 offscreen rects to cast the shadow. One represents the bounds of the original view, the other represents the clear region. Fill these rects with EO fill algo so the intersection is clear. The disjoint will be colored and cast a shadow.
* Do that for each shadow in reverse order
Changelog: [Internal]
bypass-github-export-checks
Reviewed By: lenaic
Differential Revision: D58885576
fbshipit-source-id: 2f3a5de75e93c7d34676128bbddbe38d64f1fb59
Summary:
tisa. Algo is
* Draw offscreen rect the size of the outset shadow (so accounting for spread)
* Set g state to cast shadow in proper place ON screen
* Clear out region in view
The rects need to be offscreen for the following reasons
* We need to account for spread radius, and CGContext shadows do not have support for this. So the only way to create a bigger shadow is the create a path that is the same size as the shadow we want
* We cannot just position this rect onscreen with no offset (so the shadow is casting directly under it) since the blur will look unnatural
* Offscreen means we do not see filled shadow rect but we do see the shadow it casts by offsetting it in the proper location
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D58881588
fbshipit-source-id: 2ea1b8945a3b9f182c4fb11668ac91a0ae7846ca
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44882
tsia, nothing too fancy here. Just taking the box shadows from raw props and throwing them into a struct so we can read it.
Changelog: [Internal]
bypass-github-export-checks
Reviewed By: NickGerleman
Differential Revision: D57617028
fbshipit-source-id: 29cf683b663b4903721d674efbf61a200eaf3a64
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45237
Changelog: [internal]
This creates a feature flag to test a fix for an incorrect state update dispatched to Fabric when using smooth scroll animations.
Specifically, when starting a smooth scroll animation from X to Y, the scroll view would set the state to Y, and then all the range from X to Y again. For example, the sequence of state updates when smooth scrolling from 0 to 5 would be `0 -> 5 -> 1 -> 2 -> 3 -> 4 -> 5`, which is obviously incorrect.
This flag prevents setting the final value before it's actually reached.
Reviewed By: javache
Differential Revision: D59233069
fbshipit-source-id: 221602d7d30635070e7776ce756e2ef438edf638
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45236
Changelog: [internal]
## Context
We're currently observing inconsistencies between the state of the UI on Android and the propagated state in Fabric.
When investigating the issue, we saw that there are some state updates that were going to be dispatched from scroll views to Fabric were skipped because the state object in native was deallocated.
The reason for that is a race condition between:
1. Dispatching new state updates from the UI thread
2. Updating the state previously dispatched from the UI thread on the JS thread.
{F1735383134}
## Changes
This creates a new feature flag to replace the weak reference with a strong one, so when the previous state is deallocated we can still access it to set new state.
The use of weak references was introduced in D44472121 to avoid holding onto JSI references (which could be contained in the state) when the runtime was deallocated, but we later introduced an explicit clean up mechanism in D45905628 that would make that unnecessary.
Reviewed By: javache
Differential Revision: D59233070
fbshipit-source-id: 018d8935f506430ecab96df0f7a998a37ee0f556
Summary:
This migrates the `test_js` workflow to GHA
## Changelog:
[INTERNAL] - Migrate test_js to GHA
Pull Request resolved: https://github.com/facebook/react-native/pull/45246
Test Plan: Will wait for CI
Reviewed By: javache
Differential Revision: D59270333
Pulled By: cortinico
fbshipit-source-id: e77eb9819e0819638c51e61b1e477ac04680a2f4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45233
We want the Gradle cache to be written only on main/-stable branches run, and only for jobs with `cache-read-only` == false (i.e. `build_android`).
This changes implements it.
Changelog:
[Internal] [Changed] - Further refine the Gradle caching logic.
Reviewed By: blakef
Differential Revision: D59225944
fbshipit-source-id: b6c3a5d4d0d399d6fe42287976925c43f3f12eb7
Summary:
Adds changelog for the 0.74.3 patch.
## Changelog:
<!-- 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
-->
[Internal] [Changed] - Add 0.74.3 changelog
Pull Request resolved: https://github.com/facebook/react-native/pull/45238
Reviewed By: cortinico
Differential Revision: D59263876
Pulled By: dmytrorykun
fbshipit-source-id: 0f16d51a01790b4ddcaca092dec7527aab386dcd
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44914
Shows a proof of concept how '*strongly typed Turbo Module scoped*' `EventEmitters` can be used in a ObjC Turbo Module.
## Changelog:
[iOS] [Added] - Add ObjC Turbo Module Event Emitter example
Reviewed By: rshest
Differential Revision: D57650830
fbshipit-source-id: c5c2dee4766484e9e58415e33c084999a9ae3bc6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45218
Noticed that when an exception occurred we would not cleanup global_refs, leaking them in the global table.
Restructure this to use RAII and rely on JNIArgs to do the cleanup as necessary.
Changelog: [Android][Internal]
Reviewed By: RSNara
Differential Revision: D59156494
fbshipit-source-id: c89552d72387bad2a120373e78a2c545415a7c82
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45207
These are their own shared library, and their own soloader-call, but they can easily be pulled into existing targets without causing excessive bloat.
Changelog: [Android][Removed] react_newarchdefaults is no longer a prefab, instead use fabricjni
Reviewed By: christophpurrer
Differential Revision: D59107105
fbshipit-source-id: fb3b25f3ce4511aa18126477f2beefe1292c6d09
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45231
Following up to cipolleschi's work, it turns out that me setting this command inside
the docker file for React Android is unneffective:
https://github.com/react-native-community/docker-android/pull/228
The reason is that the user executing is different (1001 for the Dockerfile, while GHA executes as root 1000).
So we need to set this, otherwise the nightlies will be invoked with the `-TEMP` prefix:
Changelog:
[Internal] [Changed] - Setup `git config --global --add safe.directory '*'` when running jobs inside Docker
Reviewed By: blakef
Differential Revision: D59223862
fbshipit-source-id: 26674fc8cdaebf6687407072cc4e4f5c38246845
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45205
We only need a static register method, which includes the core components and the provider function. CoreComponentsRegistry isn't referenced at all in Kotlin/Java, and can be replaced with DefaultComponentsRegistry with no change in behaviour in all scenarios.
Changelog: [Android][Removed] CoreComponentsRegistry is now fully replaced by DefaultComponentRegistry.
Reviewed By: cortinico
Differential Revision: D59107106
fbshipit-source-id: e679be490f43dab52eb5e11a08aa9d0ae2a89a92
Summary:
Fixes https://github.com/facebook/react-native/issues/45222
## Changelog:
[ANDROID] [FIXED] - Fix autolink plugin for libraries that are platform-specific
Pull Request resolved: https://github.com/facebook/react-native/pull/45223
Test Plan: And a library that does not have Android native code such as react-native-segmented-control/segmented-control and sync gradle
Reviewed By: rshest
Differential Revision: D59221562
Pulled By: cortinico
fbshipit-source-id: 55739d63ded63e46897d0d770281f937668c1f50
Summary:
Users are reporting that RN 0.75 is crashing due to us attempting to accessing a static method
on `AndroidUnicodeUtils.convertToCase` which is not static anymore due to Kotlin conversion.
Static access is inside Hermes codebase here:
https://github.com/facebook/hermes/blob/f5c867514c71b25212eb3039230e0c095518b532/lib/Platform/Unicode/PlatformUnicodeJava.cpp#L107-L109
Changelog:
[Android] [Fixed] - Fix crash due to missing JvmStatic to `convertToCase`
Reviewed By: javache
Differential Revision: D59218291
fbshipit-source-id: ac121a8bcd5fd917ee134d257f967c8e3e338ca5
Summary:
Use the hard-coded config for Helloworld instead of assuming the community cli is there to generate a config, which we can no longer assume.
Changelog: [Internal]
Pull Request resolved: https://github.com/facebook/react-native/pull/45221
Test Plan:
This works in my local environment:
```
bundle exec pod install
```
and
```
./gradlew generateAutolinkingPackageList
```
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D59162715
Pulled By: blakef
fbshipit-source-id: 95ff2c3929f12ee0ecf468cb80d2df1281eb746e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44906
Shows a proof of concept how '*strongly typed Turbo Module scoped*' `EventEmitters` can be used in a Java Turbo Module.
## Changelog:
[Android] [Added] - Add Java Turbo Module Event Emitter example
Reviewed By: javache
Differential Revision: D57530807
fbshipit-source-id: 04261d8885760f0e3b3c8c1931e0d56a5d33a0df
Summary:
The fix entails making `AllocationTestModule.valid` an Objective-C atomic property and funneling access to the ivar via the synthesized property getter and setter.
While the data race was present in test code, it would make it more difficult to spot more severe data races with the TSan. Also, getting rid of a data race is always good.
## Changelog:
[iOS][Fixed] - Data race related to access of `AllocationTestModule.valid`
Pull Request resolved: https://github.com/facebook/react-native/pull/45191
Test Plan: `RCTAllocationTests` will test the implementation of `AllocationTestModule`.
Reviewed By: christophpurrer
Differential Revision: D59155083
Pulled By: javache
fbshipit-source-id: e3217cffd0801377a25f04bf8ed0b4e2d1d88498
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44928
The react-native-community/ dependencies aren't being explicitly included as part of the Framworks (RFC-0759) work.
Changelog: [General][Breaking] react-native isn't dependend on react-native-community/*
WARNING: Do not commit until we've cut 0.75, this goes in the 0.76 release only otherwise it'll break `npx react-native@latest init`.
Reviewed By: cortinico
Differential Revision: D58528447
fbshipit-source-id: f238e621c47df9e28b2e18f4137eb08e525052f6
Summary:
In order to fix the data races described in https://github.com/facebook/react-native/issues/44715, I propose a simple solution by leveraging shared counter functions wherein `std::atomic` is the backing for the integer values.
## Changelog:
[iOS] [Fixed] - Implement shared atomic counters and replace static integers in `RCTImageLoader` and `RCTNetworkTask` that were accessed concurrently, which in some cases lead to data races.
Pull Request resolved: https://github.com/facebook/react-native/pull/45114
Test Plan: Added unit tests for the counters in `RCTSharedCounterTests`.
Reviewed By: cipolleschi
Differential Revision: D59155076
Pulled By: javache
fbshipit-source-id: f73afce6a816ad3226ed8c123cb2ccf4183549a0
Summary:
Having React Native support every Apple platform is tough to achieve as it introduces many platform-specific ifdefs.
On the other side, maintaining an OOT platform fork is already a demanding job, so to make it easier I propose adding ifdefs for iOS-specific code. Thanks to this change, OOT platforms can focus on their OS-specific features while the core is also adding iOS-specific features behind ifdefs. Fortunately, **most of the code on Apple platforms can be shared** and this PR aims to introduce better support for this and to minimize OOT fork's surface.
In this example `RCTDeviceInfo.mm` has support for handling orientation changes and the availability of this feature across Apple OS looks as follows:
| Platform | Support |
| ------------- | ------------- |
| macOS | ❌ |
| tvOS | ❌ |
| visionOS | ❌ |
| iOS/iPadOS | ✅ |
Here is a table from `TargetConditionals.h` header file which shows the coverage of `TARGET_OS_IOS` macro. (It supports both iOS and iPadOS)

## Changelog:
<!-- 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
-->
[INTERNAL] [ADDED] - Conditionals for iOS only code in RCTDeviceInfo.mm
Pull Request resolved: https://github.com/facebook/react-native/pull/45176
Test Plan: CI Green
Reviewed By: christophpurrer
Differential Revision: D59106103
Pulled By: cipolleschi
fbshipit-source-id: 594a9d2451024baddfbc9cd3bc1ccfb8829fc31c
Summary:
This PR fixes rendering of `RCTRedBoxExtraData`
I noticed that it wasn't displaying the `reload` and `dismiss` buttons, which made it impossible to close modal and to reload JS on e.g. `visionOS` (on `iOS` it could only be closed by swiping).
PR adds these buttons back and also introduces some refactoring
Before & After:
<img width="1118" alt="pr-img" src="https://github.com/facebook/react-native/assets/56474758/50e22499-9df0-45f0-84ac-2118ab7a8e6c">
## Changelog:
[IOS] [FIXED] - Fix rendering `RCTRedBoxExtraData`
Pull Request resolved: https://github.com/facebook/react-native/pull/43102
Test Plan: Make sure that `RCTRedBoxExtraData` displays and works as expected
Reviewed By: dmytrorykun
Differential Revision: D59108365
Pulled By: cipolleschi
fbshipit-source-id: b88c5665962d0280d68377863aa3346edfdf86b7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45197
With React 19, `forwardRef` is no longer necessary because `ref` is available on props. However, this only holds true for functional components — not class components.
This eliminates the `forwardRef` invocation in `ScrollView`, while retaining the wrapper component to map `ref` to `scrollViewRef` for the class component. For now...
Changelog:
[Internal]
Reviewed By: javache
Differential Revision: D59091873
fbshipit-source-id: 60afcd441aec82fa050738b5c09083f3a26378d6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45203
Configures a `REACT_NATIVE_ENABLE_FUSEBOX_DEBUG` flag, and exposes this flag in the Buck target via a [constraint setting](https://www.internalfb.com/intern/wiki/Buck-users/select-and-friends/#constraint-setting-and-c). This is an additional hook to enable the new debugger stack (codename Fusebox) as part of our internal rollout.
NOTE: This approach replaces D59014161 (reverted).
Changelog: [Internal]
Reviewed By: hoxyq
Differential Revision: D59109110
fbshipit-source-id: 7d23d9d402569b00d8dd17b9c8f3bcc108f0365f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45151
This change was missed when fixing hue-rotate and adding drop-shadow. I believe the only issue with this was stacking context was not being created for these two filters.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D58965245
fbshipit-source-id: e6bfdb738a8bc8caa878f60420cfe8b421f64aa4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45161
This is part of a bigger refactoring of the Android pipelines.
As `build_android` is already building everything, let's save the maven-local
so it can be reused by other jobs (test_android_helloworld and build_npm_package).
Changelog:
[Internal] [Changed] - Let build_android produce a signed maven-local.zip archive
Reviewed By: cipolleschi, blakef
Differential Revision: D59002893
fbshipit-source-id: db03946c975b2ce91dae0c4011981b2fe9dd6113
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45133
Recently, CircleCI has failed pretty often due to these tests.
The reason is that we migrated these jobs to M1 machines, as circleCI is deprecating intel ones, and on these machines the simulators tend to freeze. Hence, every often we get stuck when running the tests. :(
We are going to move to GHA, so that should not be a big issue.
## Changelog:
[Internal] - Disable unit tests in CircleCI to improve CI robustness
Reviewed By: cortinico
Differential Revision: D58948614
fbshipit-source-id: 5420bdf0fda325779a4e287e7b00c623de822ccb
Summary:
This PR refactors `supportedInterfaceOrientations` to use RCTKeyWindow instead of `[RCTSharedApplication() keyWindow]`.
## Changelog:
[IOS] [CHANGED] - Refactor supportedInterfaceOrientations method to use RCTKeyWindow()
Pull Request resolved: https://github.com/facebook/react-native/pull/43026
Test Plan: CI Green
Reviewed By: dmytrorykun
Differential Revision: D59109614
Pulled By: cipolleschi
fbshipit-source-id: 025534c419078dce29e1e5caacf8a1b15de1abcc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45196
Currently, `mockComponent` makes a false assumption that if a component is a function, it extends `React.Component`.
There's a bunch of problems with this mocking setup with requiring mock components that extend `React.Component`, but this change does not attemp to solve that.
This change unblocks future refactors to make native components export functional components (that are neither class component nor `forwardRef` results).
Changelog:
[General][Changed] - Fixed native component mocking in Jest unit tests to support functional components
Reviewed By: javache
Differential Revision: D59097730
fbshipit-source-id: ca2784ac3baa9ab4ab6a503c5fd6437c60179352
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45195
Configure `Modal-test.js` to reset modules between test cases so that there is better isolation, making the tests easier to reason about and to debug.
Changelog:
[Internal]
Reviewed By: javache
Differential Revision: D59097729
fbshipit-source-id: 3b9260283e171ff7fa6b7ffc56685f703875291e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45174
As per title, this port bck to main the changes we made in the release testing script.
## Changelog:
[Internal] - Update release testing script to work with the new template
Reviewed By: blakef
Differential Revision: D59054045
fbshipit-source-id: 0e93c2db94499407845b4fb2c98c8b44310e770f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45175
This change ports the CI improvements we made on stable branch to main.
## Changelog:
[Internal] - Port back to main improvements we made in GHA
Reviewed By: cortinico
Differential Revision: D59053873
fbshipit-source-id: 73eb7e33b9bbdc5d8c3a9294f487ad969b144bf3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45190
Just a small follow up from the previous change to `IntersectionObserverManager`.
Changelog: [internal]
Reviewed By: javache
Differential Revision: D59065041
fbshipit-source-id: 2944299143e6a0fe53fe64083db85635e72d71af
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45162
Previously we would crash in ReactInstance#callFunctionOnModule (P1443291303) when reloading (due to the onHostPause call) because we removed a source of synchronization by using the immediate executor.
Workaround it by making sure we always null out references to `mReactInstance` before we actually start destroying it.
Changelog: [Internal]
Reviewed By: RSNara
Differential Revision: D59002404
fbshipit-source-id: 3ee14cd1fe7d423bb6158356bb99b3d2d6af8d6f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45170
Reimplements `unstable_subscribeToOnScroll` so it does not invalidate all descendant children upon first invocation per `ScrollView` instance.
Previously, the state update would cause the entire `ScrollView` component to re-render. This refactors the `enableSyncOnScroll` boolean state so that it resides in a lower level component that implicitly memoizes all of its `props` (including the `ScrollView` children).
Changelog:
[Internal]
Reviewed By: javache
Differential Revision: D59033393
fbshipit-source-id: 5a4b75aebdcbd0dd1dfa28511862bee495816250