Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49542
When fusebox loads, we display this static message on apple platforms:
```
Debugger integration: iOS Bridgeless (RCTHost)
```
We are running RN MacOS using the xplat `RCTHost` and want to show the correct platform
[Changelog] [Internal] - Use current apple platform name instead of hardcoding 'iOS'
Reviewed By: robhogan
Differential Revision: D69867335
fbshipit-source-id: 5973882c710447fdb7ef18e82ff304e4cd16a85c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49541
changelog: [internal]
`RCTSurfacePresenter` may be initialised from a background thread. This breaks the requirement of `RCTInitializeUIKitProxies`, which must be always called on the main thread.
Differential Revision: D69874923
fbshipit-source-id: 098f543bd3a849ee9ee1b63b567290f67c0109cd
Summary:
This fixes an issue in Fabric where changing the layout direction and then reloading the JS bundle did not honor the layout direction until the app was restarted on iOS. This now calls `_updateLayoutContext` whenever RCTSurfaceView is recreated which happens on bundle reload. This is not an issue on the old architecture because the layout direction is determined within the [SurfaceViews](https://github.com/facebook/react-native/blob/acdddef48eb60b002c954d7d2447cb9c2883c8b3/packages/react-native/React/Views/RCTRootShadowView.m#L18) which were recreated on bundle reload.
## Related Issues:
- https://github.com/react-native-community/discussions-and-proposals/issues/847
- https://github.com/facebook/react-native/issues/49451
- https://github.com/facebook/react-native/issues/48311
- https://github.com/facebook/react-native/issues/45661
## How can we take this further?
If we want to make it so that it doesn't require an entire bundle reload for RTL to take effect I believe these are the steps that would need to be taken:
- Make it so [RCTI18nManager](https://github.com/facebook/react-native/blob/acdddef48eb60b002c954d7d2447cb9c2883c8b3/packages/react-native/React/CoreModules/RCTI18nManager.mm#L52) exports isRTL as a method instead of consts
- Send Notification Center notif when RTL is forced on or off
- Listen for that notification RCTSurfaceView and call _updateLayoutContext similar to UIContentSizeCategoryDidChangeNotification.
## Changelog:
[iOS] [FIXED] - Layout direction changes are now honored on bundle reload.
<!-- 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/49455
Test Plan:
On the new architecture change force the layout direction and reload the bundle:
```
import React, { useCallback } from "react";
import { Button, I18nManager, StyleSheet, Text, View } from "react-native";
import RNRestart from "react-native-restart";
export default function Explore() {
const onApplyRTL = useCallback(() => {
if (!I18nManager.isRTL) {
I18nManager.forceRTL(true);
RNRestart.restart();
}
}, []);
const onApplyLTR = useCallback(() => {
if (I18nManager.isRTL) {
I18nManager.forceRTL(false);
RNRestart.restart();
}
}, []);
return (
<View style={styles.area}>
<Text>Test Block</Text>
<View style={styles.testBlock}>
<Text>Leading</Text>
<Text>Trailing</Text>
</View>
<Button title={"Apply RTL"} onPress={onApplyRTL} />
<Button title={"Apply LTR"} onPress={onApplyLTR} />
</View>
);
}
const styles = StyleSheet.create({
area: {
marginVertical: 50,
paddingHorizontal: 24,
},
testBlock: {
paddingVertical: 10,
flexDirection: "row",
justifyContent: "space-between",
},
});
```
https://github.com/user-attachments/assets/0eab0d79-de3f-4eeb-abd0-439ba4fe25c0
Reviewed By: cortinico, cipolleschi
Differential Revision: D69797645
Pulled By: NickGerleman
fbshipit-source-id: 97499621f3dd735d466f5119e0f2a0eccf1c3c05
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49540
changelog: [internal]
it is dangerous to call RCTUnsafeExecuteOnMainQueueSync while holding a lock. We can avoid that by keeping only the checks into shared state under a lock and rest is without lock.
This also aligns implementation with other proxy objects.
Reviewed By: javache
Differential Revision: D69856171
fbshipit-source-id: 5f7fd1ebeb642796169d77a437fbc215c3c59795
Summary:
This diff reverts D69836482
D69836482: [react-native][PR] Make `RCTLog` & `ExceptionDataHelper` internal by cortinico causes the following build failure:
Tests affected:
- [automation_twilight_x86_debug](https://www.internalfb.com/intern/test/562950071241129/)
Here's the Multisect link:
https://www.internalfb.com/multisect/21397772
Here are the tasks that are relevant to this breakage:
T215694436: Some CI signals failing for oculus_twilight
The backout may land if someone accepts it.
If this diff has been generated in error, you can Commandeer and Abandon it.
bypass-github-export-checks
Reviewed By: cortinico
Differential Revision: D69860031
fbshipit-source-id: dedaba77f77467eebad279076add13bfcde45ef0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49478
changelog: [internal]
Move all main thread resources that RCTDeviceInfo needs to RCTKeyWindowValuesProxy class. That way, RCTDeviceInfo does not needs to use RCTUnsafeExecuteOnMainQueueSync and doesn't require main thread setup.
Reviewed By: javache
Differential Revision: D69747829
fbshipit-source-id: e8280d2f50258ee59043b5c3865b8a95496be8b6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49518
`react-native/community-cli-plugin` depends on `createDevServerMiddleware` from `react-native-community/cli-server-api`.
`react-native/community-cli-plugin` currently [declares an optional peer dependency](https://github.com/facebook/react-native/blob/bae895500052bda2f55e1832b0c8a63a1b449de3/packages/community-cli-plugin/package.json#L39-L45) on `react-native-community/cli-server-api`, however because the latter isn't a dependency of `react-native` or the community template, the peer dependency is not available to package managers that enforce isolated node_modules - see https://github.com/facebook/react-native/issues/47309.
Rather than add an unnecessary dependency to the template (like [this](https://github.com/react-native-community/template/pull/105)), my proposal is to switch to a peer dependency on only `react-native-community/cli`, because that *is* a dependency of the community template and therefore will be resolvable.
Because `react-native-community/cli` doesn't re-export `createDevServerMiddleware` from its dependency on `cli-server-api`, we need to resolve the latter through the former. This can be cleaned up once a re-export lands - https://github.com/react-native-community/cli/pull/2605.
Changelog:
[GENERAL][FIXED] Fix registering of `start` and `bundle` commands with community CLI and isolated node_modules.
Reviewed By: huntie
Differential Revision: D69848688
fbshipit-source-id: 009b8ffd43b2ab2d84fcc71e9e48382eb8950bb1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49526
Changelog: [Internal]
Introduce a binary tester for Fantom that will be used in runner when ready so OSS can run integration tests.
Here:
- Add BUCK target
- Add CMake target
Reviewed By: cortinico
Differential Revision: D69800975
fbshipit-source-id: 57e135e2a1cbfb88e0141ddc7859b9a29365ee1f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49499
Changelog:
[General][Internal] - warn when user tries to open DevTools, when not in debug mode
Reviewed By: huntie
Differential Revision: D69784836
fbshipit-source-id: aa60762f08f5dea1f91f4fd1ffc86eeb7f94e2fc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49520
changelog: [internal]
Adds a new callback to EventBeat that is triggered in EventBeat::induce (that is when the UI thread is about to go IDLE). This will make state updates applied synchronously before the OS has a chance to paint but they will be batched. If two state updates happen in single UI tick, the will be executed at the end of UI's run loop.
The state updates are still not batched into a single commit. If two state updates happen on the same component, they are coalesced. If two state updates happen on two different components, they will generate two transactions. This is a follow up optimisation.
This feature is hidden behind `ReactNativeFeatureFlags::enableSynchronousStateUpdates` which is a preexisting feature flag. The feature flag was not rolled out yet and is not being used in any QEs at the moment.
Reviewed By: rubennorte
Differential Revision: D69848997
fbshipit-source-id: 870fd21f1d9d73d84861ddeac95b932a7fe1f5fe
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49492
Was looking at more places we could be using `HybridClassBase`, and figured out how to simplify ReadableMapBuffer constructors to remove the need for explicit soloading.
Changelog: [Android][Removed] `RuntimeExecutor` and `RuntimeScheduler` constructors are now private, `MapBufferSoLoader` was removed as no longer required.
Reviewed By: cortinico
Differential Revision: D69776110
fbshipit-source-id: 11eac4c59897a02283e021ac1457ef8299b6f480
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49474
changelog: [internal]
Can move setup to the background setup:
1. Use RCTTraitCollectionProxy to access current trait collection to check if force touch is available.
2. UIDevice.currentDevice is thread safe and can be read safely from a background thread.
Reviewed By: rshest
Differential Revision: D69744257
fbshipit-source-id: 8857a827c3d3e03a9b2ced15e6970d728693a043
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49473
changelog: [internal]
Add RCTTraitCollectionProxy which synchronises access to current trait collection. This way, RCTAppearance does not need main thread setup and RCTUnsafeExecuteOnMainQueueSync
Reviewed By: javache
Differential Revision: D69750211
fbshipit-source-id: 8457904fa1672d4bf811c04ef69969a8f8f4d87f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49475
changelog: [internal]
RCTNetworking does not need main thread setup, it doesn't access any main thread only resources.
Reviewed By: rshest
Differential Revision: D69744400
fbshipit-source-id: 25652c28d178a9e26fa0ede9b03fb87072094fb0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49500
changelog: [internal]
When crossing ScrollView boundary, cullingContext.transform must be reset to Transform.identity. Views are only culled within scroll view.
Reviewed By: NickGerleman
Differential Revision: D69787820
fbshipit-source-id: 5d502f764a2b1885ee4b49fc0c9ebb9d27de65dd
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49418
This adds some missing validation for negative blurs which should be considered parse error. Unit tests added for the forked props parsing code to validate more generally.
Changelog: [Internal]
Reviewed By: joevilches
Differential Revision: D69628917
fbshipit-source-id: 1451b53cfa673443f01d38bd0097c4e85c83db8b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49505
I want to go home 😭.
This is not very pretty, while we are both keeping the old path, and trying to keep the props data types undisturbed for now, and support some of the stranger syntax we ended up supporting as inputs to filters.
Changelog: [Internal]
Reviewed By: joevilches
Differential Revision: D69562718
fbshipit-source-id: db8ff2c240b66e93a52ce2ac98e4a9ff2e7aeb4b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49503
Relanding this change, now checking for the existing of FeatureFlags native module before checking it, with the assumption when the native module is unavailable (legacy arch) we will never do native processing, or even use the SVC.
This aligns with the approach taken in `setupTimers` for the event loop, but is probably not the right long term solution for flags API.
This also inlines a couple fixes originally up the stack, of missing propagation of inline state, and missing the gating in ReactNativeStyleAttributes.
Changelog: [Internal]
Reviewed By: joevilches
Differential Revision: D69804412
fbshipit-source-id: 1f285994132cff75b6845b64cf26fceae37d4c92
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49448
I noticed that when inset shadows have a smaller blur radius than spread its wrong and there is a gap between the edge of the box and the shadow. I think the outer rect is just defined incorrectly and we should be adjusting the paddingBox as opposed to the innerRect. The innerRect is just the padding box insetted by the spread, so that is why we see gaps if blur < spread
Changelog: [Android][Fixed] - Fix inset boxShadow when blur < spread
Reviewed By: jorge-cab
Differential Revision: D69688508
fbshipit-source-id: 911258edd9a8403c70992800c3e1a5ea044e1f3b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49463
We've started accumulating mode-files in many different directories, group them all under xplat/mode/react-native for consistency
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D69658995
fbshipit-source-id: 70c842d24886b9b0ef8432d105ca64cac68078db
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49484
This is the last diff to add support for Gradle Configuration caching.
The last missing part here was the execution of the `config` command during Gradle configuration time.
Using Java processes API is not supported as the correct way to do external commands that are CC-friendly
is through the `.providers.exec` API which I'm using here.
Closes https://github.com/facebook/react-native/issues/45154
Changelog:
[Android] [Added] - Add support for Gradle Configuration caching
Reviewed By: cipolleschi
Differential Revision: D69753889
fbshipit-source-id: af1e844b38444659a908abce4029d43ad899c03d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49491
Changelog: [General][Breaking] Deep imports to modules inside `Libraries/DevMenu` using `require` may need to be appended with `.default`
Reviewed By: cortinico
Differential Revision: D69778671
fbshipit-source-id: 19362fbb003e53609881fc19e8d2cb96677b3006
Summary:
Currently we observed many iOS app crashes caused by the `[RCTFileRequestHanlder invalidate]` method, just as the below screenshot.
<img width="1008" alt="image" src="https://github.com/user-attachments/assets/d2d6714f-63d9-40ae-8de5-742cfe718a36" />
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[IOS] [FIXED] - app crash caused by the `[RCTFileRequestHanlder invalidate]` method
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [FIXED] - app crash caused by the `[RCTFileRequestHanlder invalidate]` method
Pull Request resolved: https://github.com/facebook/react-native/pull/48350
Test Plan: I am not able to reproduce this issue locally either, so the changes in this PR are totally from my inference, I am not sure if it really makes sense, so please help take a deeper look, thanks.
Reviewed By: javache
Differential Revision: D69751695
Pulled By: cipolleschi
fbshipit-source-id: aa4654a30f5dfac99b72ed1bda0dae1e0dc881c9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49479
changelog: [internal]
Notification UIApplicationDidBecomeActiveNotification is always delivered on the main thread, no need for dispatch.
Reviewed By: javache
Differential Revision: D69750103
fbshipit-source-id: 070fa7f95d8ecddff5d56ba317c8ed4f0ad880f8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49470
Adds a `packages/react-native/index.js.flow` file.
**Motivation**
This is on the critical path to generating TypeScript types, and a full API snapshot, from `index.js.flow`.
As we iterate, this new file will move to closely matching `types/index.d.ts` by adding type exports (missing today) — giving us an equivalent public API in both languages.
**Motivation for this pattern**
Having a type index file:
- Will become the entry point for `yarn build-types`.
- Enables us to bypass the `module.exports` pattern in `index.js` without a runtime breaking change.
- This pattern is preferable because:
- 1/ Aligns with existing manual TypeScript definitions (i.e. these are **already restricted** to `import` syntax in user code)
- 2/ Allows doc comments on original types to propagate to IDEs/users.
**Implementation notes**
NOTE: This diff has **no effect** on compiled code at runtime, and **no effect** on the current manual TypeScript API of `react-native`. It only has an effect on Flow usage in fbsource — most of which are deep type imports today.
- Exports are grouped and sorted identically to each pre-existing getter in `index.js`.
Changelog: [Internal] - Redefine root `react-native` type exports, affecting Flow usages only
Reviewed By: rubennorte
Differential Revision: D69659837
fbshipit-source-id: c65e30d1ac5c4f322cfde9335dbee80a8c9efda8
Summary:
ref: https://github.com/facebook/react-native/pull/28266
Currently, SVG is not recognized as an image in the CLI bundle command, as defined in [assetPathUtils.js](https://github.com/facebook/react-native/blob/main/packages/community-cli-plugin/src/commands/bundle/assetPathUtils.js#L43-L50) . This is the correct behavior, as it ensures that SVG files are copied to the raw folder for Android resources.
However, there is an inconsistency with Image.resolveAssetSource, which does not follow the same classification. Instead, it resolves SVG assets to the drawable folder, leading to blank svg rendering errors in some scenario (codepush).
## Changelog
[Android][Fixed] - getAndroidResourceFolderName() should return raw folder for svg file
Pull Request resolved: https://github.com/facebook/react-native/pull/49452
Test Plan:
1. Use svg file this way `<LocalSvg asset={require('./react-logo.svg')} />`
2. Use `react-native bundle` command to make a bundle and sideload that bundle from sdcard. The svg file should render correctly.
Reviewed By: cortinico
Differential Revision: D69750779
Pulled By: Abbondanzo
fbshipit-source-id: 3af8d4a5da07213cdbb968b070d2507ed897d194
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49370
# Changelog: [Internal]
When we start tracing, we will record metadata event for current process.
We will base it off the assumption that the thread where we handle `Tracing.start` event is the main one.
We can't register the main thread yet:
1. We can't assume that CDP messages are handled on it - this is not the case for Windows and in a long term Inspector will be moved to its own thread
2. We don't have any similar mechanism as Runtime Executor, but for Main thread. This will require Host providing an executor for it.
I've validated at the top of the stack that not registering the main thread should not affect how trace is displayed in CDT.
Reviewed By: rozele
Differential Revision: D69465926
fbshipit-source-id: 103de1da9d00564bf201456ad04a465387c1d542
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49083
# Changelog: [Internal]
> NOTE: Some CI jobs are expected to fail, because changes in Hermes D67353585 should be landed first, and then grafted to Static Hermes.
Added 2 new public methods to `PerformanceTracer` instance for registering metadata Trace Events for processes and threads.
Reviewed By: huntie
Differential Revision: D68439733
fbshipit-source-id: dd9f0e72e2414b8c665c57a542cbbfe7df34a516
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49309
# Changelog: [Internal]
Use newly added module to get real OS-level process and thread ids.
We will keep process id on an instance, because I don't think it could change over time? For thread id, we will get it at the time of event registration.
Reviewed By: rozele
Differential Revision: D69316094
fbshipit-source-id: e12f2ea147ee8bf5a0a13ef293b8d85a0b64fc02