Compare commits

...
Author SHA1 Message Date
Rob Hogan c970986b5b [LOCAL] Update Podfile.lock
Changelog: [Internal]
2025-07-21 19:35:14 +01:00
React Native Bot 0d3a7ca52f Release 0.77.3
#publish-packages-to-npm&0.77-stable
2025-07-21 14:59:32 +00:00
Nick GerlemanandRob Hogan 8f18015a49 Fix build_android GHA Job (#52694)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52694

build_android job is always failing, with this assertion. Seems like find/replace in D78484060 gone wrong?

Changelog: [Internal]

Reviewed By: sbuggay

Differential Revision: D78534334

fbshipit-source-id: 291bdd01b41fa6efea00ed63a0dee8bdb14cbc3a
2025-07-21 13:56:47 +01:00
Rob Hogan 2412da9b7b Revert "Fix Windows path expectation in OsTest.kt"
This reverts commit f2b846fcc4.
2025-07-21 13:56:41 +01:00
Rob Hogan f2b846fcc4 Fix Windows path expectation in OsTest.kt 2025-07-21 13:52:56 +01:00
Riccardo CipolleschiandRob Hogan 906468faeb [RN][CI]Fix Windows CI 2025-07-21 11:54:09 +01:00
Nicola CortiandRob Hogan 710d499f13 Fix Modal first frame being rendered on top-left corner (#51048)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51048

Fixes https://github.com/facebook/react-native/issues/50442
Closes https://github.com/facebook/react-native/pull/50704

Users reported that Modals on Android are first renderer anchored in 0,0.
That results in them being on the top left corner of the screen for some seconds.

This is happening because the native state of the Modal on Android as width/height set at 0,0 - which we then update in a subsequent callback.

I'm fixing this by making sure we render the Modal the first time with the right screen size - the status bar size

Changelog:
[Android] [Fixed] - Fix Modal first frame being rendered on top-left corner

Reviewed By: javache

Differential Revision: D73948178

fbshipit-source-id: 055c12aa62d70acc1e4c5a2a5c4ea0c5608e22c7
2025-07-17 16:58:20 +01:00
Rob HoganandGitHub c43952ac22 [LOCAL] Backout #46896 - Attempt to fix #50274 (#52515) 2025-07-09 17:57:14 +01:00
Rob HoganandGitHub dfa81638dd [LOCAL] Bump Metro minimum ^0.81.3 -> ^0.81.5 (#52504) 2025-07-09 12:04:47 +01:00
Nicola Corti 89eff977c7 RNGP - Add support for exclusiveEnterpriseRepository (#52378)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52378

This adds a Gradle property called `exclusiveEnterpriseRepository`
that users can set in their `android/gradle.properties` as such:

```diff
hermesEnabled=true

+exclusiveEnterpriseRepository=https://my.internal.proxy.net/
```

This will remove all the existing Maven repositories and only use the internal mirror they have.

Changelog:
[Android] [Added] - RNGP - Add support for `exclusiveEnterpriseRepository` to specify an internal Maven mirror.

Reviewed By: mdvacca

Differential Revision: D77667573

fbshipit-source-id: 835004d2ae7aa4e250b6f7a88a41918b573f5bd5
2025-07-03 13:32:01 +01:00
Ritesh ShuklaandNicola Corti 04fffa556d Fixed borderBottomEndRadius on RTL (#51229)
Summary:
Fixes https://github.com/facebook/react-native/issues/51193
[ANDROID][FIXED] Wrong borderBottomEndRadius on RTL

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

Test Plan:
Tested with Arabic (RTL) and English(LTR)

English
<img src="https://github.com/user-attachments/assets/5bd1eca9-194c-4d83-b75f-689bc13d827b" width=200>

Arabic
<img src="https://github.com/user-attachments/assets/459320a0-6bb2-4585-97bb-bd4ded6ec399" width=200>

Reviewed By: cortinico

Differential Revision: D74709219

Pulled By: NickGerleman

fbshipit-source-id: 885bb84d97d73324983d044fd2874a457b40f646
2025-07-01 15:04:42 +01:00
Rubén NorteandNicola Corti b47a1b0f4e Avoid errors when dispatching mount operations within mount hooks (#50091)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50091

Changelog: [internal]

If a library uses mount hooks to perform mount operations, it's possible to get concurrent modifications of the list of pending surface IDs to report.

This fixes that potential error by making a copy of the list before dispatching the mount notifications.

Fixes https://github.com/facebook/react-native/issues/49783.

Reviewed By: javache

Differential Revision: D71387739

fbshipit-source-id: 96c723ef2d6bcc659c4452434b7a4d5af26117ef
2025-07-01 15:00:09 +01:00
zhongwuzwandReact Native Bot 3e09e59912 Fabric: Fixes Modal snapshot when closing it (#48252)
Summary:
Fixes https://github.com/facebook/react-native/issues/48245 . The reason is we reuse the modal component and also reuse the snapshot of previous modal.

## Changelog:

[IOS] [FIXED] - Fabric: Fixes Modal snapshot when closing it

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

Test Plan: Repro repo please see Fixes https://github.com/facebook/react-native/issues/48245

Reviewed By: rshest

Differential Revision: D70629570

Pulled By: cipolleschi

fbshipit-source-id: fe97184d2f27283a9c7e6df09e9df35630429ff1
2025-07-01 13:52:46 +00:00
zhongwuzwandReact Native Bot 4ec5e99a72 iOS: Fixes Switch component incorrectly renders as toggled on even though value prop is hardcoded to false (#50049)
Summary:
Fixes https://github.com/facebook/react-native/issues/50026

## Changelog:

[IOS] [FIXED] - [Fabric] iOS: Fixes Switch component incorrectly renders as toggled on even though value prop is hardcoded to false

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

Test Plan: Repro please see https://github.com/facebook/react-native/issues/50026.

Reviewed By: javache

Differential Revision: D71307864

Pulled By: cipolleschi

fbshipit-source-id: 57238296842229cf2f23a3f44134f43e27b54609
2025-07-01 13:51:44 +00:00
Rubén NorteandReact Native Bot 2c2c0729a8 Correctly batch reportMount calls (#50090)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50090

Changelog: [internal]

I refactored `FabricUIManager` in D54547194 / https://github.com/facebook/react-native/pull/43337 and accidentally removed setting this flag to avoid scheduling redundant tasks in the UI thread to report mount. This fixes it.

Reviewed By: javache

Differential Revision: D71387374

fbshipit-source-id: cad8a3ead2434738325560902cbab817e5d5dde7
2025-07-01 13:50:30 +00:00
Christian FalchandReact Native Bot ab385592c0 fix adding children (#51213)
Summary:
See https://github.com/facebook/react-native/issues/51212 - children aren't updated correctly in an old arch native view using the interop layer under Fabric.

This is caused by the mountChildComponentView method not updating the view, only adding the new view to a list that will be used on the next update to mount the child.

This commit fixes this by adding the same pattern as in unmountChildComponentView where children are inserted directly if the underlying paperview is available in the adapter - otherwise it uses the mounting list as before.

#Closes 51212

bypass-github-export-checks

## Changelog:

[IOS] [FIXED] - fixed adding child views to a native view using the interop layer

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

Test Plan:
**Previous output**:

<image src="https://github.com/user-attachments/assets/472b95e7-0921-46c9-be6a-f31759c0cd26" width="200px" />

**After fix**:

<image src="https://github.com/user-attachments/assets/554387cd-c264-483e-9c52-d9cd40b42601" width="200px" />

Reviewed By: sammy-SC

Differential Revision: D74471278

Pulled By: cipolleschi

fbshipit-source-id: 798f9e7be389359bd6e3aa1b6a6e9fb799fcb369
2025-07-01 13:48:26 +00:00
Phil PluckthunandReact Native Bot 26b70c2e40 fix: Align TimerManager sequential ids and function error handling with web standard (#51500)
Summary:
Calls to create timers should return sequential ids (integers greater than zero in the spec's words). This regressed in the `TimerManager` implementation, which instead starts at zero inclusively.

This has two side-effects for code assuming a spec-compliant implementation of `setTimeout` and `setInterval`:
- Calls to `clearTimeout(0)` or `clearInterval(0)` will potentially cancel scheduled timers, although it's supposed to be a noop
- Predicates like `if (timeoutId)` will fail since they assume non-negative ids

The change in this PR is to align with WHATWG HTML 8.6.2 (Timers): https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers

> otherwise, let id be an [implementation-defined](https://infra.spec.whatwg.org/#implementation-defined) integer that is **greater than zero** and does not already [exist](https://infra.spec.whatwg.org/#map-exists) in global's [map of setTimeout and setInterval IDs](https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#map-of-settimeout-and-setinterval-ids).

Specifically,
- we should return `0` to indicate that no timer was scheduled
- we should start generating timer IDs at `1` instead of `0`

This was previously raised in review comments here: https://github.com/facebook/react-native/pull/45092/files#r1650790008

The spec-incompliant behaviour was raised in an issue here: https://github.com/apollographql/apollo-client/issues/12632#issue-3075269978

This PR does not,
- add bounds checking on `timerIndex_` and add a search of an available id that isn't in the unordered map
- exclude `0` from being an accepted `TimerHandle` in `TimerManager::createTimer` or `TimerManager::deleteTimer` since the above bounds checking hasn't been added either

## Changelog:

[GENERAL] [FIXED] - Align timer IDs and timer function argument error handling with web standards.

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

Test Plan:
- Run `setTimeout` / `setInterval`; before applied changes the timeout for the first timer will be `0`
- Run `setTimeout(null)`; before applied changes the timer ID will be non-zero
- Run `setInterval(null)`; before applied changes an error will be thrown rather than `0` being returned

Reviewed By: cipolleschi

Differential Revision: D75145909

Pulled By: rshest

fbshipit-source-id: 6646439abd29cf3cfa9e5cf0a57448e3b7cd1b48
2025-07-01 13:46:44 +00:00
Rob HoganandReact Native Bot db4a5cc860 Fix "paused on debugger" overlay icon (#48736)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48736

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

This icon was broken by D65457771, identified in [OSS testing for the 0.77 release](https://github.com/reactwg/react-native-releases/issues/724).

By explicitly setting the image for the `Disabled` state to the same as `Normal`, we get the same behaviour as the deprecated [`adjustsImageWhenDisabled = NO`](https://developer.apple.com/documentation/uikit/uibutton/adjustsimagewhendisabled?language=objc) without the need for `configurationUpdateHandler`.

Changelog: [iOS][Fixed] Restore "Paused in debugger" overlay icon

Reviewed By: cipolleschi

Differential Revision: D68274336

fbshipit-source-id: 3f4b84eb7cfb518ca953c721da9885df8f98b437
2025-07-01 13:38:49 +00:00
Mateo GuzmánandReact Native Bot 0750c6a91b Modal: FLAG_SECURE not respected in modal dialog (#48317)
Summary:
Fixes https://github.com/facebook/react-native/issues/38537

Setting `WindowManager.LayoutParams.FLAG_SECURE` in the window flags is not respected in the Android Modal component, causing security issues with screenshots or screen recordings as the content in the modal is visible. The flag works correctly in the rest of the components, see the videos in the linked issue.

This PR addresses that by checking whether this flag is set in the current activity and then setting it in the dialog when creating a new one in the `ReactModalHostView`.

## Changelog:

[ANDROID][FIXED] - `FLAG_SECURE` not respected in Modal dialog

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

Test Plan:
To test this, you need a physical device as with the emulator the flags don't seem to be respected either.

The easiest way to test this in code is by setting the flags in the main activity. You can do so by adding this code snippet:

<details>
<summary>onCreate in RNTesterApplication.kt</summary>

```kt
override fun onCreate() {
    ReactFontManager.getInstance().addCustomFont(this, "Rubik", R.font.rubik)
    super.onCreate()

    ...

    registerActivityLifecycleCallbacks(
            object : ActivityLifecycleCallbacks {
              override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
                activity.window.setFlags(
                        WindowManager.LayoutParams.FLAG_SECURE,
                        WindowManager.LayoutParams.FLAG_SECURE
                )
              }

              override fun onActivityStarted(activity: Activity) {}
              override fun onActivityResumed(activity: Activity) {}
              override fun onActivityPaused(activity: Activity) {}
              override fun onActivityStopped(activity: Activity) {}
              override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}
              override fun onActivityDestroyed(activity: Activity) {}
            }
    )
  }
```
</details>

Then, you can render a simple modal component:

<details>
<summary>RNTesterPlayground.js</summary>

```tsx
function Playground() {
  const [modalVisible, setModalVisible] = React.useState(false);

  return (
    <>
      <Modal
        visible={modalVisible}
        testID="playground-modal">
        <Text testID="inner-text-test-id">Hello World!</Text>
        <Button title="Close Modal" onPress={() => setModalVisible(false)} />
      </Modal>

      <Button
        title="Open Modal"
        onPress={() => {
          setModalVisible(true);
        }}
      />
    </>
  );
}
```
</details>

You can then try to record the screen or take screenshots. You will notice that before opening the modal, you won't be able to see anything in the recording, but when opening the modal, the content is visible.

I've tried my best to record the before and after the fix, but as the screen recordings will mostly show a black screen, you have to forward a bit in both videos to see the difference.

<details>
<summary>Before the fix (notice the blank screen and then content visible)</summary>

https://github.com/user-attachments/assets/fc5bbe26-d238-425b-90d3-0e43c89ccaac

</details>

<details>
<summary>After the fix (notice all the screen recording is a black screen)</summary>

https://github.com/user-attachments/assets/0d6991a0-974b-45c5-8f4a-bf4718c284e6

</details>

Reviewed By: cipolleschi

Differential Revision: D67368741

Pulled By: alanleedev

fbshipit-source-id: 9f31063a9208a6df257da424bf3096bf15a5ddcb
2025-07-01 13:38:11 +00:00
chrsmysandReact Native Bot bf17c3be3a 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-07-01 13:29:50 +00:00
zhongwuzwandReact Native Bot acb4564304 Fabric: Added ScrollEndDragEvent for scrollEndDrag event (#48319)
Summary:
Fixes https://github.com/facebook/react-native/issues/42533 .

## Changelog:

[IOS] [FIXED] -  Fabric: Added ScrollEndDragEvent for scrollEndDrag event

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

Test Plan: Repro please see https://github.com/facebook/react-native/issues/42533 .

Reviewed By: javache

Differential Revision: D67517912

Pulled By: cipolleschi

fbshipit-source-id: aa1caebfb690d09a207b3ebce382eceb520009e5
2025-07-01 13:29:31 +00:00
Zhi ZhouandReact Native Bot 9469ec7466 fix: iOS app crash caused by the request operation canceling (#48350)
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
2025-07-01 13:28:59 +00:00
Riccardo CipolleschiandReact Native Bot cdbd01100b Pin cmake version to 3.31.6 (#50464)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50464

Runners in GHA has been updated by github and they now ship with CMake 4.0. (actions/runner-images#11926)

This version is not compatible with React Native, so we are pinning cmake to 3.36.1

## Changelog:
[Internal] - Pin cmake to 3.36.1

Reviewed By: cortinico

Differential Revision: D72379834

fbshipit-source-id: ab09009102118e6590f02cf57fa6f9149482f62b
2025-07-01 13:27:50 +00:00
Riccardo CipolleschiandNicola Corti 5fd25e3ebb Bump windows to latests as GH will remove windows-2019 EOM (#51798)
Summary:
As per title, GH is [removing windows-2019](https://github.com/facebook/react-native/actions/runs/15421451006/job/43403215354) at the end of the month. We need to migrate away from them.

## Changelog:
[Internal] - Bump windows runners

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

Test Plan: GHA

Reviewed By: cortinico

Differential Revision: D75946994

Pulled By: cipolleschi

fbshipit-source-id: 972b60300c918c0eae0403ed4149347a4ffa8bd0
2025-07-01 14:25:51 +01:00
Nicola Corti e30475db51 Publish, Close and Release the Maven repository during build_npm_package
Summary:
Due to us moving to central.sonatype.com for publishing, we cannot publish and release the Maven repository in 2 distinct invocations.
This consolidates all the publishing job to happen during build_npm_package

Changelog:
[Internal] [Changed] -

Reviewed By: fabriziocucci

Differential Revision: D76888543

fbshipit-source-id: 3cb0db6176ed2221a12b4f3f1f575232aa006a6c
2025-06-18 14:01:49 +01:00
Nicola Corti e7e8222ff4 Update Nightly URL for newly published versions on central.sonatype.com (#52004)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52004

This is necessary because the snapshots are now going to be published on a different repository:
central.sonatype.com.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D76596802

fbshipit-source-id: 424fb1134e41502d53b76209fba325c895c79ba8
2025-06-16 10:44:37 +01:00
Nicola Corti 9399becf4e Move React Native publishing URLs to Central Portal (#51693)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51693

This moves React Native to use the Central Portal URLs rather than the legacy OSSRH ones.
See https://github.com/gradle-nexus/publish-plugin for more context.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D75673984

fbshipit-source-id: 1de6746809eed72f232eac0c3fb4d809c2046620
2025-06-16 10:44:37 +01:00
Rob Hogan d7b2d973d1 Update Podfile.lock
Changelog: [Internal]
2025-03-25 22:13:38 +00:00
React Native Bot 7ea8af836d Release 0.77.2
#publish-packages-to-npm&0.77-stable
2025-03-25 12:46:58 +00:00
Riccardo CipolleschiandReact Native Bot 1e9f118589 Convert to JSException only NSException from sync methods (#50193)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50193

This fix makes sure that we convert to JSException only NSException thrwn by sync methods.
Currently, nothing in the stack will be capable of understanding that js error if it is triggered by an exception raised by an asyc method.

See https://github.com/reactwg/react-native-new-architecture/discussions/276 for further details

We need to cherry pick this in 0.78 and 0.79

## Changelog:
[iOS][Fixed] - Make sure the TM infra does not crash on NSException when triggered by async method

Reviewed By: fabriziocucci

Differential Revision: D71619229

fbshipit-source-id: b87aef5dd2720a2641c8da0904da651866370dc6
2025-03-24 12:47:44 +00:00
Rob HoganandGitHub b335436113 Bump minimum Metro to 0.81.3, remove import/require from always-asserted resolver conditions (#50127) 2025-03-19 13:05:06 +00:00
Riccardo CipolleschiandRob Hogan a1339673ad Handle null params in the Interop TM layer (#49873)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49873

In the old architecture, when we were passing a `null` value as a parameter in a function that accepted nullable parameter, the null value was mapped to `nil` on iOS.

After my changes in [d4236791e2](https://github.com/facebook/react-native/commit/d4236791e238a614d2fadf5c5659874d983ab029), in the New Architecture, through the interop layer, legacy modules were receiving an `NSNull` object instead of nil.

This was breaking those modules which started crashing or observing undesired behavior.

This change fixes the issue by making sure that, in those cases, a `nil` value is passed.

Note that nested objects in the old architecture were correctly receiving NSNull, so nested objects were behaving correctly already.

## Changelog:
[iOS][Fixed] - Properly pass `nil` for nullable parameters instead of `NSNull` for legacy modules

Reviewed By: javache

Differential Revision: D70723460

fbshipit-source-id: 384f48b6dbb3f54c369b31b6d2ee06069fa3591c
2025-03-19 11:10:29 +00:00
Riccardo CipolleschiandRob Hogan 4e5da2ea1d Add extra parameter to define whether codegen is invoked by lib or app (#48995)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48995

This change adds an extra parameter to the codegen script that allow our users to trigger codegen for Apps or for Libraries.

When running codegen for Apps, we have to generate some extra files that are not needed by the Libraries. This is causing issues to our library maintainers and this change will provide more flexibility in the DevX of libraries.

The default value is App, so if the new parameter is not passed, nothing will change in the current behavior.
[iOS][Added] - Add the `source` parameter to generate-codegen-artifacts to avoid generating files not needed by libraries.

Reviewed By: cortinico

Differential Revision: D68765478

fbshipit-source-id: 8030b4472ad4f5058e58b1c91089de5122a4f60a
2025-03-18 15:30:31 +00:00
Rob HoganandGitHub 1f002f9999 community-cli-plugin: resolve cli-server-api via peer dependency on cli (#50096) 2025-03-18 14:30:44 +00:00
CHOIMINSEOKandReact Native Bot f7720b35a4 Avoid NPE when touch event is triggered before SurfaceManager is initiated (#48007)
Summary:
A NPE can occur when a user touches the screen before the `SurfaceMountingManager` is initialized. Below is an example of the error log from our production service. This issue can also be reproduced using RNTester. To prevent invalid touch events during init time of rn app from causing an NPE, add a null check for SurfaceMountingManager before calling mark/sweepActiveTouchForTag.

```
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.facebook.react.fabric.mounting.SurfaceMountingManager.markActiveTouchForTag(int)' on a null object reference
       at com.facebook.react.fabric.FabricUIManager.markActiveTouchForTag(FabricUIManager.java)
       at com.facebook.react.uimanager.JSTouchDispatcher.markActiveTouchForTag(JSTouchDispatcher.java)
       at com.facebook.react.uimanager.JSTouchDispatcher.handleTouchEvent(JSTouchDispatcher.java)
       at com.facebook.react.runtime.ReactSurfaceView.dispatchJSTouchEvent(ReactSurfaceView.java)
       at com.facebook.react.ReactRootView.onInterceptTouchEvent(ReactRootView.java)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2870)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3352)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2963)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3352)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2963)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3352)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2963)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3352)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2963)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3352)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2963)
       at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:794)
       at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1967)
       at android.app.Activity.dispatchTouchEvent(Activity.java:4571)
       at com.rainist.banksalad2.feature.common.BaseActivity.dispatchTouchEvent(BaseActivity.java)
       at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:70)
       at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:752)
       at android.view.View.dispatchPointerEvent(View.java:16498)
       at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:8676)
       at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:8423)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7752)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:7809)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:7775)
       at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:7978)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:7783)
       at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:8035)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7756)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:7809)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:7775)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:7783)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7756)
       at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:11343)
       at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:11212)
       at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:11168)
       at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:11477)
       at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:337)
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.next(MessageQueue.java:335)
       at android.os.Looper.loopOnce(Looper.java:187)
       at android.os.Looper.loop(Looper.java:319)
       at android.app.ActivityThread.main(ActivityThread.java:9063)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:588)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
```
https://github.com/user-attachments/assets/e9c6ff84-c94d-4392-9042-8e635197202e

## Changelog:

[Android] [Fixed] - Avoid NPE when touch event is triggered before SurfaceManager is initiated

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

Test Plan:
I checked the crashed being fixed on RNTester.

https://github.com/user-attachments/assets/71f7e359-707a-494c-ae34-fef8d432e612

Reviewed By: cortinico

Differential Revision: D66594576

Pulled By: javache

fbshipit-source-id: b1559d94866bdb021e0374f1953684849603033c
2025-03-17 11:12:35 +00:00
zhongwuzwandReact Native Bot adc5c3afa2 Fixes TextInput crashes when any text is entered while running as iOS app on apple silicon mac (#49320)
Summary:
Fixes https://github.com/facebook/react-native/issues/48544. We can make `RCTWeakEventEmitterWrapper` to subclass `NSDictionary` that Textinput supports encode it.

System allowed classes are:
```
Allowed classes are:
 {(
    "'NSMorphology' (0x20088b6d8) [/System/Library/Frameworks/Foundation.framework]",
    "'NSString' (0x2003f4738) [/System/Library/Frameworks/Foundation.framework]",
    "'NSInflectionRule' (0x20088d348) [/System/Library/Frameworks/Foundation.framework]",
    "'UIColor' (0x2006c0520) [/System/iOSSupport/System/Library/PrivateFrameworks/UIKitCore.framework]",
    "'NSTextAttachment' (0x20042af98) [/System/Library/PrivateFrameworks/UIFoundation.framework]",
    "'NSShadow' (0x20042ae30) [/System/Library/PrivateFrameworks/UIFoundation.framework]",
    "'NSTextEncapsulation' (0x200897e50) [/System/Library/Frameworks/CoreText.framework]",
    "'NSTextAlternatives' (0x20042af70) [/System/Library/PrivateFrameworks/UIFoundation.framework]",
    "'NSFont' (0x20042a9f8) [/System/Library/PrivateFrameworks/UIFoundation.framework]",
    "'NSAttributedString' (0x2003f3838) [/System/Library/Frameworks/Foundation.framework]",
    "'NSData' (0x2003ed528) [/System/Library/Frameworks/CoreFoundation.framework]",
    "'NSURL' (0x2003ed938) [/System/Library/Frameworks/CoreFoundation.framework]",
    "'NSAdaptiveImageGlyph' (0x2008ae538) [/System/Library/PrivateFrameworks/UIFoundation.framework]",
    "'NSNumber' (0x2003f4238) [/System/Library/Frameworks/Foundation.framework]",
    "'NSParagraphStyle' (0x20042ad40) [/System/Library/PrivateFrameworks/UIFoundation.framework]",
    "'NSDictionary' (0x2003ed5a0) [/System/Library/Frameworks/CoreFoundation.framework]",
    "'UIFont' (0x20042c668) [/System/Library/PrivateFrameworks/UIFoundation.framework]",
    "'NSColor' (0x200412350) [/System/Library/Frameworks/AppKit.framework]",
    "'NSGlyphInfo' (0x20042aa98) [/System/Library/PrivateFrameworks/UIFoundation.framework]",
    "'NSArray' (0x2003ed460) [/System/Library/Frameworks/CoreFoundation.framework]",
    "'NSPresentationIntent' (0x20088da28) [/System/Library/Frameworks/Foundation.framework]"
)}
```

## Changelog:

[IOS] [FIXED] -  Fixes TextInput crashes when any text is entered while running as iOS app on apple silicon mac

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

Test Plan:
Run RNTester on apple silicon mac, and entered some text in textinput, no crash occured. Also, verified that the caret was not jumping around, thus preserving the original fix.

https://github.com/user-attachments/assets/6304f6e7-c663-4351-ace8-ab1842ee545f

Reviewed By: javache

Differential Revision: D69981500

Pulled By: cipolleschi

fbshipit-source-id: 2af9b280e42f621446efda9b101af50525e8fef7
2025-03-11 14:23:53 +00:00
Vitali ZaidmanandNicola Corti 4c95fcd53b increase ping-pong timeout before killing WS connection to DevTools (#49358)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49358

When the network is under strain, the code responsible for detecting if the inspector proxy's connection to the client has been lost may incorrectly assume the connection is dead. This false positive occurs because the system assumes that if a pong is not received within 5 seconds of a ping, the other side has disconnected. However, I was able to consistently reproduce scenarios where a delay of more than 5 seconds (even more than 20 seconds) was followed by a return to normal ping-pong communication without any issues.

Since I can't think of any issues with increasing this number, I'm increasing it to 60s.

Changelog:
[General][Fixed] - Disconnections of DevTools when the network is under significant strain.

Reviewed By: robhogan, huntie

Differential Revision: D69523906

fbshipit-source-id: 50db1e7bbe690b42421bc226aa30fd6571ba2257
2025-03-11 11:47:46 +00:00
7c50b5eca5 Fix Android Image defaultSource runtime error (#49097) (#49890)
Summary:
Fixes https://github.com/facebook/react-native/issues/49075

The Image `defaultSource` prop is causing a runtime error from 0.77 just by using it in the Image component (see error in the linked issue). This might be a regression from some changes in the prop processing logic from either https://github.com/facebook/react-native/issues/47710, https://github.com/facebook/react-native/issues/47713 or https://github.com/facebook/react-native/issues/47754.

## Changelog:

[ANDROID] [FIXED] - Fix Image defaultSource runtime error

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

Test Plan:
- Verify it doesn't throw any error on runtime anymore for Android.
- iOS behaviour should not be impacted as changes are Android specific

In the RNTester, you can use the following component:

```tsx
import * as React from 'react';
import {Image, View} from 'react-native';

function Playground() {
  return (
    <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
      <Image
        defaultSource={require('../../assets/bandaged.png')}
        source={{
          uri: 'https://i.natgeofe.com/n/548467d8-c5f1-4551-9f58-6817a8d2c45e/NationalGeographic_2572187_4x3.jpg',
        }}
        style={{width: 200, height: 200}}
      />
    </View>
  );
}
```

Also, this `defaultSource` prop is ignored in debug builds for Android ([as per the docs](https://reactnative.dev/docs/image#defaultsource)) – but I've verified we get the defaultSource as a string, which is what we expect on the native side:

<details>
<summary>Screenshot of the Android logs</summary>

![image](https://github.com/user-attachments/assets/e62ae2c3-6a93-4e44-a2d7-c913f5db2173)

</details>

Reviewed By: javache

Differential Revision: D69052723

Pulled By: cortinico

fbshipit-source-id: 2860dd4c18cefcfcbc4e39f94dfa6305f45773a3

# Conflicts:
#	packages/react-native/Libraries/Image/ImageViewNativeComponent.js

Co-authored-by: Mateo Guzmán <info@mateoguzman.net>
2025-03-10 11:25:12 +00:00
Rob Hogan 61314c73f0 Update Podfile.lock
Changelog: [Internal]
2025-02-19 12:39:38 +00:00
React Native Bot 110450105e Release 0.77.1
#publish-packages-to-npm&latest
2025-02-13 18:07:43 +00:00
Alex HuntandRob Hogan d682655ec1 Fix rn-tester convenience scripts (#49401)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49401

These scripts erroneously invoked `npm`, requiring `--` to forward args.

Discovered while testing https://github.com/facebook/react-native/pull/49353.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D69594024

fbshipit-source-id: a6e8cccaf994f1472b51155d36a49ed17cd291dc
2025-02-13 16:49:38 +00:00
Alex HuntandGitHub 969eb3f007 Restore Metro log streaming via CLI flag (#49356)
Summary:
This change adds an opt-in to restore JavaScript log streaming via the Metro dev server, [removed from React Native core in 0.77](https://reactnative.dev/blog/2025/01/21/version-0.77#removal-of-consolelog-streaming-in-metro).

Users can opt into this legacy behaviour by adding the `--client-logs` flag to `npx react-native-community/cli start`.

- The default experience remains without streamed JS logs.
- The existing "JavaScript logs have moved! ..." notice is printed in all cases, and we do not advertise the new flag for new users.
- Under non-Community CLI dev servers (i.e. Expo), log streaming is restored implicitly.

We will clean up this functionality again when we eventually remove JS log streaming over `HMRClient`, tasked in T214991636.

**Implementation notes**

- Logs are always sent over `HMRClient` (previous status quo), even with log streaming off in the dev server. This is a necessary evil to be able to flag this functionality in a user-accessible place, and to move fast for 0.78.
- Necessarily, emitting `fusebox_console_notice` moves to the dev server itself, on first device (Fusebox) connection.

Changelog:
[General][Added] - Add opt in for legacy Metro log streaming via `--client-logs` flag
2025-02-12 15:17:13 +00:00
Riccardo CipolleschiandRob Hogan 475f797a51 Properly handle null values coming from JS (#49250)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49250

The TurboModule System decided to ignore the Null values when they are coming to JS. However, in iOS, null value can be mapped to `[NSNull null];` and this value is a valid value that can be used on the native side.

In the old architecture, when the user were sending a null value from JS to a native module, the Native side was receiving the value.

In the New Architecture, the value was stripped away.

This change allow us to handle the `null` value properly in the interop layer, to restore the usage of legacy modules in the New Arch.

I also tried with a more radical approach, but several tests were crashing because some modules do not know how to handle `NSNull`.

See discussion happening here: https://github.com/invertase/react-native-firebase/issues/8144#issuecomment-2548067344

## Changelog:
[iOS][Changed] - Properly handle `null` values coming from NativeModules.

Reviewed By: sammy-SC

Differential Revision: D69301396

fbshipit-source-id: be275185e2643092f6c3dc2481fe9381bbcf69e9
2025-02-11 15:03:00 +00:00
David VaccaandRob Hogan d8af0ae3f2 Fix execution of early InteropEvents (#48823)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48823

This diff is fixing the execution of Events that are sent early in the rendering of surfaces.

This diff fixes a bug in the queueing of events that are built with not surfaceId (-1), the fixes is to call getSurfaceManagerForView() to retrieve the proper surfaceId (as we do in the execution of events)

calling getSurfaceManagerForView() has a perf hit, we believe this won't be a problem because this method will only be called in edge cases (no surfaceId and early execution of events)

changelog: [Android][Fixed] Fix execution of early InteropEvents

Reviewed By: shwanton, lenaic

Differential Revision: D68454811

fbshipit-source-id: a79be0b392004e645c48d1683bba774b6b597ca0
2025-02-11 14:59:48 +00:00
Riccardo CipolleschiandRob Hogan 83b986d370 Be less strict with method parsing of TurboModule Interop Layer (#49072)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49072

We have instance of apps crashing when enabling the New Architecture because of the TurboModule interop layer.

What's happening is that when the module is loaded, the TM Interop Layer tries to parse the method definition to expose them in JS. However, for some libraries in the Legacy Architecture, it is possible to define a method in Objective-C and to define a different signature in Swift.

For example, the [`RNBluetoothClassic` library](https://github.com/kenjdavidson/react-native-bluetooth-classic) defines a selector in objective-c which [has the signature](https://github.com/kenjdavidson/react-native-bluetooth-classic/blob/main/ios/RNBluetoothClassic.m#L134-L136)

```
RCT_EXTERN_METHOD(available: (NSString *)deviceId
                  resolver: (RCTPromiseResolveBlock)resolve
                  rejecter: (RCTPromiseRejectBlock)reject)
```

And the method is inmplemented in Swift with [the signature](https://github.com/kenjdavidson/react-native-bluetooth-classic/blob/main/ios/RNBluetoothClassic.swift#L502-L505):

```
func availableFromDevice(
        _ deviceId: String,
        resolver resolve: RCTPromiseResolveBlock,
        rejecter reject: RCTPromiseRejectBlock
    )
```

When the TurboModule interop layer tries to parse the method, it receives the `accept:resolver:rejecter:` signature, but that signature is not actually defined in as a method in the module instance, and it crashes.

This crash was not happening in the Old Architecture, which was handling this case gracefully. Notice that the specific method from the example is not working in the Old Architecture either. However, the app is not crashing in the old architecture.

This change adds the same graceful behaviors plus it adds a warning in development to notify the developer about which methods couldn't be found in the interface.

Fixes:
- https://github.com/facebook/react-native/issues/47587
- https://github.com/facebook/react-native/issues/48065

## Changelog:
[iOS][Fixed] - Avoid crashing the app when the InteropLayer can't find some methods in the native implementation.

Reviewed By: javache

Differential Revision: D68901734

fbshipit-source-id: 844d1bf29423d5c601b583540e86d57dfffd1428
2025-02-11 14:58:41 +00:00
Rickard ZrinskiandRob Hogan 8baa858412 Fix maxFontSizeMultiplier prop on Text and TextInput components in new architecture (#47614)
Summary:
The `maxFontSizeMultiplier` prop for `Text` and `TextInput` was not handled in Fabric / New Architecture as documented in https://github.com/facebook/react-native/issues/47499.

bypass-github-export-checks

[GENERAL] [FIXED] - Fix `maxFontSizeMultiplier` prop on `Text` and `TextInput` components in Fabric / New Architecture

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

Test Plan:
I have not added any automated tests for this change but try to do so if requested. I have however added examples to RN Tester for both the Text and TextInput components, as well as compared the behaviour with Paper / Old Architecture. Both on version 0.76.

Noticed now I didn't do exactly the same steps in both videos, oops! Be aware that reapplying changes made in the Settings are currently half-broken on the new architecture, thus I'm restarting the app on Android and iOS. But this issue is unrelated to my changes. I've tested on main branch and it has the same issue.

Here are comparison videos between Paper and Fabric on iOS *after* I've made my fix.

| Paper  | Fabric |
| ------------- | ------------- |
| <video src="https://github.com/user-attachments/assets/f4fd009f-aa6d-41ab-92fa-8dcf1e351ba1" /> | <video src="https://github.com/user-attachments/assets/fda42cc6-34c2-42a7-a6e2-028e7c866075" /> |

| Paper  | Fabric |
| ------------- | ------------- |
| <video src="https://github.com/user-attachments/assets/59b59f7b-25d2-4b5b-a8e2-d2054cc6390b" /> | <video src="https://github.com/user-attachments/assets/72068566-8f2a-4463-874c-45a6f5b63b0d" /> |

Reviewed By: Abbondanzo

Differential Revision: D65953019

Pulled By: cipolleschi

fbshipit-source-id: 90c3c7e236229e9ad9bd346941fafe4af8a9d9fc
2025-02-11 14:55:34 +00:00
Tommy NguyenandRob Hogan 877e82c1a9 fix(dev-middleware): add missing invariant dependency (#49047)
Summary:
`dev-middleware` uses `invariant` but does not declare it as a dependency. Under certain hoisting scenarios, or when using pnpm, this will cause `dev-middleware` to fail while being loaded.

## Changelog:

[GENERAL] [FIXED] - add missing `invariant` dependency

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

Test Plan: n/a

Reviewed By: cortinico

Differential Revision: D68835789

Pulled By: huntie

fbshipit-source-id: 13718f4970ed55e6e062b7c2bd719be977abdd0c
2025-02-11 14:36:09 +00:00
Jorge Cabiedes AcostaandRob Hogan 55d5c44976 Fix elevation with border-radius set (#48982)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48982

We were missing a conversion to px on the `getOutline()` function of `CompositeBackgroundDrawable` which led to incorrect elevation prop rendering

Changelog: [Android][Fixed] - Elevation prop on android has incorrect border-radius

Reviewed By: NickGerleman

Differential Revision: D68724947

fbshipit-source-id: b3a7a4919bfd7c60fac7c3d6e3ba760e3f74d190
2025-02-11 14:35:21 +00:00
Riccardo CipolleschiandRob Hogan bc35afefd5 Fix images not displayed when extension is implicit (#48888)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48888

We have a report from OSS where Images are not displayed properly in case they are saved on disk with no extension.

We previously had a fix attempt iwith [this pr](https://github.com/facebook/react-native/pull/46971), but this was breaking some internal apps.

This second attempt should work for both cases.

## Changelog:
[iOS][Fixed] - Load images even when the extension is implicit

Reviewed By: cortinico

Differential Revision: D68555813

fbshipit-source-id: bc25970aafe3e6e5284163b663d36e00b3df3d82
2025-02-11 14:30:24 +00:00
Rob Hogan ad8a5de275 Update Podfile.lock
Changelog: [Internal]
2025-01-21 15:22:00 +00:00
Riccardo CipolleschiandRob Hogan aef6243edd Fix ruby (#48721)
Summary:
Following the suggestions [here](https://stackoverflow.com/questions/79360526/uninitialized-constant-activesupportloggerthreadsafelevellogger-nameerror), it seems that concurrent-ruby has been released tonight and it is bugged. Let's pin it to the right version.

## Changelog:
[iOS][Changed] - Pin 'concurrent-ruby' to a working version

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

Test Plan: GHA

Reviewed By: robhogan

Differential Revision: D68262719

Pulled By: cipolleschi

fbshipit-source-id: fc6410e28cc96f9d3769d3082a77cac0a3efe6db
2025-01-21 15:16:30 +00:00
React Native Bot 4eef167252 Release 0.77.0
#publish-packages-to-npm&latest
2025-01-21 11:14:55 +00:00
Rob Hogan 46cf58770d Update Podfile.lock
Changelog: [Internal]
2025-01-16 17:57:53 +00:00
React Native Bot 06c8a745b0 Release 0.77.0-rc.7
#publish-packages-to-npm&next
2025-01-16 16:32:06 +00:00
Rob Hogan 50678997b9 fix hermes param handling in test-e2e-local.js (#48068)
Summary:
why: running `yarn test-e2e-local -t "RNTestProject" -p "Android" -h false -c $GITHUB_TOKEN` would actually build the app with Hermes even though it's specified as disabled.

This is because of the `if (argv.hermes == null)` condition whose body would not execute.
The condition was changed [recently](f322dc7#diff-56f57bf0eac99b0fda1b2938aceb8d9b663db82c07cb405bd53a01c8689710ffR258).

Reason for `await` being used:

```
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ scripts/release-testing/test-e2e-local.js:303:32

Cannot get argv.hermes because property hermes is missing in Promise [1]. [prop-missing]

     scripts/release-testing/test-e2e-local.js
     300│     'reactNativeArchitectures=arm64-v8a',
     301│     'android/gradle.properties',
     302│   );
     303│   const hermesEnabled = (argv).hermes === true;
     304│
     305│   // Update gradle properties to set Hermes as false
     306│   if (!hermesEnabled) {

     flow-typed/npm/yargs_v17.x.x.js
 [1]  80│     argv: Argv | Promise<Argv>;
 ```

## Changelog:

[INTERNAL] [FIXED] - fix `hermes` param handling in `test-e2e-local.js`
2025-01-16 15:13:05 +00:00
Rob Hogan 0ed16b407f [Local] Update feature flags generated signature
Changelog: [Internal]
2025-01-15 10:44:25 +00:00
Rob Hogan 2561db80b1 [Local] Fix Flow error with unsupported feature flag metadata
Fixes a Flow error introduced when picking https://github.com/facebook/react-native/pull/48669

Changelog: [Internal]
2025-01-15 10:39:30 +00:00
Samuel SuslaandRob Hogan 2013bad254 Back out "RN: Enable useInsertionEffectsForAnimations" (#48669)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48669

Original commit changeset: d09b2f1b7607

Original Phabricator Diff: D65906157

[General] [Fixed] - Disable useInsertionEffectsForAnimations, Fix buttons becoming unresponsive when transform is animated

Reviewed By: yungsters

Differential Revision: D68152746

fbshipit-source-id: aa0c0aa3243c67c95128a75b40dd6aa1251abbca
2025-01-15 10:20:31 +00:00
Alex HuntandRob Hogan 36a0cad953 Convert assets-registry to Flow comment syntax (#48458)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48458

NOTE: This change is made once and is not guaranteed.

**Motivation**: Requiring Flow parsing for `react-native` and its dependencies in user space can involve friction. For the case of `react-native/assets-registry` → `react-native-web`, I believe we should do the pragmatic thing to relax this requirement.

- This is a convenience stopgap until https://github.com/facebook/react-native/pull/39542 can be stabilised.
- This package is tiny and infrequently modified — I believe it's pragmatic/safe to do a one-time conversion, with the above notice and no changelog (i.e. "experimental" for now).

Resolves https://github.com/facebook/react-native/issues/48349.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D67764460

fbshipit-source-id: 7687fd79c6dea73c234a46e475c1cc745225830b
2025-01-15 10:11:00 +00:00
Mateo GuzmánandRob Hogan 4b3ef3b00c Paper: TextInput maxLength is not working in old arch (#48126)
Summary:
Fixes https://github.com/facebook/react-native/issues/47563

It seems like a regression from https://github.com/facebook/react-native/issues/45401, where it was aimed to fix `onChangeText` being called multiple times when changing the text programmatically in an input with the `multiline` prop set as true.

This PR reverts that partially, as the `maxLength` check is not being evaluated correctly before setting the text. Not reverting it completely as when removing the second part of the fix, the `onChangeText` gets called multiple times again.

## Changelog:

[IOS] [FIXED] - Fixing TextInput `maxLength` not working in old arch

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

Test Plan:
The issue could be reproduced in the rn-tester. See my videos with the before and after the fix.

<details>
<summary>Before:</summary>

https://github.com/user-attachments/assets/86fd67eb-fc14-469a-a5f8-8e83b49f857c

</details>

<details>
<summary>After:</summary>

https://github.com/user-attachments/assets/368383b1-c1bd-4e0b-ac44-c78022462fa0

</details>

Reviewed By: cortinico

Differential Revision: D67025182

Pulled By: cipolleschi

fbshipit-source-id: 720c400eef362618106ae434aef421c7529214fe
2025-01-15 10:09:39 +00:00
Nick GerlemanandRob Hogan e7db7a7266 Fix TextMeasureCacheKey Throwing Out Some LayoutConstraints (#48525)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48525

Fixes https://github.com/facebook/react-native/issues/48249

`TextMeasureCacheKey` hash and equality functions only incorporates the maximum width constraint. I'm guessing this was an attempt at an optimization, but it can lead to incorrect results in pretty trivial cases. E.g. if Yoga knows a definite size of `Text` in one dimension,  and measures via `YGMeasureModeExactly`, we can have a minimum size corresponding specific to the style in which the text was laid out.

Changelog:
[General][Fixed] - Fix TextMeasureCacheKey Throwing Out Some LayoutConstraints

Reviewed By: christophpurrer

Differential Revision: D67922414

fbshipit-source-id: 0ee0220059fc4e4645b1684c42a0587fe728bedd
2025-01-15 10:08:23 +00:00
Rob Hogan bbbeef6fdb Update Podfile.lock
Changelog: [Internal]
2025-01-06 19:57:56 +00:00
React Native Bot 407c4fbffd Release 0.77.0-rc.6
#publish-packages-to-npm&next
2025-01-06 17:16:33 +00:00
timbocoleandRob Hogan 5a64bde701 fix: Prioritise local cpp (use default as fallback) (#48340)
Summary:
https://github.com/facebook/react-native/pull/47379 removed local cpp sources from the sources being built with the app. This resulted in a local `android/app/src/main/jni/OnLoad.cpp` file being ignored at build time. I have therefore added logic to the cmake file to prioritise local `cpp` files and fallback to `${REACT_ANDROID_DIR}/cmake-utils/default-app-setup/*.cpp` if none exist.

This resolves https://github.com/facebook/react-native/issues/48298

## Changelog:
[ANDROID] [FIXED] - Prioritise local OnLoad.cpp, falling back to default-app-setup

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

Test Plan:
- Followed the https://reactnative.dev/docs/the-new-architecture/pure-cxx-modules guide (which was broken > 0.76.1)
- Applied the patch to the reproduction repository linked to https://github.com/facebook/react-native/issues/47352 to ensure no regression

Reviewed By: cipolleschi

Differential Revision: D67736012

Pulled By: cortinico

fbshipit-source-id: 87f6b8edf1613682585a94e1d1b3e6b4b792e4f5
2025-01-06 13:03:32 +00:00
Nicola CortiandGitHub 17a5d2be5a [0.77] Fix RN-Tester JSC instacrashing (#48417) 2024-12-31 12:29:48 +00:00
Rob Hogan bb9d7ad9a9 Update Podfile.lock
Changelog: [Internal]
2024-12-30 23:26:03 +00:00
React Native Bot 9d472ae28d Release 0.77.0-rc.5
#publish-packages-to-npm&next
2024-12-30 19:07:27 +00:00
zhongwuzwandRob Hogan 0bcb0c2b2f Fabric: Fixes Numeric TextInput not triggering onSubmitEditing (#48276)
Summary:
Fixes https://github.com/facebook/react-native/issues/48259 . The paper code like :
https://github.com/facebook/react-native/blob/2fee13094b3d384c071978776fd8b7cff0b6530f/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm#L777-L784

## Changelog:

[IOS] [FIXED] - Fabric: Fixes Numeric TextInput not triggering onSubmitEditing

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

Test Plan: Repro in https://github.com/facebook/react-native/issues/48259

Reviewed By: cipolleschi

Differential Revision: D67274739

Pulled By: javache

fbshipit-source-id: 57396c6e1a8ef96a1b29cae4a9aa9b5f48f6080b
2024-12-30 12:16:25 +00:00
kirillzyuskoandRob Hogan d34032b6c0 fix: do not overwrite external inputAccessoryView on Fabric (#48339)
Summary:
If 3rd party libs are using `inputAccessoryView` - the current code can easily break it. Whenever props gets changed we call `setDefaultInputAccessoryView` which will simply overwrite the current `inputAccessoryView` (which is highly undesirable).

The same fix on paper was made ~7 years ago: https://github.com/facebook/react-native/commit/bf3698323d81508fc77174df2b1ffe5fb03224e7

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[IOS] [FIXED] - Fixed problem with accessory view & 3rd party libs

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

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

Test Plan: Make sure `inputAccessoryView` functionality works as before

Reviewed By: javache

Differential Revision: D67451188

Pulled By: cipolleschi

fbshipit-source-id: bc3fa82ae15f8acedfd0b4e17bdea69cbd8c8a8d
2024-12-30 12:16:21 +00:00
Riccardo CipolleschiandGitHub 489b22c797 [LOCAL][RN][0.77] Bump Android Caches (#48373) 2024-12-24 11:30:24 +00:00
Rob Hogan 5b8ed374da Update Podfile.lock
Changelog: [Internal]
2024-12-24 11:10:08 +00:00
React Native Bot b0d9ef80da Release 0.77.0-rc.4
#publish-packages-to-npm&next
2024-12-23 16:50:28 +00:00
Thomas NardoneandRob Hogan e3970a4bb3 Restore subclipping view removal (#48329)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48329

With the call to `removeView()` removed from `ReactViewClippingManager` in https://github.com/facebook/react-native/pull/47634, we're seeing views erroneously sticking around in the layout.

While `removeViewWithSubviewClippingEnabled()` calls `removeViewsInLayout()`, it does not trigger the corresponding side effects of [removeView()](https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-15.0.0_r9/core/java/android/view/ViewGroup.java#5501):
```
public void removeView(View view) {
  if (removeViewInternal(view)) {
--> requestLayout();
--> invalidate(true);
  }
}
```
To compensate, flip `removeViewsInLayout()` to [`removeViews()`](https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-15.0.0_r9/core/java/android/view/ViewGroup.java#5562), which will ensure layout.

Changelog: [Android][Fixed] Restore layout/invalidate during ReactViewClippingManager.removeViewAt()

Reviewed By: javache

Differential Revision: D67398971

fbshipit-source-id: b100db468cc3be6ddc6edd6c6d078a8a0b59a2c1
2024-12-23 12:14:51 +00:00
Riccardo Cipolleschi 4370860c8c [LOCAL] Bump podfile.lock 2024-12-17 11:36:23 +00:00
React Native Bot 0840eab8ed Release 0.77.0-rc.3
#publish-packages-to-npm&next
2024-12-17 10:01:53 +00:00
Nicola CortiandRiccardo Cipolleschi e7c44903e1 Gradle to 8.11.1 (#48026)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48026

This should mitigate this particular issue we're seeing on Windows:
- https://github.com/facebook/react-native/issues/46210

Changelog:
[Android] [Changed] - Gradle to 8.11.1

Reviewed By: javache

Differential Revision: D66600321

fbshipit-source-id: d58437485222e189d90bcf4d6b41ca956449ed22
2024-12-16 15:35:32 +00:00
Riccardo Cipolleschi 6b22412069 [LOCAL] Add missing imports in ReactViewGroup.java and remove unused symbols 2024-12-16 15:32:04 +00:00
Riccardo Cipolleschi c4c52fb2bd [LOCAL] Fix badly resolved conflict on ReactViewGroup 2024-12-16 14:56:11 +00:00
Riccardo CipolleschiandGitHub d4941c7c6d [LOCAL][RN][CI] Add Maestro tests for the Old Arch in Template App (#48045) 2024-12-16 14:24:37 +00:00
Nicola CortiandRiccardo Cipolleschi 125b0f47d1 Revert "Include autolinkin.h in OnLoad.cpp only if it exists (#47875)"
This reverts commit 5b2bbb84b1.
2024-12-16 14:23:56 +00:00
Kacper KafaraandRiccardo Cipolleschi 81aaf46c67 Fix handling removal of transitioning views (#47634)
Summary:
Related PR in `react-native-screens`:

* https://github.com/software-mansion/react-native-screens/pull/2495

Additional context:
   * [my detailed explanation of **one of the issues**](https://github.com/software-mansion/react-native-screens/pull/2495#issuecomment-2478915818)
   * [Android Developer: ViewGroup.startViewTransition docs](https://developer.android.com/reference/android/view/ViewGroup#startViewTransition(android.view.View))

On Android view groups can be marked as "transitioning" with a `ViewGroup.startViewTransition` call. This effectively ensures, that in case a view group is marked with this call and its children are removed, they will be still drawn until `endViewTransition` is not called.

This mechanism is implemented in Android by [keeping track of "transitioning" children in auxiliary `mTransitioningViews` array](https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/view/ViewGroup.java#7178). Then when such "transitioning" child is removed, [it is removed from children array](https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/view/ViewGroup.java#5595) but it's [parent-child relationship is not cleared](https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/view/ViewGroup.java#5397) and it is still retained in the auxiliary array.

Having that established we can proceed with problem description.

https://github.com/user-attachments/assets/d0356bf5-2f17-4b06-ba53-bfca659a1071

<details>
<summary>Full code</summary>

```javascript
import { NavigationContainer } from 'react-navigation/native';
import React from 'react';
import { createNativeStackNavigator } from 'react-navigation/native-stack';
import { enableScreens } from 'react-native-screens';
import {
  StyleSheet,
  Text,
  View,
  FlatList,
  Button,
  ViewProps,
  Image,
  FlatListProps,
  findNodeHandle,
} from 'react-native';

enableScreens(true);

function Item({ children, ...props }: ViewProps) {
  return (
    <View style={styles.item} {...props}>
      <Image source={require('../assets/trees.jpg')} style={styles.image} />
      <Text style={styles.text}>{children}</Text>
    </View>
  );
}

function Home({ navigation }: any) {
  return (
    <View style={styles.container}>
      <Button title="Go to List" onPress={() => navigation.navigate('List')} />
    </View>
  );
}

function ListScreenSimplified({secondVisible}: {secondVisible?: (visible: boolean) => void}) {
  const containerRef = React.useRef<View>(null);
  const innerViewRef = React.useRef<View>(null);
  const childViewRef = React.useRef<View>(null);

  React.useEffect(() => {
    if (containerRef.current != null) {
      const tag = findNodeHandle(containerRef.current);
      console.log(`Container has tag [${tag}]`);
    }
    if (innerViewRef.current != null) {
      const tag = findNodeHandle(innerViewRef.current);
      console.log(`InnerView has tag [${tag}]`);
    }
    if (childViewRef.current != null) {
      const tag = findNodeHandle(childViewRef.current);
      console.log(`ChildView has tag [${tag}]`);
    }
  }, [containerRef.current, innerViewRef.current, childViewRef.current]);

  return (
    <View
      ref={containerRef}
      style={{ flex: 1, backgroundColor: 'slateblue', overflow: 'hidden' }}
      removeClippedSubviews={false}>
      <View ref={innerViewRef} removeClippedSubviews style={{ height: '100%' }}>
        <View ref={childViewRef} style={{ backgroundColor: 'pink', width: '100%', height: 50 }} removeClippedSubviews={false}>
          {secondVisible && (<Button title='Hide second' onPress={() => secondVisible(false)} />)}
        </View>
      </View>
    </View>
  );
}

function ParentFlatlist(props: Partial<FlatListProps<number>>) {
  return (
    <FlatList
      data={Array.from({ length: 30 }).fill(0) as number[]}
      renderItem={({ index }) => {
        if (index === 10) {
          return <NestedFlatlist key={index} />;
        } else if (index === 15) {
          return <ExtraNestedFlatlist key={index} />;
        } else if (index === 20) {
          return <NestedFlatlist key={index} horizontal />;
        } else if (index === 25) {
          return <ExtraNestedFlatlist key={index} horizontal />;
        } else {
          return <Item key={index}>List item {index + 1}</Item>;
        }
      }}
      {...props}
    />
  );
}

function NestedFlatlist(props: Partial<FlatListProps<number>>) {
  return (
    <FlatList
      style={[styles.nestedList, props.style]}
      data={Array.from({ length: 10 }).fill(0) as number[]}
      renderItem={({ index }) => (
        <Item key={'nested' + index}>Nested list item {index + 1}</Item>
      )}
      {...props}
    />
  );
}

function ExtraNestedFlatlist(props: Partial<FlatListProps<number>>) {
  return (
    <FlatList
      style={styles.nestedList}
      data={Array.from({ length: 10 }).fill(0) as number[]}
      renderItem={({ index }) =>
        index === 4 ? (
          <NestedFlatlist key={index} style={{ backgroundColor: '#d24729' }} />
        ) : (
          <Item key={'nested' + index}>Nested list item {index + 1}</Item>
        )
      }
      {...props}
    />
  );
}

const Stack = createNativeStackNavigator();

export default function App(): React.JSX.Element {
  return (
    <NavigationContainer>
      <Stack.Navigator screenOptions={{ animation: 'slide_from_right' }}>
        <Stack.Screen name="Home" component={Home} />
        <Stack.Screen name="List" component={ListScreenSimplified}/>
      </Stack.Navigator>
    </NavigationContainer>
  );
}

export function AppSimple(): React.JSX.Element {
  const [secondVisible, setSecondVisible] = React.useState(false);

  return (
    <View style={{ flex: 1, backgroundColor: 'lightsalmon' }}>
      {!secondVisible && (
        <View style={{ flex: 1, backgroundColor: 'lightblue' }} >
          <Button title='Show second' onPress={() => setSecondVisible(true)} />
        </View>
      )}
      {secondVisible && (
        <ListScreenSimplified secondVisible={setSecondVisible} />
      )}
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
  nestedList: {
    backgroundColor: '#FFA07A',
  },
  item: {
    flexDirection: 'row',
    alignItems: 'center',
    padding: 10,
    gap: 10,
  },
  text: {
    fontSize: 24,
    fontWeight: 'bold',
    color: 'black',
  },
  image: {
    width: 50,
    height: 50,
  },
});

```

</details>

Explanation (copied from [here](https://github.com/software-mansion/react-native-screens/pull/2495#issuecomment-2478915818)):

I've debugged this for a while now & I have good understanding of what's going on. This bug is caused by our usage of `startViewTransition` and its implications. We use it well, however React does not account for case that some view might be in transition. Error mechanism is as follows:

1. Let's have initially simple stack with two screens: "A, B". This is component rendered under "B":

```javascript
    <View //<-- ContainerView (CV)
      removeClippedSubviews={false}
      style={{ flex: 1, backgroundColor: 'slateblue', overflow: 'hidden' }}>
      <View removeClippedSubviews style={{ height: '100%' }}> // <--- IntermediateView (IV)
        <View removeClippedSubviews={false} style={{ backgroundColor: 'pink', width: '100%', height: 50 }} /> // <--- ChildView (ChV)
      </View>
    </View>
```

2. We press the back button.
3. We're on Fabric, therefore subtree of B gets destroyed before B itself is unmounted -> in our commit hook we detect that the screen B will be unmounted & we mark every node under B as transitioning by calling `startViewTransition`.
4. React Mounting stage starts, view hierarchy is disassembled in bottom-up fashion (leafs first).
5. ReactViewGroupManager receives MountItem to detach ChV from IV.
6. A call to [`IV.removeView(ChV)` is made](https://github.com/facebook/react-native/blob/9c11d7ca68c5c62ab7bab9919161d8417e96b28b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactClippingViewManager.kt#L58-L73), which effectively removes ChV from `IV.children`, ***HOWEVER*** it does not clear `ChV.parent`, meaning that after the call, `ChV.parent == IV`. This happens, due to view being marked as in-transition by our call to `startViewTransition`. If the view is not marked as in-transition this parent-child relationship is removed.
7. IV has `removeClippedSubviews` enabled, therefore a [call to `IV.removeViewWithSubviewsClippingEnabled(ChV)` is made](https://github.com/facebook/react-native/blob/9c11d7ca68c5c62ab7bab9919161d8417e96b28b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactClippingViewManager.kt#L68). [This function](https://github.com/facebook/react-native/blob/9c11d7ca68c5c62ab7bab9919161d8417e96b28b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java#L726-L744) does effectively two things:
    1. if the ChV has parent (interpretation: it has not yet been detached from parent), we compute it's index in `IV.children` (Android.ViewGroup's state) and remove it from the array,
    2. remove the ChV from `mAllChildren` array (this is state maintained by ReactViewGroup for purposes of implementing the "subview clipping" mechanism".

The crash happens in 7.1, because ChV has been removed from `IV.children` in step 6, but the parent-child relationship has not been broken up there. Under usual circumstances (this is my hypothesis now, yet unconfirmed) 7.1 does not execute, because `ChV.parent` is nulled in step no. 6.

Transitions. On Fabric, when some subtree is unmounted, views in the subtree are unmounted in bottom-up order. This leads to uncomfortable situation, where our components (react-native-screens), who want to drive & manage transitions are notified that their children will be removed after the subtrees mounted in screen subviews are already disassembled. **If we start animation in this very moment we will have staggering effect of white flash** [(issue)](https://github.com/software-mansion/react-native-screens/issues/1685) (we animate just the screen with white background without it's children). This was not a problem on Paper, because the order of subtree disassembling was opposite - top-down. While we've managed to workaround this issue on Fabric using `MountingTransactionObserving` protocol on iOS and a commit hook on Android (we can inspect mutations in incoming transaction before it starts being applied) we still need to prevent view hierarchy from being disassembled in the middle of transition (on Paper this has also been less of an issue) - and this is where `startViewTransition` comes in. It allows us to draw views throughout transition after React Native removes them from HostTree model. On iOS we exchange subtree for its snapshot for transition time, however this approach isn't feasible on Android, because [snapshots do not capture shadows](https://stackoverflow.com/questions/42212600/android-screenshot-of-view-with-shadow).

[Android does not expose a method to verify whether a view is in transition](https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/view/ViewGroup.java#7162) (it has `package` visibility), therefore we need to retrieve this information with some workaround. I see two posibilities:

* first approach would be to override `startViewTransition` & `endViewTransition` in ReactViewGroup and keep the state on whether the view is transitioning there,
* second possible approach would be as follows: we can check for "transitioning" view by checking whether a view has parent but is not it's parent child (this **should** be reliable),

Having information on whether the view is in transition or not, we can prevent multiple removals of the same view in every call site (currently only in `removeViewAt` if `parent.removeClippingSubviews == true`).

Another option would be to do just as this PR does: having in mind this "transitioning" state we can pass a flag to `removeViewWithSubviewClippingEnabled` and prevent duplicated removal from parent if we already know that this has been requested.

I can also add override of this method:

```java
  /*package*/ void removeViewWithSubviewClippingEnabled(View view) {
    this.removeViewWithSubviewClippingEnabled(view, false);
  }
```

to make this parameter optional.

[ANDROID] [FIXED] - Handle removal of in-transition views.

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

Test Plan: WIP WIP

Reviewed By: javache

Differential Revision: D66539065

Pulled By: tdn120

fbshipit-source-id: cf1add67000ebd1b5dfdb2048461a55deac10b16
2024-12-16 14:23:31 +00:00
Riccardo Cipolleschi 621f13f9a2 Skip hidden folders when looking for third party components (#48182)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48182

Maintainers from SVG reached out because of an edge case they inencountered when generating the ComponentProvider. In their setup, they had a `.git` folder in the repo and the algorithm was spending a lot of time crawling the git folder.

In general, we should avoid crawling hidden folders.

This change fix that.

## Changelog:
[General][Fixed] - Skip hidden folders when looking for third party components.

Reviewed By: javache

Differential Revision: D66959345

fbshipit-source-id: 992a79f3cff22cd6a459e0272c8140bc329888da
2024-12-16 14:19:51 +00:00
Ben HandanyanandRiccardo Cipolleschi b153ec8af7 Enable hermes debugger by configuration type instead of configuration name (#48174)
Summary:
Fixes an [issue](https://github.com/facebook/react-native/issues/48168) where only iOS configurations with "Debug" in the name are configured to use the hermes debugger.

## Changelog:

<!-- 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
-->

[IOS] [FIXED] - Enable hermes debugger by configuration type instead of configuration name

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

Test Plan:
Added new test scenarios that all pass:
```
ruby -Itest packages/react-native/scripts/cocoapods/__tests__/utils-test.rb
Loaded suite packages/react-native/scripts/cocoapods/__tests__/utils-test
Started
Finished in 0.336047 seconds.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
56 tests, 149 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
166.64 tests/s, 443.39 assertions/s
```

In a personal project with the following configurations:
```
project 'ReactNativeProject', {
    'Local' => :debug,
    'Development' => :release,
    'Staging' => :release,
    'Production' => :release,
  }
```
I added the following to my Podfile:
```
installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
        puts "#{config.name} is debug? #{config.type == :debug}"
    end
end
```
To confirm that my logic is correct:
```
Local is debug? true
Development is debug? false
Staging is debug? false
Production is debug? false
```

Reviewed By: robhogan

Differential Revision: D66962860

Pulled By: cipolleschi

fbshipit-source-id: 7bd920e123c9064c8a1b5d45df546ff5d2a7d8be
2024-12-16 14:18:58 +00:00
Eric RozellandRiccardo Cipolleschi 840382d22f Disable weak event emitter in AttributedString for Mac Catalyst (#48225)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48225

Fixes https://github.com/facebook/react-native/issues/47762

The weak event emitter in AttributedString attributes is causing a serialization error when typing into a TextInput in a Mac Catalyst build. We can resolve this by not putting the event emitters in the attributed string, but this is likely to cause other issues with event handling for nested <Text> components.

## Changelog

[iOS][Fixed] - Workaround for Mac Catalyst TextInput crash due to serialization attempt of WeakEventEmitter

Reviewed By: NickGerleman

Differential Revision: D66664583

fbshipit-source-id: efdfbcb0db4d5e6b9bf7c14f9bbb221faae2d724
2024-12-16 14:16:20 +00:00
Blake Friedman 77b9c55b22 Update Podfile.lock
Changelog: [Internal]
2024-12-10 01:41:19 +00:00
React Native Bot c5b53fdfab Release 0.77.0-rc.2
#publish-packages-to-npm&next
2024-12-09 23:47:06 +00:00
zhongwuzwandBlake Friedman db798c18d6 Fabric: Post RCTInstanceDidLoadBundle notification after bundle loaded (#48082)
Summary:
Fixes https://github.com/facebook/react-native/issues/47949

## Changelog:

[IOS] [FIXED] - Fabric: Post RCTInstanceDidLoadBundle notification after bundle loaded

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

Test Plan: Post RCTInstanceDidLoadBundle notification after bundle loaded

Reviewed By: philIip

Differential Revision: D66754060

Pulled By: cipolleschi

fbshipit-source-id: d30f0ed73e127936082e6f91e137b9b4013c6651
2024-12-09 15:50:24 +00:00
Riccardo CipolleschiandBlake Friedman d4d1788cc5 Exclude mapping generation of core component (#48145)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48145

While writing the docs for 0.77, I found an edge case in the generation of the RCTThirdPartyComponentProvider:
* If the app has the `codegenConfig` field set in the `package.json`
* And it does not have the `ios.componentProvider` field is not provided

Codegen was generating the mapping for the react-native core components. That's not expected as, in that case, it should only generate components that are declared in the app or in libraries.

This change fixes this edge case.

## Changelog:
[Internal] - Exclude mapping generation of core component

Reviewed By: blakef

Differential Revision: D66875080

fbshipit-source-id: 65fe10381729ec7808efec70feacf2a55f0056e9
2024-12-09 15:49:31 +00:00
Tim YungandBlake Friedman a78d74ca20 RN: Backout "Scheduling Animated End Callbacks in Microtask" (#48132)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48132

Backs out D63573322 and D65645981, reverting the change that makes callbacks passed to `animation.start(<callback>)` scheduled for execution in a microtask.

This is being reverted becuase the latency introduced by the current macro and pending micro tasks can introduce visible latency artifacts that diminish the fidelity of animations.

Changelog:
[General][Changed] - Reverts #47503. (~~Callbacks passed to `animation.start(<callback>)` will be scheduled for execution in a microtask. Previously, there were certain scenarios in which the callback could be synchronously executed by `start`.~~)

Reviewed By: javache

Differential Revision: D66852804

fbshipit-source-id: 08434b9876813fe9e8b189b6b467198933843bf0
2024-12-09 15:48:53 +00:00
Nicola CortiandBlake Friedman d81be20084 Fix crash on HeadlessJsTaskService on old architecture (#48124)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48124

Fixes https://github.com/facebook/react-native/issues/47592

The logic in HeadlessJsTaskService is broken. We should not check whether `getReactContext` is null or not.
Instead we should use the `enableBridgelessArchitecture` feature flag to understand if New Architecture was enabled or not.

The problem we were having is that `HeadlessJsTaskService` was attempting to load the New Architecture even if the user would have it turned off. The Service would then die attempting to load `libappmodules.so` which was correctly missing.

Changelog:
[Android] [Fixed] - Fix crash on HeadlessJsTaskService on old architecture

Reviewed By: javache

Differential Revision: D66826271

fbshipit-source-id: 2b8418e0b01b65014cdbfd0ec2f843420a15f9db
2024-12-09 15:48:20 +00:00
Nicola CortiandBlake Friedman 6cde3df040 Re-introduce the deprecated constructor on ReactModuleInfo (#48090)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48090

This alleviates a breaking change on `ReactModuleInfo` constructor.
While the ctor was deprecated, we realized that there are more than 250 usages in OSS.
We'll need to properly communicate this removal before we do it.

Changelog:
[Android] [Fixed] - Re-introduce the deprecated constructor on ReactModuleInfo

Reviewed By: cipolleschi

Differential Revision: D66755541

fbshipit-source-id: 3673d8f2af278d55491cea89f1594d368513e3d8
2024-12-09 15:46:44 +00:00
zhongwuzwandBlake Friedman 19bff65415 Fabric: Fixes insets not adjust when keyboard disappear (#47924)
Summary:
Fixes https://github.com/facebook/react-native/issues/47731 .

## Changelog:

[IOS] [FIXED] - Fabric: Fixes insets not adjust when keyboard disappear

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

Test Plan: Demo in https://github.com/facebook/react-native/issues/47731

Reviewed By: blakef

Differential Revision: D66651865

Pulled By: cipolleschi

fbshipit-source-id: a75afbd1a7651f0c77022d913f910821c482fcf7
2024-12-09 15:46:39 +00:00
Riccardo CipolleschiandBlake Friedman 88c5b4f8ed Do not install CMake on Windows machine (#48122)
Summary:
GHA to build HermesC for windows are failing because the machines comes with a different CMake version already.
Let's try not to install Cmake and use the one provided by the machine.

## Changelog:
[Internal] -

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

Test Plan: GHA {F1973187648}

Reviewed By: alanleedev

Differential Revision: D66825216

Pulled By: cipolleschi

fbshipit-source-id: 9a9376a5409e192195a6b6cc25b4d58cb47f15da
2024-12-06 10:45:46 +00:00
Rob Hogan 1c3160c7d0 Update Podfile.lock 2024-12-04 10:59:58 +00:00
React Native Bot b19898e259 Release 0.77.0-rc.1
#publish-packages-to-npm&next
2024-12-04 09:51:19 +00:00
Alex HuntandRob Hogan 22072bffaa Update debugger-frontend from b61aae3...6b80704 (#48042)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48042

Changelog: [Internal] - Update `react-native/debugger-frontend` from b61aae3...6b80704

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebookexperimental/rn-chrome-devtools-frontend/compare/b61aae3ccc6e2684dfbf1e2a06b0f985b459f11f...6b80704fd50ea0bf10f5f5da5a4343de29aff8b2).

Reviewed By: blakef

Differential Revision: D66651149

fbshipit-source-id: 6848eebb4b7c04c7c04ae1f784fc39785945bf7b
2024-12-02 15:45:30 +00:00
Pieter De BaetsandRob Hogan d663fc4397 Restore deprecated TurboReactPackage (#48039)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48039

This class was removed in D66127067 but was marked as DeprecatedInNewArchitecture and not Deprecated, which limited the signal we gave to developers to move away from this.

Restore for now to e

Changelog: [Android][Fixed] Reverted removal of TurboReactPackage

Reviewed By: rshest

Differential Revision: D66648209

fbshipit-source-id: 165f9390b4874e69353612b929d87b0c495588af
2024-12-02 15:45:12 +00:00
Vojtech NovakandRob Hogan 70f6cec5d7 fix IOException in BuildCodegenCLITask (#48008)
Summary:
building RN tester with 0.77 rc-0 doesn't work now because of `java.io.IOException:  No such file or directory` on line 48.

`buildDirectory` is a Gradle property representing a file

https://github.com/facebook/react-native/pull/47552 removes this file altogether so feel free to close if that one is the "right one"

## Changelog:

[ANDROID] [FIXED] - fix IOException in `BuildCodegenCLITask`

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

Test Plan: After this change, building RN tester works.

Reviewed By: cortinico

Differential Revision: D66650038

Pulled By: robhogan

fbshipit-source-id: 11cd83493fa118c6b79d11c9113228dd3971a803
2024-12-02 14:31:10 +00:00
zhongwuzwandRob Hogan b79ec10b78 Fabric: Fixes Modal onRequestClose not called (#48037)
Summary:
Fixes https://github.com/facebook/react-native/issues/48030 .

## Changelog:

[IOS] [FIXED] - Fabric: Fixes Modal onRequestClose not called

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

Test Plan: Repro please see  https://github.com/facebook/react-native/issues/48030.

Reviewed By: cortinico

Differential Revision: D66647232

Pulled By: cipolleschi

fbshipit-source-id: 773517dfe45f6f2e6348cda225e972fbac05edc2
2024-12-02 14:30:45 +00:00
Rob Hogan ee4333812c Fix Animated on JSC: Object.hasOwn -> obj.hasOwnProperty (#48035)
Summary:
https://github.com/facebook/react-native/pull/46385 introduced use of `Object.hasOwn` as an incidental detail of some `Animated` performance improvements.

Unfortunately, `Object.hasOwn` is not present in the version of JSC shipped with Android, nor the built in iOS JSC until iOS 15.4, which is greater than React Native's minimum version (13.4).

Instead:
 - Use `obj.hasOwnProperty(prop)` for known objects that have the `Object` prototype.
 - Otherwise, use `Object.hasOwn` where it is defined.
 - Lastly, fall back to `Object.prototype.hasOwnProperty.call(obj, prop)`, which is compatible with passed `null`-prototype objects.

Fixes https://github.com/facebook/react-native/issues/47963

Intend to pick for RN 0.77.

## Changelog:

[GENERAL][FIXED] Replace Object.hasOwn usages to fix Animated on JSC

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

Test Plan:
- Run `rn-tester` on Android with Hermes disabled.
 - Verify the FlatList->Basic example redboxes before this change, and works after it.

Reviewed By: yungsters

Differential Revision: D66638379

Pulled By: robhogan

fbshipit-source-id: 51ac525851b41adea3bf3cc41349225138e1f2fe
2024-12-02 14:28:14 +00:00
Hugo FOYARTandRob Hogan 9388a7a699 fix: FormData filename in content-disposition (#46543)
Summary:
This Pull Request fixes a regression introduced in https://github.com/facebook/react-native/commit/7c7e9e6571c1f702213e9ffbb40921cd5a1a786b, which adds a `filename*` attribute to the `content-disposition` of a FormData part. However, as the [MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#directives) states, there is no `filename*` attribute for the `content-disposition` header in case of a form data.

The `filename*` attribute would break the parsing of form data in the request, such as in frameworks like `Next.js` which uses the web implementation of [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request).

Fixes https://github.com/facebook/react-native/issues/44737

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[General] [Fixed] - Remove non compliant `filename*` attribute in a FormData `content-disposition` header

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

Test Plan:
- Clone the `react-native` repo
- Create a simple JS file that will act as a node server and execute it

```javascript
const http = require('http');

const server = http.createServer(async function (r, res) {
    const req = new Request(new URL(r.url, 'http://localhost:3000'), {
      headers: r.headers,
      method: r.method,
      body: r,
      duplex: 'half',
    });

    const fileData = await req.formData();

    console.log(fileData);
    res.writeHead(200);
    res.end();
});
server.listen(3000);
```

- Go to `packages/rn-tester`
- Add a `useEffect` in `js/RNTesterAppShared.js`

```javascript
React.useEffect(() => {
    const formData = new FormData();
    formData.append('file', {
      uri: 'https://www.gravatar.com/avatar',
      name: '测试photo/1.jpg',
      type: 'image/jpeg',
    });

    fetch('http://localhost:3000', {
      method: 'POST',
      body: formData,
    }).then(res => console.log(res.ok));
  });
```

- Run the app on iOS or Android
- The node server should output the file added to the FormData with an encoded name

Reviewed By: robhogan

Differential Revision: D66643317

Pulled By: yungsters

fbshipit-source-id: 0d531528005025bff303505363671e854c0a2b63
2024-12-02 14:27:17 +00:00
Pieter De BaetsandRob Hogan 8ab87c617e Fix stale reference to ReactViewGroup#mAllChildren (#47950)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47950

`addInArray` may reallocate `mAllChildren` so it's not correct to store this reference.

Changelog: [Internal]

Reviewed By: tdn120

Differential Revision: D66474532

fbshipit-source-id: 90ce2fcbf8ff236501ed47b2acc413e54ef8b82a
2024-12-02 14:26:41 +00:00
Jakub RomanczykandRob Hogan 184da8907e refactor(community-cli-plugin): use node builtin fetch (#47397)
Summary:
Removed `node-fetch` in favour of node builtin fetch to get rid of the deprecated `punycode` warning when using Node 22.

`react-native/community-cli-plugin` already requires Node >= 18 where it was made available by default (without `--experimental-fetch` flag).

This change is similar to the one made in https://github.com/facebook/react-native/pull/45227

## Changelog:

[GENERAL] [CHANGED] - Drop node-fetch in favor of Node's built-in fetch from undici in `react-native/community-cli-plugin`

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

Test Plan: tests pass

Reviewed By: blakef

Differential Revision: D66512595

Pulled By: NickGerleman

fbshipit-source-id: c4e01baf388f9fae8cea7b4bfe25034bff28b461
2024-12-02 14:25:53 +00:00
Rob Hogan abfa3a23dc Update Podfile.lock
Changelog: [Internal]
2024-11-26 16:57:20 +00:00
React Native Bot f6cce65bec Release 0.77.0-rc.0
#publish-packages-to-npm&next
2024-11-26 11:38:45 +00:00
Riccardo CipolleschiandBlake Friedman 385318bf6a [LOCAL] Fix testing script to use debug versions of the Android APK 2024-11-25 19:09:40 +00:00
Rob Hogan 4cffff35e0 [LOCAL] Update Hermes 2024-11-25 14:02:19 +00:00
167 changed files with 1832 additions and 1043 deletions
+4 -4
View File
@@ -28,10 +28,10 @@ runs:
uses: actions/cache/restore@v4
with:
path: /github/home/.cache/ccache
key: v1-ccache-android-${{ github.job }}-${{ github.ref }}
key: v2-ccache-android-${{ github.job }}-${{ github.ref }}
restore-keys: |
v1-ccache-android-${{ github.job }}-
v1-ccache-android-
v2-ccache-android-${{ github.job }}-
v2-ccache-android-
- name: Show ccache stats
shell: bash
run: ccache -s -v
@@ -60,7 +60,7 @@ runs:
uses: actions/cache/save@v4
with:
path: /github/home/.cache/ccache
key: v1-ccache-android-${{ github.job }}-${{ github.ref }}
key: v2-ccache-android-${{ github.job }}-${{ github.ref }}
- name: Show ccache stats
shell: bash
run: ccache -s -v
@@ -14,8 +14,12 @@ runs:
shell: bash
run: |
sudo apt update
sudo apt install -y git openssh-client cmake build-essential \
sudo apt install -y git openssh-client build-essential \
libreadline-dev libicu-dev jq zip python3
# Install cmake 3.28.3-1build7
sudo apt-get install cmake=3.28.3-1build7
sudo ln -sf /usr/bin/cmake /usr/local/bin/cmake
- name: Restore Hermes workspace
uses: ./.github/actions/restore-hermes-workspace
- name: Linux cache
@@ -14,23 +14,23 @@ runs:
uses: actions/download-artifact@v4
with:
name: hermes-workspace
path: 'D:\tmp\hermes'
path: 'C:\tmp\hermes'
- name: Set up workspace
shell: powershell
run: |
mkdir -p D:\tmp\hermes\osx-bin
mkdir -p C:\tmp\hermes\osx-bin
mkdir -p .\packages\react-native\sdks\hermes
cp -r -Force D:\tmp\hermes\hermes\* .\packages\react-native\sdks\hermes\.
cp -r -Force C:\tmp\hermes\hermes\* .\packages\react-native\sdks\hermes\.
cp -r -Force .\packages\react-native\sdks\hermes-engine\utils\* .\packages\react-native\sdks\hermes\.
- name: Windows cache
uses: actions/cache@v4
with:
key: v2-hermes-${{ github.job }}-windows-${{ inputs.hermes-version }}-${{ inputs.react-native-version }}
key: v3-hermes-${{ github.job }}-windows-${{ inputs.hermes-version }}-${{ inputs.react-native-version }}
path: |
D:\tmp\hermes\win64-bin\
D:\tmp\hermes\hermes\icu\
D:\tmp\hermes\hermes\deps\
D:\tmp\hermes\hermes\build_release\
C:\tmp\hermes\win64-bin\
C:\tmp\hermes\hermes\icu\
C:\tmp\hermes\hermes\deps\
C:\tmp\hermes\hermes\build_release\
- name: setup-msbuild
uses: microsoft/setup-msbuild@v1.3.2
- name: Set up workspace
@@ -39,13 +39,13 @@ runs:
New-Item -ItemType Directory -ErrorAction SilentlyContinue $Env:HERMES_WS_DIR\icu
New-Item -ItemType Directory -ErrorAction SilentlyContinue $Env:HERMES_WS_DIR\deps
New-Item -ItemType Directory -ErrorAction SilentlyContinue $Env:HERMES_WS_DIR\win64-bin
- name: Downgrade CMake
shell: powershell
run: choco install cmake --version 3.31.6 --force
- name: Build HermesC for Windows
shell: powershell
run: |
if (-not(Test-Path -Path $Env:HERMES_WS_DIR\win64-bin\hermesc.exe)) {
choco install --no-progress cmake --version 3.14.7 --allow-downgrade
if (-not $?) { throw "Failed to install CMake" }
cd $Env:HERMES_WS_DIR\icu
# If Invoke-WebRequest shows a progress bar, it will fail with
# Win32 internal error "Access is denied" 0x5 occurred [...]
@@ -63,7 +63,7 @@ runs:
$Env:PATH += ";$Env:CMAKE_DIR;$Env:MSBUILD_DIR"
$Env:ICU_ROOT = "$Env:HERMES_WS_DIR\icu"
cmake -S hermes -B build_release -G 'Visual Studio 16 2019' -Ax64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True -DHERMES_ENABLE_WIN10_ICU_FALLBACK=OFF
cmake -S hermes -B build_release -G 'Visual Studio 17 2022' -Ax64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True -DHERMES_ENABLE_WIN10_ICU_FALLBACK=OFF
if (-not $?) { throw "Failed to configure Hermes" }
echo "Running windows build..."
cd build_release
@@ -83,4 +83,4 @@ runs:
uses: actions/upload-artifact@v4.3.4
with:
name: hermes-win64-bin
path: D:\tmp\hermes\win64-bin\
path: C:\tmp\hermes\win64-bin\
+9 -4
View File
@@ -25,6 +25,10 @@ inputs:
required: false
default: "."
description: The directory from which metro should be started
architecture:
required: false
default: "NewArch"
description: The react native architecture to test
runs:
using: composite
@@ -52,6 +56,7 @@ runs:
if: ${{ inputs.flavor == 'debug' }}
run: ./packages/react-native-codegen/scripts/oss/build.sh
- name: Run e2e tests
id: run-tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 24
@@ -69,16 +74,16 @@ runs:
NORM_APP_ID=$(echo "${{ inputs.app-id }}" | tr '.' '-')
echo "app-id=$NORM_APP_ID" >> $GITHUB_OUTPUT
- name: Store tests result
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4.3.4
if: always()
with:
name: e2e_android_${{ steps.normalize-app-id.outputs.app-id }}_report_${{ inputs.jsengine }}_${{ inputs.flavor }}
name: e2e_android_${{ steps.normalize-app-id.outputs.app-id }}_report_${{ inputs.jsengine }}_${{ inputs.flavor }}_${{ inputs.architecture }}
path: |
report.xml
screen.mp4
- name: Store Logs
if: failure() && steps.run-tests.outcome == 'failure'
if: steps.run-tests.outcome == 'failure'
uses: actions/upload-artifact@v4.3.4
with:
name: maestro-logs-android-${{ steps.normalize-app-id.outputs.app-id }}-${{ inputs.jsengine }}-${{ inputs.flavor }}
name: maestro-logs-android-${{ steps.normalize-app-id.outputs.app-id }}-${{ inputs.jsengine }}-${{ inputs.flavor }}-${{ inputs.architecture }}
path: /tmp/MaestroLogs
+6 -4
View File
@@ -21,6 +21,10 @@ inputs:
required: false
default: "."
description: The directory from which metro should be started
architecture:
required: false
default: "NewArch"
description: The react native architecture to test
runs:
using: composite
@@ -86,8 +90,6 @@ runs:
CURR_ATTEMPT=$((CURR_ATTEMPT+1))
echo "Attempt number $CURR_ATTEMPT"
echo "Start video record using pid: video_record_${{ inputs.jsengine }}_$CURR_ATTEMPT.pid"
xcrun simctl io booted recordVideo video_record_$CURR_ATTEMPT.mov & echo $! > video_record_${{ inputs.jsengine }}_$CURR_ATTEMPT.pid
@@ -105,7 +107,7 @@ runs:
if: always()
uses: actions/upload-artifact@v4.3.4
with:
name: e2e_ios_${{ inputs.app-id }}_report_${{ inputs.jsengine }}_${{ inputs.flavor }}
name: e2e_ios_${{ inputs.app-id }}_report_${{ inputs.jsengine }}_${{ inputs.flavor }}_${{ inputs.architecture }}
path: |
video_record_1.mov
video_record_2.mov
@@ -117,5 +119,5 @@ runs:
if: failure() && steps.run-tests.outcome == 'failure'
uses: actions/upload-artifact@v4.3.4
with:
name: maestro-logs-${{ inputs.app-id }}-${{ inputs.jsengine }}-${{ inputs.flavor }}
name: maestro-logs-${{ inputs.app-id }}-${{ inputs.jsengine }}-${{ inputs.flavor }}-${{ inputs.architecture }}
path: /tmp/MaestroLogs
+3 -2
View File
@@ -55,6 +55,7 @@ async function main() {
stdio: 'ignore',
detached: true,
});
metroProcess.unref();
console.info(`- Metro PID: ${metroProcess.pid}`);
}
@@ -88,15 +89,15 @@ async function main() {
if (IS_DEBUG && metroProcess != null) {
const pid = metroProcess.pid;
console.info(`Kill Metro. PID: ${pid}`);
process.kill(-pid);
process.kill(pid);
console.info(`Metro Killed`);
process.exit();
}
}
if (error) {
throw error;
}
process.exit();
}
function sleep(ms) {
+4 -4
View File
@@ -116,12 +116,12 @@ jobs:
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
build_hermesc_windows:
runs-on: windows-2019
runs-on: windows-2025
needs: prepare_hermes_workspace
env:
HERMES_WS_DIR: 'D:\tmp\hermes'
HERMES_TARBALL_ARTIFACTS_DIR: 'D:\tmp\hermes\hermes-runtime-darwin'
HERMES_OSXBIN_ARTIFACTS_DIR: 'D:\tmp\hermes\osx-bin'
HERMES_WS_DIR: 'C:\tmp\hermes'
HERMES_TARBALL_ARTIFACTS_DIR: 'C:\tmp\hermes\hermes-runtime-darwin'
HERMES_OSXBIN_ARTIFACTS_DIR: 'C:\tmp\hermes\osx-bin'
ICU_URL: "https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-Win64-MSVC2017.zip"
MSBUILD_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin'
CMAKE_DIR: 'C:\Program Files\CMake\bin'
+4 -25
View File
@@ -113,12 +113,12 @@ jobs:
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
build_hermesc_windows:
runs-on: windows-2019
runs-on: windows-2025
needs: prepare_hermes_workspace
env:
HERMES_WS_DIR: 'D:\tmp\hermes'
HERMES_TARBALL_ARTIFACTS_DIR: 'D:\tmp\hermes\hermes-runtime-darwin'
HERMES_OSXBIN_ARTIFACTS_DIR: 'D:\tmp\hermes\osx-bin'
HERMES_WS_DIR: 'C:\tmp\hermes'
HERMES_TARBALL_ARTIFACTS_DIR: 'C:\tmp\hermes\hermes-runtime-darwin'
HERMES_OSXBIN_ARTIFACTS_DIR: 'C:\tmp\hermes\osx-bin'
ICU_URL: "https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-Win64-MSVC2017.zip"
MSBUILD_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin'
CMAKE_DIR: 'C:\Program Files\CMake\bin'
@@ -131,26 +131,6 @@ jobs:
hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }}
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
build_android:
runs-on: 8-core-ubuntu
needs: [set_release_type]
container:
image: reactnativecommunity/react-native-android:latest
env:
TERM: "dumb"
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
ORG_GRADLE_PROJECT_SONATYPE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_SONATYPE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_PASSWORD }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build Android
uses: ./.github/actions/build-android
with:
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
build_npm_package:
runs-on: 8-core-ubuntu
needs:
@@ -160,7 +140,6 @@ jobs:
build_hermes_macos,
build_hermesc_linux,
build_hermesc_windows,
build_android,
]
container:
image: reactnativecommunity/react-native-android:latest
+19 -5
View File
@@ -233,6 +233,7 @@ jobs:
matrix:
jsengine: [Hermes, JSC]
flavor: [Debug, Release]
architecture: [OldArch, NewArch]
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -277,7 +278,12 @@ jobs:
cd /tmp/RNTestProject/ios
bundle install
HERMES_ENGINE_TARBALL_PATH=$HERMES_PATH bundle exec pod install
NEW_ARCH_ENABLED=1
if [[ ${{ matrix.architecture }} == "OldArch" ]]; then
echo "Disable the New Architecture"
NEW_ARCH_ENABLED=0
fi
HERMES_ENGINE_TARBALL_PATH=$HERMES_PATH RCT_NEW_ARCH_ENABLED=$NEW_ARCH_ENABLED bundle exec pod install
xcodebuild \
-scheme "RNTestProject" \
@@ -295,6 +301,7 @@ jobs:
maestro-flow: ./scripts/e2e/.maestro/
flavor: ${{ matrix.flavor }}
working-directory: /tmp/RNTestProject
architecture: ${{ matrix.architecture }}
test_e2e_android_templateapp:
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }}
@@ -306,6 +313,7 @@ jobs:
matrix:
jsengine: [Hermes, JSC]
flavor: [debug, release]
architecture: [OldArch, NewArch]
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -351,6 +359,11 @@ jobs:
cd /tmp/RNTestProject
echo "react.internal.mavenLocalRepo=$MAVEN_LOCAL" >> android/gradle.properties
if [[ ${{matrix.architecture}} == "OldArch" ]]; then
echo "Disabling the New Architecture"
sed -i 's/newArchEnabled=true/newArchEnabled=false/' android/gradle.properties
fi
# Build
cd android
CAPITALIZED_FLAVOR=$(echo "${{ matrix.flavor }}" | awk '{print toupper(substr($0, 1, 1)) substr($0, 2)}')
@@ -366,6 +379,7 @@ jobs:
install-java: 'false'
flavor: ${{ matrix.flavor }}
working-directory: /tmp/RNTestProject
architecture: ${{ matrix.architecture }}
build_hermesc_linux:
runs-on: ubuntu-latest
@@ -383,12 +397,12 @@ jobs:
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
build_hermesc_windows:
runs-on: windows-2019
runs-on: windows-2025
needs: prepare_hermes_workspace
env:
HERMES_WS_DIR: 'D:\tmp\hermes'
HERMES_TARBALL_ARTIFACTS_DIR: 'D:\tmp\hermes\hermes-runtime-darwin'
HERMES_OSXBIN_ARTIFACTS_DIR: 'D:\tmp\hermes\osx-bin'
HERMES_WS_DIR: 'C:\tmp\hermes'
HERMES_TARBALL_ARTIFACTS_DIR: 'C:\tmp\hermes\hermes-runtime-darwin'
HERMES_OSXBIN_ARTIFACTS_DIR: 'C:\tmp\hermes\osx-bin'
ICU_URL: "https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-Win64-MSVC2017.zip"
MSBUILD_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin'
CMAKE_DIR: 'C:\Program Files\CMake\bin'
+1
View File
@@ -6,3 +6,4 @@ ruby ">= 2.6.10"
gem 'cocoapods', '~> 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
gem 'xcodeproj', '< 1.26.0'
gem 'concurrent-ruby', '< 1.3.4'
+2
View File
@@ -54,6 +54,8 @@ nexusPublishing {
sonatype {
username.set(sonatypeUsername)
password.set(sonatypePassword)
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
+8 -8
View File
@@ -5,7 +5,7 @@
"license": "MIT",
"packageManager": "yarn@1.22.22",
"scripts": {
"android": "cd packages/rn-tester && npm run android",
"android": "yarn --cwd packages/rn-tester android",
"build-android": "./gradlew :packages:react-native:ReactAndroid:build",
"build": "node ./scripts/build/build.js",
"clang-format": "clang-format -i --glob=*/**/*.{h,cpp,m,mm}",
@@ -14,14 +14,14 @@
"flow": "flow",
"format-check": "prettier --list-different \"./**/*.{js,md,yml,ts,tsx}\"",
"format": "npm run prettier && npm run clang-format",
"featureflags": "cd packages/react-native && yarn featureflags",
"featureflags": "yarn --cwd packages/react-native featureflags",
"lint-ci": "./scripts/circleci/analyze_code.sh && yarn shellcheck",
"lint-java": "node ./scripts/lint-java.js",
"lint": "eslint .",
"prettier": "prettier --write \"./**/*.{js,md,yml,ts,tsx}\"",
"print-packages": "node ./scripts/monorepo/print",
"shellcheck": "./scripts/circleci/analyze_scripts.sh",
"start": "cd packages/rn-tester && npm run start",
"start": "yarn --cwd packages/rn-tester start",
"set-version": "node ./scripts/releases/set-version.js",
"test-android": "./gradlew :packages:react-native:ReactAndroid:test",
"test-ci": "jest --maxWorkers=2 --ci --reporters=\"default\" --reporters=\"jest-junit\"",
@@ -48,8 +48,8 @@
"@babel/preset-flow": "^7.24.7",
"@definitelytyped/dtslint": "^0.0.127",
"@jest/create-cache-key-function": "^29.6.3",
"@react-native/metro-babel-transformer": "0.77.0-main",
"@react-native/metro-config": "0.77.0-main",
"@react-native/metro-babel-transformer": "0.77.3",
"@react-native/metro-config": "0.77.3",
"@tsconfig/node18": "1.0.1",
"@types/react": "^18.2.6",
"@typescript-eslint/parser": "^7.1.1",
@@ -85,9 +85,9 @@
"jest": "^29.6.3",
"jest-junit": "^10.0.0",
"jscodeshift": "^0.14.0",
"metro-babel-register": "^0.81.0",
"metro-memory-fs": "^0.81.0",
"metro-transform-plugins": "^0.81.0",
"metro-babel-register": "^0.81.5",
"metro-memory-fs": "^0.81.5",
"metro-transform-plugins": "^0.81.5",
"micromatch": "^4.0.4",
"node-fetch": "^2.2.0",
"nullthrows": "^1.1.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/assets-registry",
"version": "0.77.0-main",
"version": "0.77.3",
"description": "Asset support code for React Native.",
"license": "MIT",
"repository": {
+10 -8
View File
@@ -4,13 +4,13 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow strict
* @format
*/
'use strict';
import type {PackagerAsset} from './registry.js';
/*:: import type {PackagerAsset} from './registry.js'; */
const androidScaleSuffix = {
'0.75': 'ldpi',
@@ -27,7 +27,7 @@ const ANDROID_BASE_DENSITY = 160;
* FIXME: using number to represent discrete scale numbers is fragile in essence because of
* floating point numbers imprecision.
*/
function getAndroidAssetSuffix(scale: number): string {
function getAndroidAssetSuffix(scale /*: number */) /*: string */ {
if (scale.toString() in androidScaleSuffix) {
// $FlowFixMe[invalid-computed-prop]
return androidScaleSuffix[scale.toString()];
@@ -53,9 +53,9 @@ const drawableFileTypes = new Set([
]);
function getAndroidResourceFolderName(
asset: PackagerAsset,
scale: number,
): string {
asset /*: PackagerAsset */,
scale /*: number */,
) /*: string */ {
if (!drawableFileTypes.has(asset.type)) {
return 'raw';
}
@@ -73,7 +73,9 @@ function getAndroidResourceFolderName(
return 'drawable-' + suffix;
}
function getAndroidResourceIdentifier(asset: PackagerAsset): string {
function getAndroidResourceIdentifier(
asset /*: PackagerAsset */,
) /*: string */ {
return (getBasePath(asset) + '/' + asset.name)
.toLowerCase()
.replace(/\//g, '_') // Encode folder structure in file name
@@ -81,7 +83,7 @@ function getAndroidResourceIdentifier(asset: PackagerAsset): string {
.replace(/^(?:assets|assetsunstable_path)_/, ''); // Remove "assets_" or "assetsunstable_path_" prefix
}
function getBasePath(asset: PackagerAsset): string {
function getBasePath(asset /*: PackagerAsset */) /*: string */ {
const basePath = asset.httpServerLocation;
return basePath.startsWith('/') ? basePath.slice(1) : basePath;
}
+5 -3
View File
@@ -10,6 +10,7 @@
'use strict';
/*::
export type AssetDestPathResolver = 'android' | 'generic';
export type PackagerAsset = {
@@ -25,16 +26,17 @@ export type PackagerAsset = {
+resolver?: AssetDestPathResolver,
...
};
*/
const assets: Array<PackagerAsset> = [];
const assets /*: Array<PackagerAsset> */ = [];
function registerAsset(asset: PackagerAsset): number {
function registerAsset(asset /*: PackagerAsset */) /*: number */ {
// `push` returns new array length, so the first asset will
// get id 1 (not 0) to make the value truthy
return assets.push(asset);
}
function getAssetByID(assetId: number): PackagerAsset {
function getAssetByID(assetId /*: number */) /*: PackagerAsset */ {
return assets[assetId - 1];
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/babel-plugin-codegen",
"version": "0.77.0-main",
"version": "0.77.3",
"description": "Babel plugin to generate native module and view manager code for React Native.",
"license": "MIT",
"repository": {
@@ -26,7 +26,7 @@
],
"dependencies": {
"@babel/traverse": "^7.25.3",
"@react-native/codegen": "0.77.0-main"
"@react-native/codegen": "0.77.3"
},
"devDependencies": {
"@babel/core": "^7.25.2"
+3 -2
View File
@@ -15,7 +15,7 @@ Start the React Native development server.
#### Usage
```sh
npx react-native start [options]
npx @react-native-community/cli start [options]
```
#### Options
@@ -37,6 +37,7 @@ npx react-native start [options]
| `--cert <path>` | Specify path to a custom SSL cert. |
| `--config <string>` | Path to the CLI configuration file. |
| `--no-interactive` | Disable interactive mode. |
| `--client-logs` | **[Deprecated]** Enable plain text JavaScript log streaming for all connected apps. |
### `bundle`
@@ -45,7 +46,7 @@ Build the bundle for the provided JavaScript entry file.
#### Usage
```sh
npx react-native bundle --entry-file <path> [options]
npx @react-native-community/cli bundle --entry-file <path> [options]
```
#### Options
+9 -10
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/community-cli-plugin",
"version": "0.77.0-main",
"version": "0.77.3",
"description": "Core CLI commands for React Native",
"keywords": [
"react-native",
@@ -22,26 +22,25 @@
"dist"
],
"dependencies": {
"@react-native/dev-middleware": "0.77.0-main",
"@react-native/metro-babel-transformer": "0.77.0-main",
"@react-native/dev-middleware": "0.77.3",
"@react-native/metro-babel-transformer": "0.77.3",
"chalk": "^4.0.0",
"debug": "^2.2.0",
"invariant": "^2.2.4",
"metro": "^0.81.0",
"metro-config": "^0.81.0",
"metro-core": "^0.81.0",
"node-fetch": "^2.2.0",
"metro": "^0.81.5",
"metro-config": "^0.81.5",
"metro-core": "^0.81.5",
"readline": "^1.3.0",
"semver": "^7.1.3"
},
"devDependencies": {
"metro-resolver": "^0.81.0"
"metro-resolver": "^0.81.5"
},
"peerDependencies": {
"@react-native-community/cli-server-api": "*"
"@react-native-community/cli": "*"
},
"peerDependenciesMeta": {
"@react-native-community/cli-server-api": {
"@react-native-community/cli": {
"optional": true
}
},
@@ -12,7 +12,6 @@
import type TerminalReporter from 'metro/src/lib/TerminalReporter';
import chalk from 'chalk';
import fetch from 'node-fetch';
type PageDescription = $ReadOnly<{
id: string,
@@ -95,6 +95,14 @@ const startCommand: Command = {
name: '--no-interactive',
description: 'Disables interactive mode',
},
{
name: '--client-logs',
description:
'[Deprecated] Enable plain text JavaScript log streaming for all ' +
'connected apps. This feature is deprecated and will be removed in ' +
'future.',
default: false,
},
],
};
@@ -9,6 +9,7 @@
* @oncall react_native
*/
import typeof * as CLIServerAPI from '@react-native-community/cli-server-api';
import type {NextHandleFunction, Server} from 'connect';
import type {TerminalReportableEvent} from 'metro/src/lib/TerminalReporter';
@@ -65,11 +66,26 @@ const communityMiddlewareFallback = {
// Attempt to use the community middleware if it exists, but fallback to
// the stubs if it doesn't.
try {
const community = require('@react-native-community/cli-server-api');
communityMiddlewareFallback.indexPageMiddleware =
community.indexPageMiddleware;
// `@react-native-community/cli` is an optional peer dependency of this
// package, and should be a dev dependency of the host project (via the
// community template's package.json).
const communityCliPath = require.resolve('@react-native-community/cli');
// `@react-native-community/cli-server-api` is a dependency of
// `@react-native-community/cli`, but is not re-exported by it, so we need
// to resolve the former through the latter.
const communityCliServerApiPath = require.resolve(
'@react-native-community/cli-server-api',
{paths: [communityCliPath]},
);
// $FlowIgnore[unsupported-syntax] dynamic import
const communityCliServerApi: CLIServerAPI = require(
communityCliServerApiPath,
);
communityMiddlewareFallback.createDevServerMiddleware =
community.createDevServerMiddleware;
communityCliServerApi.createDevServerMiddleware;
communityMiddlewareFallback.indexPageMiddleware =
communityCliServerApi.indexPageMiddleware;
} catch {
debug(`⚠️ Unable to find @react-native-community/cli-server-api
Starting the server without the community middleware.`);
@@ -44,6 +44,7 @@ export type StartCommandArgs = {
config?: string,
projectRoot?: string,
interactive: boolean,
clientLogs: boolean,
};
async function runServer(
@@ -96,6 +97,11 @@ async function runServer(
require.resolve(plugin),
);
}
// TODO(T214991636): Remove legacy Metro log forwarding
if (!args.clientLogs) {
// $FlowIgnore[cannot-write] Assigning to readonly property
metroConfig.server.forwardClientLogs = false;
}
let reportEvent: (event: TerminalReportableEvent) => void;
const terminal = new Terminal(process.stdout);
@@ -10,7 +10,6 @@
*/
import net from 'net';
import fetch from 'node-fetch';
/**
* Determine whether we can run the dev server.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/core-cli-utils",
"version": "0.77.0-main",
"version": "0.77.3",
"description": "React Native CLI library for Frameworks to build on",
"license": "MIT",
"main": "./src/index.flow.js",
+3 -3
View File
@@ -1,9 +1,9 @@
@generated SignedSource<<6b92b66e59525cef52902139f863f175>>
Git revision: b61aae3ccc6e2684dfbf1e2a06b0f985b459f11f
@generated SignedSource<<d09e665db66f49ff47c245adf0a4b543>>
Git revision: 6b80704fd50ea0bf10f5f5da5a4343de29aff8b2
Built with --nohooks: false
Is local checkout: false
Remote URL: https://github.com/facebookexperimental/rn-chrome-devtools-frontend
Remote branch: main
Remote branch: 0.77-stable
GN build args (overrides only):
is_official_build = true
Git status in checkout:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -42,7 +42,7 @@ import*as e from"../../ui/legacy/legacy.js";import*as t from"../../core/host/hos
<p>${d(a.docsDebuggingBasicsDetail)}</p>
</div>
</button>
<button class="rn-welcome-docsfeed-item" type="button" role="link" @click=${this.#o.bind(this,"https://reactnative.dev/docs/react-devtools")} title=${d(a.docsReactNativeDevTools)}>
<button class="rn-welcome-docsfeed-item" type="button" role="link" @click=${this.#o.bind(this,"https://reactnative.dev/docs/react-native-devtools")} title=${d(a.docsReactNativeDevTools)}>
<div class="rn-welcome-image" style="background-image: url('${c}')"></div>
<div>
<p class="devtools-link">${d(a.docsReactNativeDevTools)}</p>
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/debugger-frontend",
"version": "0.77.0-main",
"version": "0.77.3",
"description": "Debugger frontend for React Native based on Chrome DevTools",
"keywords": [
"react-native",
+3 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/dev-middleware",
"version": "0.77.0-main",
"version": "0.77.3",
"description": "Dev server middleware for React Native",
"keywords": [
"react-native",
@@ -23,11 +23,12 @@
],
"dependencies": {
"@isaacs/ttlcache": "^1.4.1",
"@react-native/debugger-frontend": "0.77.0-main",
"@react-native/debugger-frontend": "0.77.3",
"chrome-launcher": "^0.15.2",
"chromium-edge-launcher": "^0.2.0",
"connect": "^3.6.5",
"debug": "^2.2.0",
"invariant": "^2.2.4",
"nullthrows": "^1.1.1",
"open": "^7.0.3",
"selfsigned": "^2.4.1",
@@ -11,7 +11,7 @@
import type {CreateCustomMessageHandlerFn} from './inspector-proxy/CustomMessageHandler';
import type {BrowserLauncher} from './types/BrowserLauncher';
import type {EventReporter} from './types/EventReporter';
import type {EventReporter, ReportableEvent} from './types/EventReporter';
import type {Experiments, ExperimentsConfig} from './types/Experiments';
import type {Logger} from './types/Logger';
import type {NextHandleFunction} from 'connect';
@@ -81,11 +81,15 @@ export default function createDevMiddleware({
unstable_customInspectorMessageHandler,
}: Options): DevMiddlewareAPI {
const experiments = getExperiments(experimentConfig);
const eventReporter = createWrappedEventReporter(
unstable_eventReporter,
logger,
);
const inspectorProxy = new InspectorProxy(
projectRoot,
serverBaseUrl,
unstable_eventReporter,
eventReporter,
experiments,
unstable_customInspectorMessageHandler,
);
@@ -97,7 +101,7 @@ export default function createDevMiddleware({
serverBaseUrl,
inspectorProxy,
browserLauncher: unstable_browserLauncher,
eventReporter: unstable_eventReporter,
eventReporter,
experiments,
logger,
}),
@@ -129,3 +133,32 @@ function getExperiments(config: ExperimentsConfig): Experiments {
enableNetworkInspector: config.enableNetworkInspector ?? false,
};
}
/**
* Creates a wrapped EventReporter that locally intercepts events to
* log to the terminal.
*/
function createWrappedEventReporter(
reporter: ?EventReporter,
logger: ?Logger,
): EventReporter {
return {
logEvent(event: ReportableEvent) {
switch (event.type) {
case 'fusebox_console_notice':
logger?.info(
'\n' +
'\u001B[7m' +
' \u001B[1m💡 JavaScript logs have moved!\u001B[22m They can now be ' +
'viewed in React Native DevTools. Tip: Type \u001B[1mj\u001B[22m in ' +
'the terminal to open (requires Google Chrome or Microsoft Edge).' +
'\u001B[27m' +
'\n',
);
break;
}
reporter?.logEvent(event);
},
};
}
@@ -41,6 +41,8 @@ const PAGES_POLLING_INTERVAL = 1000;
// more details.
const FILE_PREFIX = 'file://';
let fuseboxConsoleNoticeLogged = false;
type DebuggerConnection = {
// Debugger web socket connection
socket: WS,
@@ -513,6 +515,7 @@ export default class Device {
// created instead of manually checking this on every getPages result.
for (const page of this.#pages.values()) {
if (this.#pageHasCapability(page, 'nativePageReloads')) {
this.#logFuseboxConsoleNotice();
continue;
}
@@ -1067,4 +1070,14 @@ export default class Device {
dangerouslyGetSocket(): WS {
return this.#deviceSocket;
}
// TODO(T214991636): Remove notice
#logFuseboxConsoleNotice() {
if (fuseboxConsoleNoticeLogged) {
return;
}
this.#deviceEventReporter?.logFuseboxConsoleNotice();
fuseboxConsoleNoticeLogged = true;
}
}
@@ -212,6 +212,12 @@ class DeviceEventReporter {
});
}
logFuseboxConsoleNotice(): void {
this.#eventReporter.logEvent({
type: 'fusebox_console_notice',
});
}
#logExpiredCommand(pendingCommand: PendingCommand): void {
this.#eventReporter.logEvent({
type: 'debugger_command',
@@ -39,7 +39,7 @@ const WS_DEBUGGER_URL = '/inspector/debug';
const PAGES_LIST_JSON_URL = '/json';
const PAGES_LIST_JSON_URL_2 = '/json/list';
const PAGES_LIST_JSON_VERSION_URL = '/json/version';
const MAX_PONG_LATENCY_MS = 5000;
const MAX_PONG_LATENCY_MS = 60000;
const DEBUGGER_HEARTBEAT_INTERVAL_MS = 10000;
const INTERNAL_ERROR_CODE = 1011;
@@ -77,6 +77,9 @@ export type ReportableEvent =
| 'PROTOCOL_ERROR',
>,
}
| {
type: 'fusebox_console_notice',
}
| {
type: 'proxy_error',
status: 'error',
@@ -1,6 +1,6 @@
{
"name": "@react-native/eslint-config",
"version": "0.77.0-main",
"version": "0.77.3",
"description": "ESLint config for React Native",
"license": "MIT",
"repository": {
@@ -22,7 +22,7 @@
"dependencies": {
"@babel/core": "^7.25.2",
"@babel/eslint-parser": "^7.25.1",
"@react-native/eslint-plugin": "0.77.0-main",
"@react-native/eslint-plugin": "0.77.3",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"eslint-config-prettier": "^8.5.0",
@@ -1,6 +1,6 @@
{
"name": "@react-native/eslint-plugin",
"version": "0.77.0-main",
"version": "0.77.3",
"description": "ESLint rules for @react-native/eslint-config",
"license": "MIT",
"repository": {
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/eslint-plugin-specs",
"version": "0.77.0-main",
"version": "0.77.3",
"description": "ESLint rules to validate NativeModule and Component Specs",
"license": "MIT",
"repository": {
@@ -26,7 +26,7 @@
"dependencies": {
"@babel/core": "^7.25.2",
"@babel/plugin-transform-flow-strip-types": "^7.25.2",
"@react-native/codegen": "0.77.0-main",
"@react-native/codegen": "0.77.3",
"make-dir": "^2.1.0",
"pirates": "^4.0.1",
"source-map-support": "0.5.0"
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/gradle-plugin",
"version": "0.77.0-main",
"version": "0.77.3",
"description": "Gradle Plugin for React Native",
"license": "MIT",
"repository": {
@@ -12,6 +12,7 @@ import com.facebook.react.utils.detectOSAwareHermesCommand
import com.facebook.react.utils.moveTo
import com.facebook.react.utils.windowsAwareCommandLine
import java.io.File
import javax.inject.Inject
import org.gradle.api.DefaultTask
import org.gradle.api.file.ConfigurableFileTree
import org.gradle.api.file.DirectoryProperty
@@ -19,6 +20,7 @@ import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.*
import org.gradle.process.ExecOperations
abstract class BundleHermesCTask : DefaultTask() {
@@ -26,6 +28,8 @@ abstract class BundleHermesCTask : DefaultTask() {
group = "react"
}
@get:Inject abstract val execOperations: ExecOperations
@get:Internal abstract val root: DirectoryProperty
@get:InputFiles
@@ -127,9 +131,9 @@ abstract class BundleHermesCTask : DefaultTask() {
File(jsIntermediateSourceMapsDir.get().asFile, "$bundleAssetName.compiler.map")
private fun runCommand(command: List<Any>) {
project.exec {
it.workingDir(root.get().asFile)
it.commandLine(command)
execOperations.exec { exec ->
exec.workingDir(root.get().asFile)
exec.commandLine(command)
}
}
@@ -39,7 +39,7 @@ abstract class BuildCodegenCLITask : Exec() {
}
override fun exec() {
val logfile = "${project.layout.buildDirectory}/build-cli.log"
val logfile = "${project.layout.buildDirectory.getAsFile().get()}/build-cli.log"
File(logfile).apply {
parentFile.mkdirs()
if (exists()) {
@@ -8,10 +8,12 @@
package com.facebook.react.utils
import com.facebook.react.utils.PropertyUtils.DEFAULT_INTERNAL_PUBLISHING_GROUP
import com.facebook.react.utils.PropertyUtils.EXCLUSIVE_ENTEPRISE_REPOSITORY
import com.facebook.react.utils.PropertyUtils.INTERNAL_PUBLISHING_GROUP
import com.facebook.react.utils.PropertyUtils.INTERNAL_REACT_NATIVE_MAVEN_LOCAL_REPO
import com.facebook.react.utils.PropertyUtils.INTERNAL_USE_HERMES_NIGHTLY
import com.facebook.react.utils.PropertyUtils.INTERNAL_VERSION_NAME
import com.facebook.react.utils.PropertyUtils.SCOPED_EXCLUSIVE_ENTEPRISE_REPOSITORY
import java.io.File
import java.net.URI
import java.util.*
@@ -25,6 +27,12 @@ internal object DependencyUtils {
* party libraries which are auto-linked.
*/
fun configureRepositories(project: Project, reactNativeDir: File) {
val exclusiveEnterpriseRepository = project.rootProject.exclusiveEnterpriseRepository()
if (exclusiveEnterpriseRepository != null) {
project.logger.lifecycle(
"Replacing ALL Maven Repositories with: $exclusiveEnterpriseRepository")
}
project.rootProject.allprojects { eachProject ->
with(eachProject) {
if (hasProperty(INTERNAL_REACT_NATIVE_MAVEN_LOCAL_REPO)) {
@@ -33,8 +41,18 @@ internal object DependencyUtils {
repo.content { it.excludeGroup("org.webkit") }
}
}
if (exclusiveEnterpriseRepository != null) {
// We remove all previously set repositories and only configure the proxy provided by the
// user.
rootProject.repositories.clear()
mavenRepoFromUrl(exclusiveEnterpriseRepository)
// We return here as we don't want to configure other repositories as well.
return@allprojects
}
// We add the snapshot for users on nightlies.
mavenRepoFromUrl("https://oss.sonatype.org/content/repositories/snapshots/") { repo ->
mavenRepoFromUrl("https://central.sonatype.com/repository/maven-snapshots/") { repo ->
repo.content { it.excludeGroup("org.webkit") }
}
repositories.mavenCentral { repo ->
@@ -169,4 +187,13 @@ internal object DependencyUtils {
it.url = uri
action(it)
}
internal fun Project.exclusiveEnterpriseRepository() =
when {
hasProperty(SCOPED_EXCLUSIVE_ENTEPRISE_REPOSITORY) ->
property(SCOPED_EXCLUSIVE_ENTEPRISE_REPOSITORY).toString()
hasProperty(EXCLUSIVE_ENTEPRISE_REPOSITORY) ->
property(EXCLUSIVE_ENTEPRISE_REPOSITORY).toString()
else -> null
}
}
@@ -22,6 +22,12 @@ object PropertyUtils {
const val REACT_NATIVE_ARCHITECTURES = "reactNativeArchitectures"
const val SCOPED_REACT_NATIVE_ARCHITECTURES = "react.nativeArchitectures"
/**
* Public property that allows to configure an enterprise repository proxy as exclusive repository
*/
const val EXCLUSIVE_ENTEPRISE_REPOSITORY = "exclusiveEnterpriseRepository"
const val SCOPED_EXCLUSIVE_ENTEPRISE_REPOSITORY = "react.exclusiveEnterpriseRepository"
/**
* Internal Property that acts as a killswitch to configure the JDK version and align it for app
* and all the libraries.
@@ -10,6 +10,7 @@ package com.facebook.react.utils
import com.facebook.react.tests.createProject
import com.facebook.react.utils.DependencyUtils.configureDependencies
import com.facebook.react.utils.DependencyUtils.configureRepositories
import com.facebook.react.utils.DependencyUtils.exclusiveEnterpriseRepository
import com.facebook.react.utils.DependencyUtils.getDependencySubstitutions
import com.facebook.react.utils.DependencyUtils.mavenRepoFromURI
import com.facebook.react.utils.DependencyUtils.mavenRepoFromUrl
@@ -44,7 +45,7 @@ class DependencyUtilsTest {
@Test
fun configureRepositories_containsSnapshotRepo() {
val repositoryURI = URI.create("https://oss.sonatype.org/content/repositories/snapshots/")
val repositoryURI = URI.create("https://central.sonatype.com/repository/maven-snapshots/")
val project = createProject()
configureRepositories(project, tempFolder.root)
@@ -107,7 +108,24 @@ class DependencyUtilsTest {
val project = createProject()
configureRepositories(project, tempFolder.root)
assertThat(
project.repositories.firstOrNull {
it is MavenArtifactRepository && it.url == repositoryURI
})
.isNotNull()
}
@Test
fun configureRepositories_withExclusiveEnterpriseRepository_replacesAllRepositories() {
val repositoryURI = URI.create("https://maven.myfabolousorganization.it")
val project = createProject()
project.rootProject.extensions.extraProperties.set(
"exclusiveEnterpriseRepository", repositoryURI.toString())
configureRepositories(project, tempFolder.root)
assertThat(project.repositories).hasSize(1)
assertThat(
project.repositories.firstOrNull {
it is MavenArtifactRepository && it.url == repositoryURI
@@ -138,7 +156,7 @@ class DependencyUtilsTest {
@Test
fun configureRepositories_snapshotRepoHasHigherPriorityThanMavenCentral() {
val repositoryURI = URI.create("https://oss.sonatype.org/content/repositories/snapshots/")
val repositoryURI = URI.create("https://central.sonatype.com/repository/maven-snapshots/")
val mavenCentralURI = URI.create("https://repo.maven.apache.org/maven2/")
val project = createProject()
@@ -421,4 +439,28 @@ class DependencyUtilsTest {
assertThat(mavenRepo.url).isEqualTo(repoFolder.toURI())
}
@Test
fun exclusiveEnterpriseRepository_withScopedProperty() {
val project = createProject(tempFolder.root)
project.extensions.extraProperties.set(
"react.exclusiveEnterpriseRepository", "https://maven.myfabolousorganization.it")
assertThat(project.exclusiveEnterpriseRepository())
.isEqualTo("https://maven.myfabolousorganization.it")
}
@Test
fun exclusiveEnterpriseRepository_withUnscopedProperty() {
val project = createProject(tempFolder.root)
project.extensions.extraProperties.set(
"exclusiveEnterpriseRepository", "https://maven.myfabolousorganization.it")
assertThat(project.exclusiveEnterpriseRepository())
.isEqualTo("https://maven.myfabolousorganization.it")
}
@Test
fun exclusiveEnterpriseRepository_defaultIsTrue() {
val project = createProject(tempFolder.root)
assertThat(project.exclusiveEnterpriseRepository()).isNull()
}
}
+1
View File
@@ -5,3 +5,4 @@ ruby ">= 2.6.10"
gem 'cocoapods', '~> 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
gem 'xcodeproj', '< 1.26.0'
gem 'concurrent-ruby', '< 1.3.4'
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "helloworld",
"version": "0.77.0-main",
"version": "0.77.3",
"private": true,
"scripts": {
"bootstrap": "node ./cli.js bootstrap",
@@ -13,16 +13,16 @@
},
"dependencies": {
"react": "18.3.1",
"react-native": "1000.0.0"
"react-native": "0.77.3"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native/babel-preset": "0.77.0-main",
"@react-native/core-cli-utils": "0.77.0-main",
"@react-native/eslint-config": "0.77.0-main",
"@react-native/metro-config": "0.77.0-main",
"@react-native/babel-preset": "0.77.3",
"@react-native/core-cli-utils": "0.77.3",
"@react-native/eslint-config": "0.77.3",
"@react-native/metro-config": "0.77.3",
"chalk": "^4.1.2",
"commander": "^12.0.0",
"eslint": "^8.19.0",
@@ -1,6 +1,6 @@
{
"name": "@react-native/hermes-inspector-msggen",
"version": "0.77.0-main",
"version": "0.77.3",
"private": true,
"description": "Hermes Inspector Message Generator for React Native",
"license": "MIT",
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/metro-config",
"version": "0.77.0-main",
"version": "0.77.3",
"description": "Metro configuration for React Native.",
"license": "MIT",
"repository": {
@@ -26,9 +26,9 @@
"dist"
],
"dependencies": {
"@react-native/js-polyfills": "0.77.0-main",
"@react-native/metro-babel-transformer": "0.77.0-main",
"metro-config": "^0.81.0",
"metro-runtime": "^0.81.0"
"@react-native/js-polyfills": "0.77.3",
"@react-native/metro-babel-transformer": "0.77.3",
"metro-config": "^0.81.5",
"metro-runtime": "^0.81.5"
}
}
+1 -1
View File
@@ -54,7 +54,7 @@ export function getDefaultConfig(projectRoot: string): ConfigT {
resolver: {
resolverMainFields: ['react-native', 'browser', 'main'],
platforms: ['android', 'ios'],
unstable_conditionNames: ['require', 'import', 'react-native'],
unstable_conditionNames: ['react-native'],
},
serializer: {
// Note: This option is overridden in cli-plugin-metro (getOverrideConfig)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/normalize-colors",
"version": "0.77.0-main",
"version": "0.77.3",
"description": "Color normalization for React Native.",
"license": "MIT",
"repository": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/js-polyfills",
"version": "0.77.0-main",
"version": "0.77.3",
"description": "Polyfills for React Native.",
"license": "MIT",
"repository": {
@@ -1,6 +1,6 @@
{
"name": "@react-native/babel-preset",
"version": "0.77.0-main",
"version": "0.77.3",
"description": "Babel preset for React Native applications",
"main": "src/index.js",
"repository": {
@@ -55,7 +55,7 @@
"@babel/plugin-transform-typescript": "^7.25.2",
"@babel/plugin-transform-unicode-regex": "^7.24.7",
"@babel/template": "^7.25.0",
"@react-native/babel-plugin-codegen": "0.77.0-main",
"@react-native/babel-plugin-codegen": "0.77.3",
"babel-plugin-syntax-hermes-parser": "0.25.1",
"babel-plugin-transform-flow-enums": "^0.0.2",
"react-refresh": "^0.14.0"
@@ -1,6 +1,6 @@
{
"name": "@react-native/metro-babel-transformer",
"version": "0.77.0-main",
"version": "0.77.3",
"description": "Babel transformer for React Native applications.",
"main": "src/index.js",
"repository": {
@@ -16,7 +16,7 @@
"license": "MIT",
"dependencies": {
"@babel/core": "^7.25.2",
"@react-native/babel-preset": "0.77.0-main",
"@react-native/babel-preset": "0.77.3",
"hermes-parser": "0.25.1",
"nullthrows": "^1.1.1"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@react-native/bots",
"description": "React Native Bots",
"version": "0.77.0-main",
"version": "0.77.3",
"private": true,
"license": "MIT",
"repository": {
@@ -1,6 +1,6 @@
{
"name": "@react-native/codegen-typescript-test",
"version": "0.77.0-main",
"version": "0.77.3",
"private": true,
"description": "TypeScript related unit test for @react-native/codegen",
"license": "MIT",
@@ -19,7 +19,7 @@
"prepare": "yarn run build"
},
"dependencies": {
"@react-native/codegen": "0.77.0-main"
"@react-native/codegen": "0.77.3"
},
"devDependencies": {
"@babel/core": "^7.25.2",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/codegen",
"version": "0.77.0-main",
"version": "0.77.3",
"description": "Code generation tools for React Native",
"license": "MIT",
"repository": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "react-native-info",
"version": "0.77.0-main",
"version": "0.77.3",
"main": "build/index.js",
"license": "MIT",
"private": true,
@@ -1,6 +1,6 @@
{
"name": "@react-native/popup-menu-android",
"version": "0.77.0-main",
"version": "0.77.3",
"description": "PopupMenu for the Android platform",
"main": "index.js",
"files": [
@@ -17,7 +17,7 @@
],
"license": "MIT",
"devDependencies": {
"@react-native/codegen": "0.77.0-main"
"@react-native/codegen": "0.77.3"
},
"peerDependencies": {
"@types/react": "^18.2.6",
@@ -1,6 +1,6 @@
{
"name": "@react-native/oss-library-example",
"version": "0.77.0-main",
"version": "0.77.3",
"private": true,
"description": "Package that includes native module exapmle, native component example, targets both the old and the new architecture. It should serve as an example of a real-world OSS library.",
"license": "MIT",
@@ -26,8 +26,8 @@
],
"devDependencies": {
"@babel/core": "^7.25.2",
"@react-native/babel-preset": "0.77.0-main",
"react-native": "1000.0.0"
"@react-native/babel-preset": "0.77.3",
"react-native": "0.77.3"
},
"peerDependencies": {
"react": "*",
@@ -1,7 +1,7 @@
{
"name": "@react-native/test-renderer",
"private": true,
"version": "0.77.0-main",
"version": "0.77.3",
"description": "A Test rendering library for React Native",
"license": "MIT",
"devDependencies": {
@@ -106,17 +106,17 @@ export function allowTransformProp(prop: string): void {
}
export function isSupportedColorStyleProp(prop: string): boolean {
return Object.hasOwn(SUPPORTED_COLOR_STYLES, prop);
return SUPPORTED_COLOR_STYLES.hasOwnProperty(prop);
}
export function isSupportedInterpolationParam(param: string): boolean {
return Object.hasOwn(SUPPORTED_INTERPOLATION_PARAMS, param);
return SUPPORTED_INTERPOLATION_PARAMS.hasOwnProperty(param);
}
export function isSupportedStyleProp(prop: string): boolean {
return Object.hasOwn(SUPPORTED_STYLES, prop);
return SUPPORTED_STYLES.hasOwnProperty(prop);
}
export function isSupportedTransformProp(prop: string): boolean {
return Object.hasOwn(SUPPORTED_TRANSFORMS, prop);
return SUPPORTED_TRANSFORMS.hasOwnProperty(prop);
}
@@ -121,12 +121,10 @@ describe('Animated', () => {
await unmount(root);
expect(callback).not.toBeCalled();
await jest.runOnlyPendingTimersAsync();
expect(callback).toBeCalledWith({finished: false});
});
it('triggers callback when spring is at rest', async () => {
it('triggers callback when spring is at rest', () => {
const anim = new Animated.Value(0);
const callback = jest.fn();
Animated.spring(anim, {
@@ -134,10 +132,7 @@ describe('Animated', () => {
velocity: 0,
useNativeDriver: false,
}).start(callback);
expect(callback).not.toBeCalled();
await jest.runOnlyPendingTimersAsync();
expect(callback).toBeCalledWith({finished: true});
expect(callback).toBeCalled();
});
it('send toValue when a critically damped spring stops', () => {
@@ -165,7 +165,7 @@ export default class Animation {
const callback = this.#onEnd;
if (callback != null) {
this.#onEnd = null;
queueMicrotask(() => callback(result));
callback(result);
}
}
}
@@ -37,7 +37,7 @@ function createAnimatedProps(
const key = keys[ii];
const value = inputProps[key];
if (allowlist == null || Object.hasOwn(allowlist, key)) {
if (allowlist == null || hasOwn(allowlist, key)) {
let node;
if (key === 'style') {
node = AnimatedStyle.from(value, allowlist?.style);
@@ -271,3 +271,11 @@ export default class AnimatedProps extends AnimatedNode {
};
}
}
// Supported versions of JSC do not implement the newer Object.hasOwn. Remove
// this shim when they do.
// $FlowIgnore[method-unbinding]
const _hasOwnProp = Object.prototype.hasOwnProperty;
const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean =
// $FlowIgnore[method-unbinding]
Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop));
@@ -35,7 +35,7 @@ function createAnimatedStyle(
const key = keys[ii];
const value = inputStyle[key];
if (allowlist == null || Object.hasOwn(allowlist, key)) {
if (allowlist == null || hasOwn(allowlist, key)) {
let node;
if (value != null && key === 'transform') {
node = ReactNativeFeatureFlags.shouldUseAnimatedObjectForTransform()
@@ -241,3 +241,11 @@ export default class AnimatedStyle extends AnimatedWithChildren {
};
}
}
// Supported versions of JSC do not implement the newer Object.hasOwn. Remove
// this shim when they do.
// $FlowIgnore[method-unbinding]
const _hasOwnProp = Object.prototype.hasOwnProperty;
const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean =
// $FlowIgnore[method-unbinding]
Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop));
+3 -3
View File
@@ -14,9 +14,9 @@ const version: $ReadOnly<{
patch: number,
prerelease: string | null,
}> = {
major: 1000,
minor: 0,
patch: 0,
major: 0,
minor: 77,
patch: 3,
prerelease: null,
};
@@ -42,9 +42,8 @@ if (__DEV__) {
if (!Platform.isTesting) {
const HMRClient = require('../Utilities/HMRClient');
if (global.__FUSEBOX_HAS_FULL_CONSOLE_SUPPORT__) {
HMRClient.unstable_notifyFuseboxConsoleEnabled();
} else if (console._isPolyfilled) {
// TODO(T214991636): Remove legacy Metro log forwarding
if (console._isPolyfilled) {
// We assume full control over the console and send JavaScript logs to Metro.
[
'trace',
@@ -133,6 +133,7 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
width: undefined,
height: undefined,
};
const defaultSource = resolveAssetSource(props.defaultSource);
const loadingIndicatorSource = resolveAssetSource(
props.loadingIndicatorSource,
);
@@ -178,6 +179,7 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
headers: (source?.[0]?.headers || source?.headers: ?{[string]: string}),
defaultSource: defaultSource ? defaultSource.uri : null,
loadingIndicatorSrc: loadingIndicatorSource
? loadingIndicatorSource.uri
: null,
@@ -21,6 +21,7 @@ import type {
} from '../StyleSheet/StyleSheet';
import type {ResolvedAssetSource} from './AssetSourceResolver';
import type {ImageProps} from './ImageProps';
import type {ImageSource} from './ImageSource';
import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry';
import {ConditionallyIgnoredEventHandlers} from '../NativeComponent/ViewConfigIgnore';
@@ -42,7 +43,7 @@ type Props = $ReadOnly<{
| ?ResolvedAssetSource
| ?$ReadOnlyArray<?$ReadOnly<{uri?: ?string, ...}>>,
headers?: ?{[string]: string},
defaultSrc?: ?string,
defaultSource?: ?ImageSource | ?string,
loadingIndicatorSrc?: ?string,
}>;
@@ -82,9 +83,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
},
validAttributes: {
blurRadius: true,
defaultSource: {
process: require('./resolveAssetSource'),
},
defaultSource: true,
internal_analyticTag: true,
resizeMethod: true,
resizeMode: true,
@@ -477,7 +477,15 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image, CGSize size, CGFloat scal
// Add missing png extension
if (request.URL.fileURL && request.URL.pathExtension.length == 0) {
mutableRequest.URL = [request.URL URLByAppendingPathExtension:@"png"];
// Check if there exists a file with that url on disk already
// This should fix issue https://github.com/facebook/react-native/issues/46870
if ([[NSFileManager defaultManager] fileExistsAtPath:request.URL.path]) {
mutableRequest.URL = request.URL;
} else {
// This is the default behavior in case there is no file on disk with no extension.
// We assume that the extension is `png`.
mutableRequest.URL = [request.URL URLByAppendingPathExtension:@"png"];
}
}
if (_redirectDelegate != nil) {
mutableRequest.URL = [_redirectDelegate redirectAssetsURL:mutableRequest.URL];
+11 -3
View File
@@ -28,6 +28,15 @@ type FormDataPart =
...
};
/**
* Encode a FormData filename compliant with RFC 2183
*
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#directives
*/
function encodeFilename(filename: string): string {
return encodeURIComponent(filename.replace(/\//g, '_'));
}
/**
* Polyfill for XMLHttpRequest2 FormData API, allowing multipart POST requests
* with mixed data (string, native files) to be submitted via XMLHttpRequest.
@@ -82,9 +91,8 @@ class FormData {
// content type (cf. web Blob interface.)
if (typeof value === 'object' && !Array.isArray(value) && value) {
if (typeof value.name === 'string') {
headers['content-disposition'] += `; filename="${
value.name
}"; filename*=utf-8''${encodeURI(value.name)}`;
headers['content-disposition'] +=
`; filename="${encodeFilename(value.name)}"`;
}
if (typeof value.type === 'string') {
headers['content-type'] = value.type;
@@ -8,6 +8,8 @@
#import <React/RCTDataRequestHandler.h>
#import <ReactCommon/RCTTurboModule.h>
#import <mutex>
#import "RCTNetworkPlugins.h"
@interface RCTDataRequestHandler () <RCTTurboModule>
@@ -15,14 +17,22 @@
@implementation RCTDataRequestHandler {
NSOperationQueue *_queue;
std::mutex _operationHandlerMutexLock;
}
RCT_EXPORT_MODULE()
- (void)invalidate
{
[_queue cancelAllOperations];
_queue = nil;
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
if (_queue) {
for (NSOperation *operation in _queue.operations) {
if (!operation.isCancelled && !operation.isFinished) {
[operation cancel];
}
}
_queue = nil;
}
}
- (BOOL)canHandleRequest:(NSURLRequest *)request
@@ -32,6 +42,7 @@ RCT_EXPORT_MODULE()
- (NSOperation *)sendRequest:(NSURLRequest *)request withDelegate:(id<RCTURLRequestDelegate>)delegate
{
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
// Lazy setup
if (!_queue) {
_queue = [NSOperationQueue new];
@@ -69,7 +80,10 @@ RCT_EXPORT_MODULE()
- (void)cancelRequest:(NSOperation *)op
{
[op cancel];
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
if (!op.isCancelled && !op.isFinished) {
[op cancel];
}
}
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
@@ -7,6 +7,8 @@
#import <React/RCTFileRequestHandler.h>
#import <mutex>
#import <MobileCoreServices/MobileCoreServices.h>
#import <React/RCTUtils.h>
@@ -19,14 +21,22 @@
@implementation RCTFileRequestHandler {
NSOperationQueue *_fileQueue;
std::mutex _operationHandlerMutexLock;
}
RCT_EXPORT_MODULE()
- (void)invalidate
{
[_fileQueue cancelAllOperations];
_fileQueue = nil;
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
if (_fileQueue) {
for (NSOperation *operation in _fileQueue.operations) {
if (!operation.isCancelled && !operation.isFinished) {
[operation cancel];
}
}
_fileQueue = nil;
}
}
- (BOOL)canHandleRequest:(NSURLRequest *)request
@@ -36,6 +46,7 @@ RCT_EXPORT_MODULE()
- (NSOperation *)sendRequest:(NSURLRequest *)request withDelegate:(id<RCTURLRequestDelegate>)delegate
{
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
// Lazy setup
if (!_fileQueue) {
_fileQueue = [NSOperationQueue new];
@@ -83,7 +94,10 @@ RCT_EXPORT_MODULE()
- (void)cancelRequest:(NSOperation *)op
{
[op cancel];
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
if (!op.isCancelled && !op.isFinished) {
[op cancel];
}
}
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
@@ -48,8 +48,7 @@ describe('FormData', function () {
type: 'image/jpeg',
name: 'photo.jpg',
headers: {
'content-disposition':
'form-data; name="photo"; filename="photo.jpg"; filename*=utf-8\'\'photo.jpg',
'content-disposition': 'form-data; name="photo"; filename="photo.jpg"',
'content-type': 'image/jpeg',
},
fieldName: 'photo',
@@ -70,7 +69,7 @@ describe('FormData', function () {
name: '测试photo.jpg',
headers: {
'content-disposition':
'form-data; name="photo"; filename="测试photo.jpg"; filename*=utf-8\'\'%E6%B5%8B%E8%AF%95photo.jpg',
'form-data; name="photo"; filename="%E6%B5%8B%E8%AF%95photo.jpg"',
'content-type': 'image/jpeg',
},
fieldName: 'photo',
@@ -476,7 +476,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
_maxLength.integerValue - (NSInteger)backedTextInputView.attributedText.string.length + (NSInteger)range.length,
0);
if (text.length > _maxLength.integerValue) {
if (text.length > allowedLength) {
// If we typed/pasted more than one character, limit the text inputted.
if (text.length > 1) {
if (allowedLength > 0) {
-28
View File
@@ -26,7 +26,6 @@ let hmrUnavailableReason: string | null = null;
let currentCompileErrorMessage: string | null = null;
let didConnect: boolean = false;
let pendingLogs: Array<[LogLevel, $ReadOnlyArray<mixed>]> = [];
let pendingFuseboxConsoleNotification = false;
type LogLevel =
| 'trace'
@@ -52,7 +51,6 @@ export type HMRClientNativeInterface = {|
isEnabled: boolean,
scheme?: string,
): void,
unstable_notifyFuseboxConsoleEnabled(): void,
|};
/**
@@ -142,29 +140,6 @@ const HMRClient: HMRClientNativeInterface = {
}
},
unstable_notifyFuseboxConsoleEnabled() {
if (!hmrClient) {
pendingFuseboxConsoleNotification = true;
return;
}
hmrClient.send(
JSON.stringify({
type: 'log',
level: 'info',
data: [
'\n' +
'\u001B[7m' +
' \u001B[1m💡 JavaScript logs have moved!\u001B[22m They can now be ' +
'viewed in React Native DevTools. Tip: Type \u001B[1mj\u001B[22m in ' +
'the terminal to open (requires Google Chrome or Microsoft Edge).' +
'\u001B[27m' +
'\n',
],
}),
);
pendingFuseboxConsoleNotification = false;
},
// Called once by the bridge on startup, even if Fast Refresh is off.
// It creates the HMR client but doesn't actually set up the socket yet.
setup(
@@ -341,9 +316,6 @@ function flushEarlyLogs(client: MetroHMRClient) {
pendingLogs.forEach(([level, data]) => {
HMRClient.log(level, data);
});
if (pendingFuseboxConsoleNotification) {
HMRClient.unstable_notifyFuseboxConsoleEnabled();
}
} finally {
pendingLogs.length = 0;
}
@@ -25,7 +25,6 @@ const HMRClientProdShim: HMRClientNativeInterface = {
disable() {},
registerBundle() {},
log() {},
unstable_notifyFuseboxConsoleEnabled() {},
};
module.exports = HMRClientProdShim;
@@ -5004,7 +5004,7 @@ exports[`public API should not change unintentionally Libraries/Image/ImageViewN
| ?ResolvedAssetSource
| ?$ReadOnlyArray<?$ReadOnly<{ uri?: ?string, ... }>>,
headers?: ?{ [string]: string },
defaultSrc?: ?string,
defaultSource?: ?ImageSource | ?string,
loadingIndicatorSrc?: ?string,
}>;
interface NativeCommands {
@@ -8942,7 +8942,6 @@ export type HMRClientNativeInterface = {|
isEnabled: boolean,
scheme?: string
): void,
unstable_notifyFuseboxConsoleEnabled(): void,
|};
declare const HMRClient: HMRClientNativeInterface;
declare module.exports: HMRClient;
@@ -21,9 +21,9 @@ NSDictionary* RCTGetReactNativeVersion(void)
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^(void){
__rnVersion = @{
RCTVersionMajor: @(1000),
RCTVersionMinor: @(0),
RCTVersionPatch: @(0),
RCTVersionMajor: @(0),
RCTVersionMinor: @(77),
RCTVersionPatch: @(3),
RCTVersionPrerelease: [NSNull null],
};
});
@@ -54,13 +54,11 @@
]];
UIButton *resumeButton = [UIButton buttonWithType:UIButtonTypeCustom];
[resumeButton setImage:[UIImage systemImageNamed:@"forward.frame.fill"] forState:UIControlStateNormal];
UIImage *image = [UIImage systemImageNamed:@"forward.frame.fill"];
[resumeButton setImage:image forState:UIControlStateNormal];
[resumeButton setImage:image forState:UIControlStateDisabled];
resumeButton.tintColor = [UIColor colorWithRed:0.37 green:0.37 blue:0.37 alpha:1];
resumeButton.configurationUpdateHandler = ^(UIButton *button) {
button.imageView.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;
};
resumeButton.enabled = NO;
[NSLayoutConstraint activateConstraints:@[
[resumeButton.widthAnchor constraintEqualToConstant:48],
@@ -170,10 +170,24 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
{
[_viewsToBeMounted addObject:@{
kRCTLegacyInteropChildIndexKey : [NSNumber numberWithInteger:index],
kRCTLegacyInteropChildComponentKey : childComponentView
}];
if (_adapter && index == _adapter.paperView.reactSubviews.count) {
// This is a new child view that is being added to the end of the children array.
// After the children is added, we need to call didUpdateReactSubviews to make sure that it is rendered.
// Without this change, the new child will not be rendered right away because the didUpdateReactSubviews is not
// called and the `finalizeUpdate` is not invoked.
if ([childComponentView isKindOfClass:[RCTLegacyViewManagerInteropComponentView class]]) {
UIView *target = ((RCTLegacyViewManagerInteropComponentView *)childComponentView).contentView;
[_adapter.paperView insertReactSubview:target atIndex:index];
} else {
[_adapter.paperView insertReactSubview:childComponentView atIndex:index];
}
[_adapter.paperView didUpdateReactSubviews];
} else {
[_viewsToBeMounted addObject:@{
kRCTLegacyInteropChildIndexKey : [NSNumber numberWithInteger:index],
kRCTLegacyInteropChildComponentKey : childComponentView
}];
}
}
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
@@ -10,7 +10,7 @@
/**
* UIView class for root <ModalHostView> component.
*/
@interface RCTModalHostViewComponentView : RCTViewComponentView
@interface RCTModalHostViewComponentView : RCTViewComponentView <UIAdaptivePresentationControllerDelegate>
/**
* Subclasses may override this method and present the modal on different view controller.
@@ -104,7 +104,6 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
BOOL _shouldAnimatePresentation;
BOOL _shouldPresent;
BOOL _isPresented;
UIView *_modalContentsSnapshot;
}
- (instancetype)initWithFrame:(CGRect)frame
@@ -141,7 +140,6 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
animated:(BOOL)animated
completion:(void (^)(void))completion
{
_modalContentsSnapshot = [self.viewController.view snapshotViewAfterScreenUpdates:NO];
[modalViewController dismissViewControllerAnimated:animated completion:completion];
}
@@ -149,6 +147,8 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
{
BOOL shouldBePresented = !_isPresented && _shouldPresent && self.window;
if (shouldBePresented) {
self.viewController.presentationController.delegate = self;
_isPresented = YES;
[self presentViewController:self.viewController
animated:_shouldAnimatePresentation
@@ -165,8 +165,7 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
_isPresented = NO;
// To animate dismissal of view controller, snapshot of
// view hierarchy needs to be added to the UIViewController.
UIView *snapshot = _modalContentsSnapshot;
UIView *snapshot = [self.viewController.view snapshotViewAfterScreenUpdates:NO];
if (_shouldPresent) {
[self.viewController.view addSubview:snapshot];
}
@@ -274,6 +273,16 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
[childComponentView removeFromSuperview];
}
#pragma mark - UIAdaptivePresentationControllerDelegate
- (void)presentationControllerDidAttemptToDismiss:(UIPresentationController *)controller
{
auto eventEmitter = [self modalEventEmitter];
if (eventEmitter) {
eventEmitter->onRequestClose({});
}
}
@end
#ifdef __cplusplus
@@ -189,10 +189,11 @@ RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrollView, NSInt
UIEdgeInsets newEdgeInsets = _scrollView.contentInset;
CGFloat inset = MAX(scrollViewLowerY - keyboardEndFrame.origin.y, 0);
const auto &props = static_cast<const ScrollViewProps &>(*_props);
if (isInverted) {
newEdgeInsets.top = MAX(inset, _scrollView.contentInset.top);
newEdgeInsets.top = MAX(inset, props.contentInset.top);
} else {
newEdgeInsets.bottom = MAX(inset, _scrollView.contentInset.bottom);
newEdgeInsets.bottom = MAX(inset, props.contentInset.bottom);
}
CGPoint newContentOffset = _scrollView.contentOffset;
@@ -210,12 +211,6 @@ RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrollView, NSInt
contentDiff = keyboardEndFrame.origin.y - keyboardBeginFrame.origin.y;
}
} else {
CGRect viewIntersection = CGRectIntersection(self.firstResponderFocus, keyboardEndFrame);
if (CGRectIsNull(viewIntersection)) {
return;
}
// Inner text field focused
CGFloat focusEnd = CGRectGetMaxY(self.firstResponderFocus);
if (focusEnd > keyboardEndFrame.origin.y) {
@@ -247,7 +242,7 @@ RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrollView, NSInt
animations:^{
self->_scrollView.contentInset = newEdgeInsets;
self->_scrollView.verticalScrollIndicatorInsets = newEdgeInsets;
[self scrollToOffset:newContentOffset animated:NO];
[self scrollTo:newContentOffset.x y:newContentOffset.y animated:NO];
}
completion:nil];
}
@@ -552,6 +547,17 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
return metrics;
}
- (ScrollViewEventEmitter::EndDragMetrics)_scrollViewMetricsWithVelocity:(CGPoint)velocity
andTargetContentOffset:(CGPoint)targetContentOffset
{
ScrollViewEventEmitter::EndDragMetrics metrics = [self _scrollViewMetrics];
metrics.targetContentOffset.x = targetContentOffset.x;
metrics.targetContentOffset.y = targetContentOffset.y;
metrics.velocity.x = velocity.x;
metrics.velocity.y = velocity.y;
return metrics;
}
- (void)_updateStateWithContentOffset
{
if (!_state) {
@@ -607,6 +613,14 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
targetContentOffset->y = scrollView.contentOffset.y + travel * _endDraggingSensitivityMultiplier;
}
}
if (!_eventEmitter) {
return;
}
auto metrics = [self _scrollViewMetricsWithVelocity:velocity andTargetContentOffset:*targetContentOffset];
static_cast<const ScrollViewEventEmitter &>(*_eventEmitter).onScrollEndDrag(metrics);
}
- (BOOL)touchesShouldCancelInContentView:(__unused UIView *)view
@@ -677,8 +691,6 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
return;
}
static_cast<const ScrollViewEventEmitter &>(*_eventEmitter).onScrollEndDrag([self _scrollViewMetrics]);
[self _updateStateWithContentOffset];
if (!decelerate) {
@@ -775,7 +787,9 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
return;
}
static_cast<const ScrollViewEventEmitter &>(*_eventEmitter).onScrollEndDrag([self _scrollViewMetrics]);
auto metrics = [self _scrollViewMetricsWithVelocity:{} andTargetContentOffset:{}];
static_cast<const ScrollViewEventEmitter &>(*_eventEmitter).onScrollEndDrag(metrics);
[self _updateStateWithContentOffset];
}
@@ -60,7 +60,7 @@ using namespace facebook::react;
const auto &newSwitchProps = static_cast<const SwitchProps &>(*props);
// `value`
if (oldSwitchProps.value != newSwitchProps.value) {
if (!_isInitialValueSet || oldSwitchProps.value != newSwitchProps.value) {
BOOL shouldAnimate = _isInitialValueSet == YES;
[_switchView setOn:newSwitchProps.value animated:shouldAnimate];
}
@@ -68,6 +68,8 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
* later comparison insensitive to them.
*/
NSDictionary<NSAttributedStringKey, id> *_originalTypingAttributes;
BOOL _hasInputAccessoryView;
}
#pragma mark - UIView overrides
@@ -99,9 +101,7 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
NSMutableDictionary<NSAttributedStringKey, id> *defaultAttributes =
[_backedTextInputView.defaultTextAttributes mutableCopy];
RCTWeakEventEmitterWrapper *eventEmitterWrapper = [RCTWeakEventEmitterWrapper new];
eventEmitterWrapper.eventEmitter = _eventEmitter;
defaultAttributes[RCTAttributedStringEventEmitterKey] = eventEmitterWrapper;
defaultAttributes[RCTAttributedStringEventEmitterKey] = RCTWrapEventEmitter(_eventEmitter);
_backedTextInputView.defaultTextAttributes = defaultAttributes;
}
@@ -606,10 +606,12 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
keyboardType == UIKeyboardTypeDecimalPad || keyboardType == UIKeyboardTypeASCIICapableNumberPad) &&
(containsKeyType || containsInputAccessoryViewButtonLabel);
if ((_backedTextInputView.inputAccessoryView != nil) == shouldHaveInputAccessoryView) {
if (_hasInputAccessoryView == shouldHaveInputAccessoryView) {
return;
}
_hasInputAccessoryView = shouldHaveInputAccessoryView;
if (shouldHaveInputAccessoryView) {
NSString *buttonLabel = inputAccessoryViewButtonLabel != nil ? inputAccessoryViewButtonLabel
: [self returnKeyTypeToString:returnKeyType];
@@ -635,6 +637,8 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
- (void)handleInputAccessoryDoneButton
{
// Ignore the value of whether we submitted; just make sure the submit event is called if necessary.
[self textInputShouldSubmitOnReturn];
if ([self textInputShouldReturn]) {
[_backedTextInputView endEditing:YES];
}
@@ -143,6 +143,7 @@ using namespace facebook::react;
if (!_view) {
_view = [[RCTSurfaceView alloc] initWithSurface:(RCTSurface *)self];
[self _updateLayoutContext];
_touchHandler = [RCTSurfaceTouchHandler new];
[_touchHandler attachToView:_view];
}
@@ -426,6 +426,10 @@ public abstract interface class com/facebook/react/ReactRootView$ReactRootViewEv
public abstract fun onAttachedToReactInstance (Lcom/facebook/react/ReactRootView;)V
}
public abstract class com/facebook/react/TurboReactPackage : com/facebook/react/BaseReactPackage {
public fun <init> ()V
}
public abstract interface class com/facebook/react/ViewManagerOnDemandReactPackage {
public abstract fun createViewManager (Lcom/facebook/react/bridge/ReactApplicationContext;Ljava/lang/String;)Lcom/facebook/react/uimanager/ViewManager;
public abstract fun getViewManagerNames (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/Collection;
@@ -2959,6 +2963,7 @@ public abstract interface annotation class com/facebook/react/module/annotations
public final class com/facebook/react/module/model/ReactModuleInfo {
public static final field Companion Lcom/facebook/react/module/model/ReactModuleInfo$Companion;
public fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZZ)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZZZ)V
public final fun canOverrideExistingModule ()Z
public static final fun classIsTurboModule (Ljava/lang/Class;)Z
public final fun className ()Ljava/lang/String;
@@ -7438,6 +7443,7 @@ public class com/facebook/react/views/text/TextAttributeProps {
public static final field TA_KEY_LETTER_SPACING S
public static final field TA_KEY_LINE_BREAK_STRATEGY S
public static final field TA_KEY_LINE_HEIGHT S
public static final field TA_KEY_MAX_FONT_SIZE_MULTIPLIER S
public static final field TA_KEY_OPACITY S
public static final field TA_KEY_ROLE S
public static final field TA_KEY_TEXT_DECORATION_COLOR S
@@ -7470,6 +7476,7 @@ public class com/facebook/react/views/text/TextAttributeProps {
protected field mLetterSpacingInput F
protected field mLineHeight F
protected field mLineHeightInput F
protected field mMaxFontSizeMultiplier F
protected field mNumberOfLines I
protected field mOpacity F
protected field mRole Lcom/facebook/react/uimanager/ReactAccessibilityDelegate$Role;
@@ -7831,6 +7838,7 @@ public class com/facebook/react/views/view/ReactViewGroup : android/view/ViewGro
protected fun dispatchSetPressed (Z)V
public fun draw (Landroid/graphics/Canvas;)V
protected fun drawChild (Landroid/graphics/Canvas;Landroid/view/View;J)Z
public fun endViewTransition (Landroid/view/View;)V
protected fun getChildDrawingOrder (II)I
public fun getClippingRect (Landroid/graphics/Rect;)V
public fun getHitSlopRect ()Landroid/graphics/Rect;
@@ -39,9 +39,19 @@ if (PROJECT_ROOT_DIR)
# variable is defined if user need to access it.
endif ()
file(GLOB input_SRC CONFIGURE_DEPENDS
${REACT_ANDROID_DIR}/cmake-utils/default-app-setup/*.cpp
${BUILD_DIR}/generated/autolinking/src/main/jni/*.cpp)
file(GLOB override_cpp_SRC CONFIGURE_DEPENDS *.cpp)
# We check if the user is providing a custom OnLoad.cpp file. If so, we pick that
# for compilation. Otherwise we fallback to using the `default-app-setup/OnLoad.cpp`
# file instead.
if(override_cpp_SRC)
file(GLOB input_SRC CONFIGURE_DEPENDS
*.cpp
${BUILD_DIR}/generated/autolinking/src/main/jni/*.cpp)
else()
file(GLOB input_SRC CONFIGURE_DEPENDS
${REACT_ANDROID_DIR}/cmake-utils/default-app-setup/*.cpp
${BUILD_DIR}/generated/autolinking/src/main/jni/*.cpp)
endif()
add_library(${CMAKE_PROJECT_NAME} SHARED ${input_SRC})
@@ -29,12 +29,7 @@
#include <DefaultComponentsRegistry.h>
#include <DefaultTurboModuleManagerDelegate.h>
#if __has_include("<autolinking.h>")
#define AUTOLINKING_AVAILABLE 1
#include <autolinking.h>
#else
#define AUTOLINKING_AVAILABLE 0
#endif
#include <fbjni/fbjni.h>
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
#include <rncore.h>
@@ -61,10 +56,8 @@ void registerComponents(
REACT_NATIVE_APP_COMPONENT_REGISTRATION(registry);
#endif
#if AUTOLINKING_AVAILABLE
// And we fallback to the components autolinked
autolinking_registerProviders(registry);
#endif
}
std::shared_ptr<TurboModule> cxxModuleProvider(
@@ -78,12 +71,8 @@ std::shared_ptr<TurboModule> cxxModuleProvider(
// return std::make_shared<NativeCxxModuleExample>(jsInvoker);
// }
#if AUTOLINKING_AVAILABLE
// And we fallback to the CXX module providers autolinked
return autolinking_cxxModuleProvider(name, jsInvoker);
#endif
return nullptr;
}
std::shared_ptr<TurboModule> javaModuleProvider(
@@ -112,12 +101,10 @@ std::shared_ptr<TurboModule> javaModuleProvider(
return module;
}
#if AUTOLINKING_AVAILABLE
// And we fallback to the module providers autolinked
if (auto module = autolinking_ModuleProvider(name, params)) {
return module;
}
#endif
return nullptr;
}
@@ -1,4 +1,4 @@
VERSION_NAME=1000.0.0
VERSION_NAME=0.77.3
react.internal.publishingGroup=com.facebook.react
android.useAndroidX=true
@@ -179,9 +179,18 @@ public abstract class HeadlessJsTaskService extends Service implements HeadlessJ
}
private void createReactContextAndScheduleTask(final HeadlessJsTaskConfig taskConfig) {
final ReactHost reactHost = getReactHost();
if (reactHost == null) { // old arch
if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) {
final ReactHost reactHost = getReactHost();
reactHost.addReactInstanceEventListener(
new ReactInstanceEventListener() {
@Override
public void onReactContextInitialized(@NonNull ReactContext reactContext) {
invokeStartTask(reactContext, taskConfig);
reactHost.removeReactInstanceEventListener(this);
}
});
reactHost.start();
} else {
final ReactInstanceManager reactInstanceManager =
getReactNativeHost().getReactInstanceManager();
@@ -194,16 +203,6 @@ public abstract class HeadlessJsTaskService extends Service implements HeadlessJ
}
});
reactInstanceManager.createReactContextInBackground();
} else { // new arch
reactHost.addReactInstanceEventListener(
new ReactInstanceEventListener() {
@Override
public void onReactContextInitialized(@NonNull ReactContext reactContext) {
invokeStartTask(reactContext, taskConfig);
reactHost.removeReactInstanceEventListener(this);
}
});
reactHost.start();
}
}
}
@@ -1409,14 +1409,14 @@ public class ReactInstanceManager {
new RuntimeException(
"detachRootViewFromInstance called with ReactRootView with invalid id"));
}
clearReactRoot(reactRoot);
} else {
reactContext
.getCatalystInstance()
.getJSModule(AppRegistry.class)
.unmountApplicationComponentAtRootTag(reactRoot.getRootViewTag());
}
clearReactRoot(reactRoot);
}
@ThreadConfined(UI)
@@ -0,0 +1,13 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react
@Deprecated(
message = "Use BaseReactPackage instead",
replaceWith = ReplaceWith(expression = "BaseReactPackage"))
public abstract class TurboReactPackage : BaseReactPackage() {}
@@ -268,8 +268,12 @@ public class StackTraceHelper {
List<ReadableMap> readableMapList = new ArrayList<>();
for (ParsedError.StackFrame frame : frames) {
JavaOnlyMap map = new JavaOnlyMap();
map.putDouble(COLUMN_KEY, frame.getColumn());
map.putDouble(LINE_NUMBER_KEY, frame.getLineNumber());
if (frame.getColumn() != null) {
map.putDouble(COLUMN_KEY, frame.getColumn());
}
if (frame.getLineNumber() != null) {
map.putDouble(LINE_NUMBER_KEY, frame.getLineNumber());
}
map.putString(FILE_KEY, (String) frame.getFile());
map.putString(METHOD_NAME_KEY, (String) frame.getMethodName());
readableMapList.add(map);
@@ -171,7 +171,7 @@ public class FabricUIManager
private final CopyOnWriteArrayList<UIManagerListener> mListeners = new CopyOnWriteArrayList<>();
private boolean mMountNotificationScheduled = false;
private final List<Integer> mMountedSurfaceIds = new ArrayList<>();
private List<Integer> mSurfaceIdsWithPendingMountNotification = new ArrayList<>();
@ThreadConfined(UI)
@NonNull
@@ -445,12 +445,18 @@ public class FabricUIManager
@Override
public void markActiveTouchForTag(int surfaceId, int reactTag) {
mMountingManager.getSurfaceManager(surfaceId).markActiveTouchForTag(reactTag);
SurfaceMountingManager surfaceMountingManager = mMountingManager.getSurfaceManager(surfaceId);
if (surfaceMountingManager != null) {
surfaceMountingManager.markActiveTouchForTag(reactTag);
}
}
@Override
public void sweepActiveTouchForTag(int surfaceId, int reactTag) {
mMountingManager.getSurfaceManager(surfaceId).sweepActiveTouchForTag(reactTag);
SurfaceMountingManager surfaceMountingManager = mMountingManager.getSurfaceManager(surfaceId);
if (surfaceMountingManager != null) {
surfaceMountingManager.sweepActiveTouchForTag(reactTag);
}
}
/**
@@ -1255,12 +1261,15 @@ public class FabricUIManager
// Collect surface IDs for all the mount items
for (MountItem mountItem : mountItems) {
if (mountItem != null && !mMountedSurfaceIds.contains(mountItem.getSurfaceId())) {
mMountedSurfaceIds.add(mountItem.getSurfaceId());
if (mountItem != null
&& !mSurfaceIdsWithPendingMountNotification.contains(mountItem.getSurfaceId())) {
mSurfaceIdsWithPendingMountNotification.add(mountItem.getSurfaceId());
}
}
if (!mMountNotificationScheduled && !mMountedSurfaceIds.isEmpty()) {
if (!mMountNotificationScheduled && !mSurfaceIdsWithPendingMountNotification.isEmpty()) {
mMountNotificationScheduled = true;
// Notify mount when the effects are visible and prevent mount hooks to
// delay paint.
UiThreadUtil.getUiThreadHandler()
@@ -1270,17 +1279,19 @@ public class FabricUIManager
public void run() {
mMountNotificationScheduled = false;
// Create a copy in case mount hooks trigger more mutations
final List<Integer> surfaceIdsToReportMount =
mSurfaceIdsWithPendingMountNotification;
mSurfaceIdsWithPendingMountNotification = new ArrayList<>();
final @Nullable FabricUIManagerBinding binding = mBinding;
if (binding == null || mDestroyed) {
mMountedSurfaceIds.clear();
return;
}
for (int surfaceId : mMountedSurfaceIds) {
for (int surfaceId : surfaceIdsToReportMount) {
binding.reportMount(surfaceId);
}
mMountedSurfaceIds.clear();
}
});
}
@@ -330,14 +330,11 @@ public class MountingManager {
@AnyThread
@ThreadConfined(ANY)
public @Nullable EventEmitterWrapper getEventEmitter(int surfaceId, int reactTag) {
SurfaceMountingManager surfaceMountingManager =
(surfaceId == ViewUtil.NO_SURFACE_ID
? getSurfaceManagerForView(reactTag)
: getSurfaceManager(surfaceId));
if (surfaceMountingManager == null) {
SurfaceMountingManager smm = getSurfaceMountingManager(surfaceId, reactTag);
if (smm == null) {
return null;
}
return surfaceMountingManager.getEventEmitter(reactTag);
return smm.getEventEmitter(reactTag);
}
/**
@@ -434,11 +431,21 @@ public class MountingManager {
boolean canCoalesceEvent,
@Nullable WritableMap params,
@EventCategoryDef int eventCategory) {
@Nullable SurfaceMountingManager smm = getSurfaceManager(surfaceId);
SurfaceMountingManager smm = getSurfaceMountingManager(surfaceId, reactTag);
if (smm == null) {
// Cannot queue event without valid surface mountng manager. Do nothing here.
FLog.d(
TAG,
"Cannot queue event without valid surface mounting manager for tag: %d, surfaceId: %d",
reactTag,
surfaceId);
return;
}
smm.enqueuePendingEvent(reactTag, eventName, canCoalesceEvent, params, eventCategory);
}
private @Nullable SurfaceMountingManager getSurfaceMountingManager(int surfaceId, int reactTag) {
return (surfaceId == ViewUtil.NO_SURFACE_ID
? getSurfaceManagerForView(reactTag)
: getSurfaceManager(surfaceId));
}
}

Some files were not shown because too many files have changed in this diff Show More