Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49509
Currently if we hit a deadlock in sync rendering due to a TurboModule initialization that requires main queue setup we don't get any information about which TurboModule caused the issue.
To help us know which TurboModules we need to fix, this instead will crash with the name of the TurboModule.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D69805065
fbshipit-source-id: f75df44f9a603a5f53a008382d32b2b5285c1162
Summary:
Okay the title is a bit clickbaity, but this is actually true. (on Android)
We (Janic, Szymon, Ruby and Me) discovered something interesting. React Native uses `mmap` for mapping the JS bundle to RAM, to avoid having to load the entire thing instantly at app startup.
Ruby doubted that this was true - so we investigated.
Apparently on Android, resources are **compressed**. And if the JS bundle is stored compressed, it has to be uncompressed before it can be loaded into RAM, hence not allowing it to be mmapp'ed! (see [`_CompressedAsset::getBuffer`](https://cs.android.com/android/platform/superproject/+/master:frameworks/base/libs/androidfw/Asset.cpp;l=903?q=Asset.cpp))
So with this PR, we now add `.bundle` files to `noCompress` in the react-native gradle plugin, which disables compression for the JS bundle.
We discovered while improving the performance of one of our clients: **Discord**.
In our tests, **this improved the TTI of the Discord app by 400ms!! (or 12%)** 🤯🚀
NOTE: Yes, the .apk will now be bigger. But; Google Play compresses it anyways, so the **download size** of your .apk will likely not increase by much. It will be bigger on disk though.
## Changelog:
[ANDROID] [CHANGED] Add option to disable bundle compression to improve startup time
<!-- 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/49449
Test Plan:
### 1. Verify compression is disabled
Build two apps, one with this patch and one without. When I did this using the RN community template, the one without this patch was 47,6 MB, and the one with this patch was 48 MB in size. So the .apk got bigger, which is what we expected
### 2. Verify app startup is faster
Use tools like react-native-performance or custom markers to measure TTI. In our tests, we shaved off 400ms from the startup time, which was about 12% of Discord's total TTI. (on a low-end Android device)
In Expensify, we improved the TTI by 14-20% with this change (source: https://github.com/Expensify/App/pull/56930)
Reviewed By: javache, cipolleschi
Differential Revision: D69742221
Pulled By: cortinico
fbshipit-source-id: bd59d77662bd30a3acdbb2e9f8d8f23db922c3f2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49534
Moving the U+200E character ensures that it gets the same font style as other fragments in the LogBox inspector. This solves an issue where the line height differential is causing issues on some out-of-tree platforms (e.g., Windows).
## Changelog
[Internal]
Reviewed By: shwanton
Differential Revision: D69857916
fbshipit-source-id: 5bc70dc0282f3ef9e9b2767ab8094e9923638e99
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49532
I've done a pass with Android Studio and removed automatically all the `public` modifier
that are not really needed.
Changelog:
[Internal] [Changed] -
Reviewed By: mdvacca
Differential Revision: D69857731
fbshipit-source-id: 5098a3454a66e5f1eb58ccf07006558cba360066
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49533
Android Studio is telling us that those modifiers are not sorted according to the 'canonical order'.
This is quite annoying while editing so I'm sorthing them all using the IDE inspection.
We should add a rule inside ktfmt for this, but that's another work.
Changelog:
[Internal] [Changed] -
Reviewed By: mdvacca
Differential Revision: D69857730
fbshipit-source-id: 3aae3d5b114cf4c629c8320a697d17fff686730b
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/49498
This change handles the destinations and the configurations parameter when passed to the script.
## Changelog:
[Internal] - Handle `configuration` and `destination` parameters
Reviewed By: cortinico
Differential Revision: D69787469
fbshipit-source-id: 5c4ae766dad84640fbf5340efc296355c4944e1c
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/49469
This PR updates the changelog for 0.78 by combining all the RC into 0.78.0 stable, in preparation of the release in a couple of days.
This also adds categories to the commits and sort them alphabetically.
## Changelog:
[Internal] - Update vchangelog for 0.78
Reviewed By: cortinico, fabriziocucci
Differential Revision: D69745703
fbshipit-source-id: 825190c7a9573939ec7f1e388448142f8a8caf25
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49497
This change honors the task provided as an argument.
If `all` is passed, we execute all the commands.
If a specific task is passed, we only execute that command.
## Changelog:
[Internal] - Honor the task passed to the preopare-ios-script
Reviewed By: cortinico
Differential Revision: D69787470
fbshipit-source-id: 0dec13ad0b5f2cc23cc72b4a899405ac1acf4f86
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49496
This change prepare the argument parsing to the prepare-ios-prebuilds so we can customise the behavior to simplify usage in CI.
It also adds the --help command to provide.
##changelog:
[Internal] - adds the help mfunction and argument parsing
Reviewed By: cortinico
Differential Revision: D69779877
fbshipit-source-id: d66bc19ee556229eb7167f2075b77bacce2ad5c4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49495
This change extracts the dependencies array to a separate file. This is helpful because we can use this file as cache-key to determines whether we have to rebuild the artifacts or not.
This file is also bound to grow so it will make the script more manageable.
## Changelog:
[Internal] - Move the dependencies for ios prebuilds on a separate file
Reviewed By: cortinico
Differential Revision: D69779522
fbshipit-source-id: 7ce60e426d428859f6f759d8e7b1ea499c36eff9
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