Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45194
Makes a couple improvmeents to `LogBoxInspectorHeader`:
- Avoid eagerly initializing the `StatusBar` TurboModule until it is actually needed (which is only when the inspector is rendered on Android).
- Switch to `SafeAreaView` on iOS, for more accurate spacing (instead of the hardcoded iPhone X notch size).
Changelog:
[General][Changed] - Improve LogBox initialization performance
[iOS][Changed] - Improve LogBox safe area insets styling
Reviewed By: lyahdav
Differential Revision: D59081529
fbshipit-source-id: 01cc351fa9267f96b7a3c13cf1db80de3e597f93
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45186
Changelog: [internal]
(this is an internal change because `IntersectionObserver` hasn't been released yet).
When testing IntersectionObserver, I realized that it wasn't triggering notifications for elements not intersecting when the surface that contained them was completely deallocated.
This is unexpected because IntersectionObserver notifications are delivered when the element is removed from the root, but not when the root itself is removed.
This fixes that behavior by:
1. Adding a method in `UIManagerMountHooks` to get a notification about the surface being unmounted. This is necessary to keep the API backwards compatible.
2. Using that method in `IntersectionObserverManager` to notify all observers (and report a change if necessary).
Reviewed By: javache
Differential Revision: D59061136
fbshipit-source-id: ef5669f9d6b08d98652489e6731902d192ec28f8
Summary:
Tests were failing on windows due to parsing CRLF line endings. This change enables the API tests for windows by normalizing line endings before parsing the file.
## Changelog:
[INTERNAL] [ADDED] - `public-api-test` now runs on Windows.
<!-- 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/45145
Test Plan: Build-time-only change; relying on CircleCI
Reviewed By: cipolleschi
Differential Revision: D59001867
Pulled By: huntie
fbshipit-source-id: a7a41945e8c93288be1d5b7b59df7f621e467657
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45185
Follow-up to D59058085.
Since the release branch for 0.75 has been cut, we are able to simplify this step.
Changelog: [Internal]
Reviewed By: christophpurrer
Differential Revision: D59058084
fbshipit-source-id: 21b77a74e13bb196336a63b984f921f0c9fde587
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45184
This is a follow-up to D59055522.
> NOTE:This diff will be followed up by a merge of the set-rn-version script into set-version. (I had considered a rename to version-rn-artifacts, intentionally keeping this script separate and distinct from a future [lerna version + this script] setup — however the current UX and confusion with this naming would be too confusing. It can move into a util 👍🏻.)
- Rename `set-rn-version` to `set-rn-artifacts-version` (more accurate).
- Mark this script as deprecated.
- For now, there are too many references to this script in CI test jobs to refactor away this entry point, so I am avoiding this — these should later be standardised to `set-version`.
Changelog: [Internal]
Reviewed By: christophpurrer
Differential Revision: D59058085
fbshipit-source-id: 4123ac73b5c7a2e07a1d1b6da61e0ad94fc31f84
Summary:
While developing React Server Component support for React Native, I've been adding this patch to the `react-native` package. It opts the entire `react-native` package out of being server rendered.
In the future, we'll want to circle back and refactor the `react-native` package to be more isomorphic so we can allow for utilities like `processColor` to be used in server bundles that target native platforms.
## Changelog:
[GENERAL] [ADDED] - Added support for importing `react-native` in a `react-server` environment for React Server Components support.
<!-- 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/43986
Test Plan:
Using react-native with this patch in a framework that supports React Server Components for native platforms, such as my unreleased branch of Expo Router, will allow for server rendering views from `react-native` to RSC Flight code with client references to the `react-native` package, e.g.
```js
import { View } from 'react-native';
export default function App() {
return <View testID="basic-view" style={{ "backgroundColor":"#191A20" }}/>
}
```
Can be server rendered to ↓
```
2:I["/node_modules/react-native/index.bundle?platform=ios&dev=true#798513620",["..."],"View"]
1:["$","$L2",null,{"testID":"basic-view","style":{"backgroundColor":"#191A20"}}]
```
> The client boundaries (URL paths) are specific to the current Expo CLI implementation (based on Metro) and may look different in other implementations.
Reviewed By: rickhanlonii
Differential Revision: D55891243
Pulled By: TheSavior
fbshipit-source-id: d8dc9590039181ebf2c013dacca5f255d7a8f625
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45180
- Simplifies the responsibilities of `scripts/releases/set-rn-version.js`.
- This no longer modifies `packages/react-native/package.json`, delegating this to `set-version`.
- Simplifies logic in `set-version`, **fixing behaviour** against deps in `packages/react-native/package.json`.
- This also acts as cleanup since D58469912 (template removal) — removing the unreferenced `update-template-package.js` util.
NOTE: This diff will be followed up by a merge of the `set-rn-version` script into `set-version`. (I had considered a rename to `version-rn-artifacts`, intentionally keeping this script separate and distinct from a future [`lerna version` + this script] setup — however the current UX and confusion with this naming would be too confusing. It can move into a util 👍🏻.)
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D59055522
fbshipit-source-id: 79b937f9e0ac790512b180ab4147aefef7f5202c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45028
Since the addition of new workspaces to the repo which introduce interdependencies on `react-native` (`helloworld`, `react-native-test-library`), this fix is needed to preserve our current versioning strategy and bump the repo after yesterday's `0.75-stable` branch cut.
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D58725561
fbshipit-source-id: ab282806560f47dc5acf7e694302ca6b85649b14
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44814
We needed this workaround to import the paper renderer in the New Architecture to make sure that the event emitter is properly registered before we use it.
With the previous change, we don't need this lines of code anymore as we are using a different mechanism for the events.
## Changelog:
[Internal] - Avoid to import the old Renderer in the New Architecture
## Facebook:
This diff was initially part of D57097880, but I split them for the OTA
Reviewed By: cortinico
Differential Revision: D58234325
fbshipit-source-id: 1335992460635e9e97ee83615f9fd2651936b32c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45167
Configures a `REACT_NATIVE_ENABLE_FUSEBOX_DEBUG` flag, and exposes this flag in the Buck target. This is an additional hook to enable the new debugger stack (codename Fusebox) as part of our internal rollout.
Changelog: [Internal]
Reviewed By: hoxyq
Differential Revision: D59014161
fbshipit-source-id: f05e8b01ed07da90ef6d7a66ade05f462dd82023
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45156
We don't want to bubble up exceptions from props parsing, so match the behaviour from convertRawProp and fall back to the default value when an exception is encountered.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D59000397
fbshipit-source-id: f6f64a80fed98525cdd2a5b5d360c2d6ede76a12
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45160
This should optimize the Gradle cache, so that only `build_android` which
effectively builds everything Android related, should be allowed to write there.
More info on this strategy here:
https://github.com/gradle/actions/blob/main/docs/setup-gradle.md
Changelog:
[Internal] [Changed] - Only build_android should write to the Gradle Cache
Reviewed By: cipolleschi
Differential Revision: D59002323
fbshipit-source-id: 31b815747efdf93bfc7baf97799e287c8dcd7f02
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45165
This is a fix for https://github.com/facebook/react-native/issues/45112
This diff changes the codegen so that the output path is computed relative to project root (or `path` if provided) instead of current working directory.
Changelog: [General][Fixed] - Codegen computes output path relative to project root instead of current working directory.
Reviewed By: fkgozali
Differential Revision: D59009821
fbshipit-source-id: 3a138a3508fc239c8600b8c9f242f1c665f8e3c0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45049
WithRuntimeDecorator is missing many methods that were added after it.
Add implementations for them.
The underlying issue here is that because this inherits from
RuntimeDecorator, which implements all methods, there is no compilation
error for this runtime when we add new methods.
Changelog:
[GENERAL] [FIXED] - Add missing methods to the WithRuntimeDecorator class.
Reviewed By: avp
Differential Revision: D58752127
fbshipit-source-id: d80b4ed1c38698ed3850d0cd961bf7ddde2449a0
Summary:
This PR adds missing `WithRuntimeDecorator` methods related to `NativeState`. This pattern is used by reanimated to ensure no concurrent access to the runtime. Without this `override` the `RuntimeDecorator` implementation was used, bypassing our mutex.
Changelog:
[GENERAL] [FIXED] - Add missing `NativeState` methods to the `WithRuntimeDecorator` class.
Pull Request resolved: https://github.com/facebook/react-native/pull/45042
Reviewed By: fbmal7
Differential Revision: D58744051
Pulled By: neildhar
fbshipit-source-id: 3f5c85d0bf7cd6445d0c434ac4ae7ed54df203ba
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45168
Refactors the native component imports in `ScrollView` so that 1) they create less clutter in the `ScrollView` implementation file, and 2) they offer more efficient import inlining.
Currently, `ScrollView` has to evaluate both horizontal and vertical components even though only one may be used. Now this optimization is possible.
Changelog: [Internal]
Reviewed By: lyahdav
Differential Revision: D59015990
fbshipit-source-id: 963009821a7d3019d36a43269e9792ac1f2f38ec
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45164
Some changes have been made to the codegen since `react-native-test-library` was published. This diff updates the generated artifacts in that library.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D59010093
fbshipit-source-id: f11ccd3645da72d45c70581e485f8546166ca182
Summary:
## Summary
Right now, the only way to load the javascript bundle is through the assets:// directory.
But, legacy react native also supports loading bundles via regular file urls.
If present, those file urls override the assets:// bundle urls.
This diff implements that support in bridgeless.
Changelog: [Android][Added] Allow js bundle file urls
Reviewed By: christophpurrer
Differential Revision: D58977143
fbshipit-source-id: 6f1a170546c8bbeac3a1b9d2dd5633177e33a688
Summary:
The ReactInstanceManager allows applications to register a ReactInstanceEventListener with itself.
Exposing a similar functionality to ReactHost. So, applications can do the same in bridgeless.
Changelog: [Android][Added] - Make ReactInstanceEventListener available on ReactHost
Reviewed By: christophpurrer
Differential Revision: D58890092
fbshipit-source-id: c18ee8a45d274c5cba859c6a5b4049904f1d308a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45138
Add a new `/open-debugger` endpoint format that allows specifying `target` - the proxy-unique target `id`. This is logically equivalent to specifying both device and page.
Changelog:
[General][Added]: Inspector: Support `/open-debugger` specifying `target` param
Reviewed By: hoxyq
Differential Revision: D58950622
fbshipit-source-id: 9665f8a24ba2bb0561cc3c693dfb84bfffdeb4a4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45140
Previously, if the `/open-debugger` endpoint was provided with both `device` and `appId` query params, we would:
- Try to find a target with a matching `device` (note that these logical "devices" are unique per-app) - if found, use it. Otherwise,
- Try to find a target with a matching `appId` - if found, use that.
This could go "wrong" in two ways:
- If a `device` is given with a spurious `appId`, we'd open to a target with an `appId` differing from the one specified.
- If the `device` has gone away but there is a different target with the same app, we'd use that as a fallback (right app, wrong device).
This applies the filters more strictly so that if both are given, both must match.
Changelog:
[General][Changed]: Inspector: Enforce device and appId filters if both are given to /open-debugger
Reviewed By: hoxyq
Differential Revision: D58951952
fbshipit-source-id: a95f1160e5c88f957445058f3273e922a5d28c1e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45088
This diff should make iterator-style prop setting more performant.
- It removes some layers of indirection. Now `ConcreteComponentDescriptor` calls into `setProp` directly.
- On both platforms, we will use `folly::dynamic` parser, it seems it is slightly faster.
- On Android, we will reuse `props->rawProps` parsed as a `folly::dynamic` representation, instead of parsing stuff twice.
Changelog: [Internal] - This hasn't been rolled out to OSS yet.
Reviewed By: javache
Differential Revision: D58593492
fbshipit-source-id: aa2dcb4e7ba2248f6ba7aa82a60355efdf769b2c
Summary:
This PR replaces the depreacted `statusBarOrientation` method to `interfaceOrientation`, as in the apple developer docs it clearly says the method has been deprecated
https://developer.apple.com/documentation/uikit/uiapplication/1623026-statusbarorientation
## Changelog:
[iOS] feat:- added UIInterfaceOrientation in place of statusBarOrietation.
[IOS] [ADDED] - Added RCTUIInterfaceOrientation helper method
Pull Request resolved: https://github.com/facebook/react-native/pull/44825
Test Plan: Tried `RNTester` build after the changes and it ran successfully!
Reviewed By: cortinico
Differential Revision: D58947500
Pulled By: cipolleschi
fbshipit-source-id: 401abf1d46b415093f441d1dbee139e7aaf8712c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45146
Changelog: [Internal]
Currently, on Android, we destroy the Fusebox `HostTarget` when we receive the `onHostDestroy` event, which (counterintuitively) does not mean the ReactHost/InstanceManager ("Java Host") is being destroyed. This can lead to situations where the `HostTarget` is destroyed too soon (e.g. when a single Java Host is reused across multiple Activities).
Now that we have the `invalidate()` method on the Java Host classes, we can tie `HostTarget`'s destruction to that instead.
Since calling `invalidate()` is explicitly optional, we also need to account for the case where the caller just lets go of the Java Host reference and expects GC to handle cleanup. This includes:
* Breaking the retain cycle between the Java Host and its C++ part. We achieve this using `WeakReference` to reference the Java Host.
* Making the C++ part of the Host safe to destroy from any thread (and in particular the finalizer thread). We achieve this by scheduling `HostTarget`'s unregistration (in C++) on the executor supplied by the Java Host.
Reviewed By: hoxyq
Differential Revision: D58284590
fbshipit-source-id: 4ee4780354fb81137b891d5891d6138ac215cbff
Summary:
Improve compatibility with web implementations of JS timers.
Fixes https://github.com/facebook/react-native/issues/45085
## Changelog:
[GENERAL] [CHANGED] - Timer functions are now throwing exceptions in less cases and are instead quiet quitting (similar to browsers)
[GENERAL] [CHANGED] - Timer functions `timeout` argument is now coerced to a number
Pull Request resolved: https://github.com/facebook/react-native/pull/45105
Test Plan: Updated RN tester
Reviewed By: christophpurrer
Differential Revision: D58952146
Pulled By: javache
fbshipit-source-id: 5b6de524f6a03f5221f0d11e0ae2a9313951c767
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45143
Changelog: [internal]
Just a small refactor of some private methods in `RuntimeScheduler_Modern` to refer to some concepts in terms of the event loop.
Reviewed By: christophpurrer
Differential Revision: D58948811
fbshipit-source-id: 979c78ccd4cf5d96f00061049366171934b43ee2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45082
Changelog: [Android][Breaking] `ReactNativeHost` invalidates the instance manager on `clear()`
Changes `ReactNativeHost.clear()` to invalidate the underlying `ReactInstanceManager`, rather than merely destroying the instance.
This is technically a **breaking change** because the underlying `ReactInstanceManager` may have escaped (via `ReactNativeHost.getReactInstanceManager()`) before the `clear()` call. In my reading of the API and of usages like [this one in Expo](https://github.com/expo/expo/blob/23a905b17065703882ebeda1fc9f65a05cc69fa7/packages/expo-dev-menu-interface/android/src/main/java/expo/interfaces/devmenu/ReactHostWrapper.kt#L117), this should rarely occur in practice.
The plan:
1. D58811090: Add the basic `invalidate()` functionality.
2. **[This diff]**: Add `invalidate()` call sites where it makes sense in core.
3. [Upcoming diff]: Keep the Fusebox debugging target registered until the Host is explicitly invalidated.
Reviewed By: javache
Differential Revision: D58811091
fbshipit-source-id: 5dfebad46a2bdf3601642b3c3fe3e79e8695e193
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45081
Changelog: [Android][Added] Add `invalidate()` method to ReactHost and ReactInstanceManager
Adds an `invalidate()` method to both `ReactHost` (Bridgeless) and `ReactInstanceManager` (Bridge). This method is an *optional* signal that the application is about to permanently stop using the Host, and that the Host can therefore fully clean up any resources it's holding.
Reusing a Host after it's invalidated is illegal and will trigger a Java assertion.
The plan:
1. **[This diff]**: Add the basic `invalidate()` functionality.
2. [Upcoming diff]: Add `invalidate()` call sites where it makes sense in core
3. [Upcoming diff]: Keep the Fusebox debugging target registered until the Host is explicitly invalidated.
Reviewed By: tdn120
Differential Revision: D58811090
fbshipit-source-id: 79b607dcc74de38b85fc0ebb4c640b9654595c9a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44939
DropShadow is a filter so we need to add the logic for sending it to native through the same process function for the other filters.
Drop shadow can have more arguments than the other filters. I'm following a similar pattern to boxShadow D57872933.
Changelog: [Internal]
Reviewed By: joevilches
Differential Revision: D58370127
fbshipit-source-id: dba06bb2e0ea2799d20e8b0b9065a5729df22bb6