Commit Graph

38536 Commits

Author SHA1 Message Date
Liron Yahdav 5e63f34ab0 Throw exception with name of TurboModule instead of deadlock during sync rendering (#49509)
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
2025-02-19 18:45:23 -08:00
Marc Rousavy 778382ad3d RNGP - Add option to disable bundle compression (was: Make all React Native apps start 12% faster) (#49449)
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
2025-02-19 18:42:51 -08:00
Eric Rozell 41b597c736 Move U+200E character to first fragment (#49534)
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
2025-02-19 17:41:35 -08:00
Nicola Corti fc325cfee8 Remove all the redundant public visibility modifier (#49532)
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
2025-02-19 17:40:14 -08:00
Nicola Corti fefa17aa37 Sort kotlin modifier to canonical order (#49533)
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
2025-02-19 17:40:14 -08:00
Shawn Dempsey 19c41f1dbd Use apple platform name for macOS instead of hardcoding iOS (#49542)
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
2025-02-19 17:24:17 -08:00
Samuel Susla 46ce79b08a move RCTInitializeUIKitProxies to RCTFabricSurface init (#49541)
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
2025-02-19 15:24:41 -08:00
Mateo Guzmán e137a5280f Reland of: Make RCTLog & ExceptionDataHelper internal (#49536)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49536

This is a re-land of a previous diff D69836482 which was reverted due to a build failure.

As part of the initiative to reduce the public API surface, this classes can be internalized. I've checked there are no relevant OSS usages:

- [RCTLog](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+com.facebook.react.util.RCTLog)
- [ExceptionDataHelper](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+com.facebook.react.util.ExceptionDataHelper)

## Changelog:

[INTERNAL] - Make RCTLog & ExceptionDataHelper internal

Pull Request resolved: https://github.com/facebook/react-native/pull/49502

Test Plan:
```bash
yarn test-android
yarn android
```

Reviewed By: mdvacca

Differential Revision: D69863875

Pulled By: cortinico

fbshipit-source-id: 59f0ccbcbeba6e75b776d3bb8fd7c672f1b50994
2025-02-19 15:15:10 -08:00
chrsmys 36f29beac4 Fix force RTL support on new architecture. (#49455)
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
2025-02-19 14:51:19 -08:00
Samuel Susla d50a3b4433 do not call RCTUnsafeExecuteOnMainQueueSync with a lock in RCTWindowSafeAreaProxy (#49540)
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
2025-02-19 14:47:18 -08:00
Dark Knight a1952b6fb7 Revert D69836482: Multisect successfully blamed "D69836482: [react-native][PR] Make RCTLog & ExceptionDataHelper internal" for one build failure
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
2025-02-19 11:47:35 -08:00
Mateo Guzmán 0c1e9ea983 Make DefaultDevSupportManagerFactory, InspectorFlags & JSDebuggerWebSocketClient internal (#49506)
Summary:
As part of the initiative to reduce the public API surface, this classes can be internalized. I've checked there are no relevant OSS usages:

- [DefaultDevSupportManagerFactory](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+com.facebook.react.devsupport.DefaultDevSupportManagerFactory)
- [InspectorFlags](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+com.facebook.react.devsupport.InspectorFlags)
- [JSDebuggerWebSocketClient](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+com.facebook.react.devsupport.JSDebuggerWebSocketClient)

## Changelog:

[INTERNAL] - Make DefaultDevSupportManagerFactory, InspectorFlags & JSDebuggerWebSocketClient internal

Pull Request resolved: https://github.com/facebook/react-native/pull/49506

Test Plan:
```sh
yarn test-android
yarn android
```

Reviewed By: cortinico

Differential Revision: D69811993

Pulled By: mdvacca

fbshipit-source-id: fef52de8c9c0d15b8efd3c5dd785be4e045d2d63
2025-02-19 11:32:31 -08:00
Samuel Susla 470bc40889 remove use of RCTUnsafeExecuteOnMainQueueSync and main thread setup from RCTDeviceInfo (#49478)
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
2025-02-19 10:29:24 -08:00
Samuel Susla c5b926b57b move RCTAccessibilityManager away from main thread initialization (#49477)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49477

changelog: [internal]

Move all main thread resources from RCTAccessibilityManager to a proxy object: RCTInitialAccessibilityValuesProxy

Reviewed By: javache

Differential Revision: D69747648

fbshipit-source-id: 5ac717b397985545c5ce2cc92ad98d69b95f52ea
2025-02-19 10:29:24 -08:00
Rob Hogan cdaa1aa9aa community-cli-plugin: resolve cli-server-api via peer dependency on cli (#49518)
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
2025-02-19 10:11:03 -08:00
Samuel Susla 0f8ef32830 initialise RN proxy object in bridge (#49527)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49527

changelog: [internal]

fix a deadlock when app that doesn't use bridgeless uses UIKit proxy objects.

Reviewed By: jeffreyporter, Dawn-Top

Differential Revision: D69855097

fbshipit-source-id: a158daa2a6de1a0aebfb9fbf3d758ffa3afec7be
2025-02-19 09:29:26 -08:00
Andrew Datsenko e85d70c8ac Create a CMake executable target (#49526)
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
2025-02-19 09:15:07 -08:00
Dawid Małecki 3f9e474d23 Align Flow to TS types in Modal (#49521)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49521

Changelog:
[Internal] - Aligned types of the Modal between Flow and iOS

Reviewed By: huntie

Differential Revision: D69786560

fbshipit-source-id: 3bf0999db5ad57a1b9b9dd95f2b77c994fe3af6e
2025-02-19 09:12:45 -08:00
Vitali Zaidman 1a9ec07477 warn when user tries to open DevTools, when not in debug mode (#49499)
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
2025-02-19 08:52:05 -08:00
Mateo Guzmán 4bafd4734e Migrate ViewManagerResolver & UIManagerModuleListener to Kotlin (#49501)
Summary:
Migrate two more `com.facebook.react.uimanager` interfaces to Kotlin

## Changelog:

[INTERNAL] - Migrate ViewManagerResolver & UIManagerModuleListener to Kotlin

Pull Request resolved: https://github.com/facebook/react-native/pull/49501

Test Plan:
```bash
yarn test-android
yarn android
```

Reviewed By: rshest

Differential Revision: D69836273

Pulled By: cortinico

fbshipit-source-id: cbdddc1ecf432127426fc07a9df6ed824db63e73
2025-02-19 07:30:31 -08:00
Samuel Susla 236db59a26 Introduce EventBeat::unstable_setInduceCallback to batch sync state updates (#49520)
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
2025-02-19 07:10:22 -08:00
Mateo Guzmán e5f08c7ae0 Make RCTLog & ExceptionDataHelper internal (#49502)
Summary:
As part of the initiative to reduce the public API surface, this classes can be internalized. I've checked there are no relevant OSS usages:

- [RCTLog](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+com.facebook.react.util.RCTLog)
- [ExceptionDataHelper](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+com.facebook.react.util.ExceptionDataHelper)

## Changelog:

[INTERNAL] - Make RCTLog & ExceptionDataHelper internal

Pull Request resolved: https://github.com/facebook/react-native/pull/49502

Test Plan:
```bash
yarn test-android
yarn android
```

Reviewed By: rshest

Differential Revision: D69836482

Pulled By: cortinico

fbshipit-source-id: 16f37acbd77bf151126bff22a6010201d8174bea
2025-02-19 06:56:03 -08:00
Riccardo Cipolleschi 864d47822f Handle configurations and destinations in prepare-ios-prebuilds (#49498)
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
2025-02-19 06:19:48 -08:00
Pieter De Baets 6c8ace9b05 Simplify MapBuffer constructor (#49492)
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
2025-02-19 06:11:31 -08:00
Iwo Plaza ee90f2d97f Prefer common interface files when building the type graph (#49494)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49494

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D69786939

fbshipit-source-id: 3b0481e83a528afbdf1d29734d2aea9cad740f58
2025-02-19 06:00:03 -08:00
Samuel Susla f4927fc03c migrate RCTAppState away from main thread initialization (#49476)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49476

changelog: [internal]

Introduce RCTInitialAppStateProxy to access app initial state in thread safe way.

Reviewed By: javache

Differential Revision: D69745459

fbshipit-source-id: f88a04774e064bf13904183aa3334f93cbcc5283
2025-02-19 05:37:54 -08:00
Samuel Susla 0e540298ae remove requirement for main queue setup for RCTPlatform (#49474)
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
2025-02-19 05:37:54 -08:00
Samuel Susla 29114dd914 migrate RCTAppearance away from RCTUnsafeExecuteOnMainQueueSync and main thread setup (#49473)
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
2025-02-19 05:37:54 -08:00
Riccardo Cipolleschi 11377d7cb6 Update changelog for 0.78 (#49469)
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
2025-02-19 05:22:30 -08:00
Riccardo Cipolleschi 601b2ec353 Honor the task provided to prepare-ios-prebuilds (#49497)
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
2025-02-19 04:59:37 -08:00
Riccardo Cipolleschi ca37f2b20a Add argument parsing and help function to prepare ios build (#49496)
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
2025-02-19 04:59:37 -08:00
Riccardo Cipolleschi c0e43edd01 Extracted the dependencies array to separate file (#49495)
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
2025-02-19 04:59:37 -08:00
Jakub Piasecki bae8955000 Align press and scroll events with OSS (#49424)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49424

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D69655561

fbshipit-source-id: c36036a2abb43dd75c41582f2a27e7f9d3509044
2025-02-19 03:43:07 -08:00
Samuel Susla 1705f96322 RCTNetworking does not require main thread setup (#49475)
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
2025-02-19 03:37:26 -08:00
Samuel Susla d69874fa31 reset transformation when crossing ScrollView in Fabric View Culling (#49500)
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
2025-02-19 03:20:02 -08:00
Nick Gerleman 4fa516987c Filter and Box Shadow Conversion Tests and Fixes (#49418)
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
2025-02-18 18:56:12 -08:00
Nick Gerleman 05856b4681 Wire up native filter parsing (#49505)
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
2025-02-18 18:56:12 -08:00
Nick Gerleman b91565dc5d Add box shadow examples which use objects and PlatformColor (#49504)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49504

We didn't have these cases before.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D69433955

fbshipit-source-id: 3915b63ec6972412f1882d796ae60035bb5192f3
2025-02-18 18:56:12 -08:00
Nick Gerleman 8a2602fd69 Reland 2: Wire up native box shadow parsing (#49503)
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
2025-02-18 18:56:12 -08:00
Sam Zhou b53e86b4bd Deploy 0.261.2 to xplat
Summary: Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D69816782

fbshipit-source-id: c4d1e7bff3333fe8075816542d0b316408363f86
2025-02-18 18:11:49 -08:00
David Vacca 3442b3885a Implement getDelegateMethod on ReactPopupMenuManager (#49507)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49507

Implement getDelegateMethod on ReactPopupMenuManager

changelog: [internal] internal

Reviewed By: shwanton

Differential Revision: D69807880

fbshipit-source-id: b0168454b24a1af4e99a46e8c70ebb70162c19d0
2025-02-18 16:43:13 -08:00
Joe Vilches a3b29e1441 Fix inset shadows when blur < spread (#49448)
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
2025-02-18 13:11:53 -08:00
Samuel Susla 7f6fe61299 migrate RCTSafeArea away from RCTUnsafeExecuteOnMainQueueSync (#49440)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49440

changelog: [internal]

move away from RCTUnsafeExecuteOnMainQueueSync in RCTSafeArea.

Reviewed By: javache, lenaic

Differential Revision: D69662510

fbshipit-source-id: c68e42d6787b1a60ecba46d774ada40163de83fe
2025-02-18 10:05:42 -08:00
Pieter De Baets 1954f166c9 Consolidate mode files in xplat/mode/react-native (#49463)
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
2025-02-18 09:40:15 -08:00
Dawid Małecki 8beae3ba52 Align types of the Libraries/PushNotificationIOS between Flow and TS (#49266)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49266

Changelog:
[Internal] - Aligned types of the PushNotificationIOS between Flow and TS

Reviewed By: huntie

Differential Revision: D69309391

fbshipit-source-id: 1e99f6aa6805c25db7ede6c65305b309590ebd6a
2025-02-18 09:03:55 -08:00
Nicola Corti e41887e62f Add support for Gradle Configuration caching (#49484)
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
2025-02-18 08:26:34 -08:00
Nicola Corti db679f7a20 Remove unused Gradle task packageReactNdkLibsForBuck (#49493)
Summary:
This task is unused, so we can safely remove it here.

## Changelog:

[INTERNAL] - Remove unused Gradle task `packageReactNdkLibsForBuck`

Pull Request resolved: https://github.com/facebook/react-native/pull/49493

Test Plan: N/A

Reviewed By: cipolleschi

Differential Revision: D69781945

Pulled By: cortinico

fbshipit-source-id: cd6487faf1d169f44590a26c18a9f35eef803617
2025-02-18 08:23:59 -08:00
Jakub Piasecki ce84922236 Convert DevMenu to use exports syntax (#49491)
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
2025-02-18 08:18:58 -08:00
Mateo Guzmán 7f1edbdcb5 Migrate ReactClippingViewGroup to Kotlin (#49413)
Summary:
Migrate com.facebook.react.uimanager.ReactClippingViewGroup to Kotlin

## Changelog:

[INTERNAL] - Migrate com.facebook.react.uimanager.ReactClippingViewGroup to Kotlin

Pull Request resolved: https://github.com/facebook/react-native/pull/49413

Test Plan:
```bash
yarn test-android
yarn android
```

Reviewed By: rshest

Differential Revision: D69750532

Pulled By: cortinico

fbshipit-source-id: 50ec87a71b3bd523e1a9518b8bd683a027a4b422
2025-02-18 07:57:24 -08:00
Iwo Plaza e4e03bd909 Trace the import path that leads to an untranslatable file (#49480)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49480

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D69752685

fbshipit-source-id: 94f70eeaec35c864c15b463f3afce929765f2c40
2025-02-18 07:37:57 -08:00