Граф коммитов

34948 Коммитов

Автор SHA1 Сообщение Дата
Blake Friedman 2e2b71eeab replace test_android_template with test_android_helloworld (#44905)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44905

Replaces the last template CI job.

Changelog: [Internal] [Changed] Use Helloworld in GHA CI workflow.

Reviewed By: cortinico

Differential Revision: D58466813

fbshipit-source-id: 333b9a4c71eec6901c78f144db48f365539c6a5a
2024-06-14 08:08:26 -07:00
Blake Friedman 7061649c03 Fixes for release builds (#44943)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44943

Release builds require more configuration.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D58529721

fbshipit-source-id: ca78ab530a459e6b9ec4595d22c1aecc66bc9dc0
2024-06-14 06:10:52 -07:00
Riccardo Cipolleschi c7d3220f4d Properly export the hermes tarball path to reuse it in RNTester (#44931)
Summary:
While working on GHA, I realized that RNTester is not reusing the hermes package we create in the previous steps.

This change should fix that, saving ~5 minute per RNTester test as it does not have to rebuild hermes every time.

## Changelog:
[Internal] - Improve CI to reuse hermes tarballs

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

Test Plan:
| Before | After |
| --- | --- |
| <img width="847" alt="Screenshot 2024-06-13 at 16 02 32" src="https://github.com/facebook/react-native/assets/11162307/099fd2d4-0954-4e64-baf0-6322e02d57bb"> | <img width="1203" alt="Screenshot 2024-06-13 at 16 34 20" src="https://github.com/facebook/react-native/assets/11162307/f8b9f9b6-0bd3-4ea4-8acd-3a4c1bffbc88"> |

Reviewed By: cortinico

Differential Revision: D58530335

Pulled By: cipolleschi

fbshipit-source-id: e711ae8affd78a4da4b64e6092cfffafd40589e5
2024-06-14 04:42:15 -07:00
Ruslan Lesiutin 7bd98eecd0 Add test showcasing memory leak in RemoteObjectsTable in Hermes (#44936)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44936

# Changelog: [Internal]

Added a small test that uses `folly:ManualExecutor`, which reproduces the memory leak issue in Hermes' RemoteObjectsTable:
1. Send `Runtime.enable`
2. Evaluate `console.log(<object>);` to populate `RemoteObjectsTable`
3. Send `Page.reload` to reload VM

This test is expected to fail, because by the time it is published, the D58398254 hasn't landed.

Reviewed By: motiz88

Differential Revision: D58531763

fbshipit-source-id: 99af3bfce0a31fe905d5bf2bf433f62cfbc34897
2024-06-14 04:05:10 -07:00
Alex Taylor (alta) 6584b408fb Deploy 0.238.0 to xplat (#44941)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44941

Changelog: [Internal]

Reviewed By: cyan33

Differential Revision: D58565114

fbshipit-source-id: ba6cba0445327ff7ff57505dbb498f2b5d8d5fe7
2024-06-14 02:19:11 -07:00
Charles Dudley 8b53d41a88 Update RN Share.share()'s argument types to be more explicit (#44887)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44887

The previous inexact object types and documentation for Share.share()'s arguments have led to confusion in how this library should be used. This diff updates the argument types to be more explicit, and rewrites some of the documentation for clarity.

Changelog:
[General][Breaking] Update `Share.share()`'s argument types to be more explicit.

Reviewed By: NickGerleman

Differential Revision: D58224906

fbshipit-source-id: 5ac8efe7caa0ecdd430fa7a1951c73c4acd8c6a1
2024-06-13 14:55:27 -07:00
Richard Howell 261f7b9f11 make yogaApple modular (#44938)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44938

Yoga is transitively included in Swift targets and needs to be modular.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D58469454

fbshipit-source-id: 72bc6b5d3e5ee0710d9334a626e4e7297ce26b09
2024-06-13 14:18:45 -07:00
Rubén Norte 49a911fab4 Back out "Revert D58459930: [react-native][PR] Add ReactMarkerConstants.CONTENT_APPEARED support on Android"
Summary:
Changelog: [ANDROID] [ADDED] - Add the ReactMarkerConstants.CONTENT_APPEARED support on Android in bridgeless mode.

This re-applies https://github.com/facebook/react-native/pull/43620 which was reverted because a CI job started failing because we forgot to update `packages/react-native/ReactAndroid/api/ReactAndroid.api`.

Reviewed By: cortinico

Differential Revision: D58535868

fbshipit-source-id: 9eec33c5e798850a7434a6c391abf2fc3fc9d0a6
2024-06-13 12:49:25 -07:00
Moti Zilberman be6eda8c98 Suppress LogBox for warnings if Fusebox console is available
Summary:
Changelog: [Internal]

Showing warnings in LogBox is noisy, confusing for web developers, and not the best use of screen real estate on mobile platforms. Since the Fusebox console offers a superior experience, as of this diff we'll suppress warnings in LogBox if we detect that Fusebox is available.

*The first time* a warning is suppressed, globally (i.e. at most once per app launch), we'll show a notification pointing the user towards Fusebox. When the notification is clicked, we call the `DevSettings.openDebugger` method and dismiss it.

The wording of the notification ("Open debugger to view warnings") is intentional:

1. It's short enough to fit on small screens in its entirety.
2. It doesn't actually say "*click here* to open the debugger". This is for the best because `DevSettings.openDebugger` is a best-effort method that might fail, and in the current implementation there's no reliable feedback to the user about the success/failure of the launch.

Reviewed By: huntie

Differential Revision: D57681446

fbshipit-source-id: fe6101785780de3bc586ade11f471f7c74707be1
2024-06-13 12:22:48 -07:00
Moti Zilberman e3a76c5155 Expose DevSettings.openDebugger method to JS (#44934)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44934

Resubmission of D57681447 with an updated `ReactAndroid.api`.

 ---

Changelog: [Internal]

Adds a private API that gives JS the ability to trigger the same "open debugger" action as in the Dev Menu. This is in preparation for changes to LogBox.

For simplicity, this method operates on a best-effort basis - i.e. it doesn't report the success or failure (or failure reason) of the launch.

Reviewed By: huntie

Differential Revision: D58529832

fbshipit-source-id: e5510f529a19e0149d8dce04fa610e6c2371cc79
2024-06-13 12:22:48 -07:00
Vitali Zaidman dc460147bb Update debugger-frontend from 06a25f7...f7e972c (#44935)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44935

Changelog: [Internal] - Update `react-native/debugger-frontend` from 06a25f7...f7e972c

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](06a25f749e...f7e972ce29).

Reviewed By: hoxyq

Differential Revision: D58531480

fbshipit-source-id: 72d6d56a6a0d2262fb0a9120276add25fd4c219a
2024-06-13 10:40:30 -07:00
Pieter Vanderwerff a237e8da7a Destructure all overridden props (#44910)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44910

Props within the `Text` component are accessed both via destructuring the props object but also in some cases by using a "dot" access on the destructured `restProps`. However in all of the "dot" access cases the property is being overrided. Which means in the final JSX these properties get set twice, e.g. via the `restProps` spread then overrrided by static properties. This change just destructures all values to avoid this inefficiency.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D58446569

fbshipit-source-id: 12a800f5e2218a1d95d57cc689a4c79caab480b4
2024-06-13 10:14:56 -07:00
Alex Hunt 1c6bf24cfb Fix default accessor for unstable_fuseboxEnabled (RNTester crash)
Summary: Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D58527490

fbshipit-source-id: 7974189ab2f4d4e7f38199d5e824611634cd4d7b
2024-06-13 08:28:23 -07:00
Riccardo Cipolleschi ece68f0efd Remove the trigger-react-native-release to use the GHA workflow_dispatch UI (#44898)
Summary:
This change removes the need for the trigger-react-native-release.js script.
Thanks to the migration to Github Actions, we can now leverage the GHA workflow UI to trigger a Prepare Release job that creates a github tag that will spin a new release.

The pro of this approach are:
- less code to maintain: instead of a complex trigger release scripts, we only have to maintain two very straightforward scripts for the CI
- easier to trigger a release: instead of running a script, we can now just use the GH UI

The `trigger-react-native-release` script was doing the following steps:
- check that we are in the release branch ==> Already implemented in the GHA workflow
- Gets the branch name (not needed) ==> the job will automatically run on the stable branch
- Check for unsent changes (not needed) ==> we are not in a local environment
- get the gh token (not needed) ==> You need to be logged in GH and have write access to the repo
- get the version ==> provided as a parameter
- fails if the tag is already there ==> Functionality added in the workflow
- Parse and validate the version ==> Functionality added to the action prepare-release action + the JS Script
- Compute the npmTag ==> Functionality added to the action prepare-release action + the JS Script
- trigger the release workflow ==> The GH UI does that for us

## Changelog:
[Internal] - Remove the trigger-react-native-release.js

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

Test Plan: Testing in Production!

Reviewed By: cortinico, huntie

Differential Revision: D58461470

Pulled By: cipolleschi

fbshipit-source-id: 32bb0ee91370c9483a29e2ca2e18e24557d5fd53
2024-06-13 08:19:58 -07:00
Sergei Rybalkin 726a4a1e5e Revert D57681447: Expose DevSettings.openDebugger method to JS
Differential Revision:
D57681447

Original commit changeset: ddb1fbd0f1c8

Original Phabricator Diff: D57681447

fbshipit-source-id: 94bf94227bcc9fab8282bd68ddf3f4f1df64656b
2024-06-13 07:20:18 -07:00
Sergei Rybalkin 7e0f894d3a Revert D58459930: Add ReactMarkerConstants.CONTENT_APPEARED support on Android
Differential Revision:
D58459930

Original commit changeset: 4498a3623c50

Original Phabricator Diff: D58459930

fbshipit-source-id: 8bc5ef3c8b1e42a4085ee6d2834bf6906c936c0d
2024-06-13 07:19:45 -07:00
Alfonso Curbelo 3cb03cb297 Add 0.72.15 to Changelog (#44904)
Summary:
Add 0.72.15 to Changelog

## Changelog:
[Internal] [Changed] - Generated 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

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

Reviewed By: cipolleschi

Differential Revision: D58470819

Pulled By: cortinico

fbshipit-source-id: 20a1816811213ed9a69f1ede3579aa8fc661faf2
2024-06-13 04:53:46 -07:00
Blake Friedman b2e6a37e5b configure to build from source (#44920)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44920

Configure helloworld to build from source, using a combination of our [How to Build from Source](https://reactnative.dev/contributing/how-to-build-from-source#update-your-project-to-build-from-source) guide, as well as using rn-tester's config as a guide.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D58287748

fbshipit-source-id: 836b09416f4da4087fbdea4476d29cd226157914
2024-06-13 04:51:20 -07:00
Blake Friedman 6970854a15 cli assemble support (#44903)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44903

Call our wrapper to assemble an Android build of helloworld.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D58287785

fbshipit-source-id: 15aa303008254780b3d1b625b392bdbe2869a19a
2024-06-13 04:51:20 -07:00
Blake Friedman 20c89f6d83 point react gradle config to monorepo (#44901)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44901

Point Gradle to the monorepo instead of a node_modules, as well as remove some commented out entries we're not interested in.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D58287786

fbshipit-source-id: 92b3d15d05c55a2589bb8a6b75dc3d5d0f9756ff
2024-06-13 04:51:20 -07:00
Blake Friedman 89f16da89e Fix cli assemble, build & install (#44902)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44902

Add support for building (assembling) a React Native Android project.

Changelog: [General][Added] core-cli-utils Android support

Reviewed By: cortinico

Differential Revision: D58287783

fbshipit-source-id: 381909fd461902723d6046b82ea5a2047a99deab
2024-06-13 04:51:20 -07:00
Biki-das 45ac64ee13 Fix:-fixed dark mode appearance for the a11y and action sheet examples in … (#44795)
Summary:
Fixes the `a11y` and actionSheet examples in the RN tester iOS app, where in dark mode, some text were not taking the appropriate color

**Before**

<img width="401" alt="Screenshot 2024-06-05 at 5 28 28 PM" src="https://github.com/facebook/react-native/assets/72331432/a17f2713-66e8-45bc-9923-baa328f40839">

<img width="401" alt="Screenshot 2024-06-05 at 5 28 37 PM" src="https://github.com/facebook/react-native/assets/72331432/4ca765a1-ebff-41e5-97ba-84f4d274f0c3">

**After**

<img width="401" alt="Screenshot 2024-06-05 at 5 29 56 PM" src="https://github.com/facebook/react-native/assets/72331432/c4f82d2c-4602-4165-abef-5620cbe45446">

<img width="401" alt="Screenshot 2024-06-05 at 5 30 08 PM" src="https://github.com/facebook/react-native/assets/72331432/973558dd-854c-4eb8-91d6-a288ba7b0561">

## Changelog:

N/A

Pick one each for the category and type tags:

[INTERNAL] [FIXED] - Fix RN tester Example appearance in dark mode for A11y and ActionSheet.

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

Test Plan: Tested using the RN tester app.

Reviewed By: NickGerleman

Differential Revision: D58469005

Pulled By: huntie

fbshipit-source-id: 05f991f1c3efae7ccfc90535aaa62d6075aad18e
2024-06-13 04:26:27 -07:00
Moti Zilberman 1fb5a4b283 Expose DevSettings.openDebugger method to JS (#44647)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44647

Changelog: [Internal]

Adds a private API that gives JS the ability to trigger the same "open debugger" action as in the Dev Menu. This is in preparation for changes to LogBox.

For simplicity, this method operates on a best-effort basis - i.e. it doesn't report the success or failure (or failure reason) of the launch.

Reviewed By: hoxyq

Differential Revision: D57681447

fbshipit-source-id: ddb1fbd0f1c8d07bfa57d65c54e3a34bb7a470a8
2024-06-13 04:01:25 -07:00
Kudo Chien 5da9fdf8f1 Add ReactMarkerConstants.CONTENT_APPEARED support on Android (#43620)
Summary:
Add the `ReactMarkerConstants.CONTENT_APPEARED` support on Android in bridgeless mode. This is an important marker for TTI measurement.

## Changelog:

[ANDROID] [ADDED] - Add the `ReactMarkerConstants.CONTENT_APPEARED` support on Android in bridgeless mode.

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

Test Plan:
adding this on RNTesterActivity to see if the log is executed

```kotlin
ReactMarker.addListener { name, tag, instanceKey ->
  if (name == ReactMarkerConstants.CONTENT_APPEARED) {
    Log.i("XXX", "XXX")
  }
}
```

Reviewed By: cortinico

Differential Revision: D58459930

Pulled By: rubennorte

fbshipit-source-id: 4498a3623c506d228aea995c8aeafdb51fcc5b96
2024-06-13 03:57:16 -07:00
Nicola Corti 1cb587c620 Do not publish Gradle Scans (#44925)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44925

I have the suspect this is causing our builds to be slower and especially causing the template tests to take 6 hours.
Let's try to disable it.

Changelog:
[Internal] [Changed] - Do not publish Gradle Scans

Reviewed By: cipolleschi

Differential Revision: D58520463

fbshipit-source-id: 028e16a725ea87e178ed4e0bf134737f32780544
2024-06-13 03:41:39 -07:00
Riccardo Cipolleschi 9fe9f032e6 Fix publish-release regex (#44921)
Summary:
The publish_release job is broken due to the initial regex. This change would like to fix it

## Changelog:
[Internal] - Fix publish_release job

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

Test Plan:
Test on PR

<img width="1028" alt="Screenshot 2024-06-13 at 08 51 59" src="https://github.com/facebook/react-native/assets/11162307/0f68be41-a820-454e-9aca-99b2178984cd">

Reviewed By: huntie

Differential Revision: D58513441

Pulled By: cipolleschi

fbshipit-source-id: 55d632e111c4057431c5c607330571af2848534e
2024-06-13 03:24:40 -07:00
Phillip Pan b19bf2b6d7 ship shared module queue (#44916)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44916

Changelog: [Internal]

reached ship decision last year, getting rid of the gating here

Reviewed By: javache

Differential Revision: D58476997

fbshipit-source-id: 0ad52d29ac79b1751d6f10e67dc6886bf88e5ba4
2024-06-12 21:13:38 -07:00
Pieter Vanderwerff f7aea0c8e1 Fork onPress callbacks for ios highlighting (#44909)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44909

Today we wrap all `onPressIn` and `onPressOut` callbacks we pass to pressability so we can set the `highlighted` state. However highlighted state is only ever set to anything other that false on iOS. This change not only skips calling `setHighlighted(false)` on every press event but also skips wrapping the callback.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D58391419

fbshipit-source-id: e79f51469609a59063098501f015f8078e3db79f
2024-06-12 19:12:15 -07:00
Peter Abbondanzo 0ad107b988 Add Clipboard module to base packages (#44881)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44881

Updates the companion object for `ClipboardModule` to re-export the generated parent's `NAME`.

Changelog: [Internal]

Differential Revision: D58426185

fbshipit-source-id: a60462a990003413f9b0c646a97026217a64b418
2024-06-12 17:06:27 -07:00
Jakub Kosmydel 3753b7a0e7 Fix inverted flat list (#44168)
Summary:
This PR solves [this issue](https://github.com/facebook/react-native/issues/44151).
Inverted FlatList doesn't work (elements cannot be clicked) when the list is scrolled.

## 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] - Fix clicking items on the inverted FlatList on the new architecture

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

Test Plan:
# Steps
1. `buck2 install catalyst-ios` or `buck2 install catalyst-android`
2. Go to `RNTester Browser - Fabric` -> `FlatList` -> `Inverted`
3. Toggle inverted to `true`
4. Scroll to the top
5. Tap down and drag to either left or right
6. Expected is to have Red highlighted (which indicate Press Down) when dragged.

## iOS
| Before | After |
|-----------------------|----------------------|
|  https://pxl.cl/53vCW  |  https://pxl.cl/53vDq |

## Android
| Before | After |
|-----------------------|----------------------|
|  https://pxl.cl/53vFp |  https://pxl.cl/53vFG |

## Reproducing steps from OSS

1. Use this reproducer: https://github.com/WoLewicki/reproducer-react-native/tree/%40wolewicki/flatlist-inverted
2. Apply changes from this PR & build the app.
3. Scroll a bit the list, so it changes the position.
4. The `onPress` should be fired when the button is clicked.
5. Do the following tests:
  1. Add a `horizontal` prop to the FlatList - verify everything works.
  2. Remove a `inverted` prop - verify everything works.
  3. Remove a `inverted` prop and add a `horizontal` prop - verify everything works.
6. Test different combinations of transforms of the FlatList, example:
```javascript
      <FlatList
        inverted
        horizontal
        style={{
          transform: [
            {scaleY: -1},
            {scaleY: -2},
            {scaleY: -0.5},
            {translateY: 20},
            {translateY: -10},
            {skewX: '10deg'},
            {rotateX: '10deg'},
          ],
        }}
      />
```

<details>

<summary>Reproducrer</summary>

https://github.com/facebook/react-native/assets/104823336/28cfe607-43e8-4f80-bbfb-59085ae0f986

</details>

<details>

<summary>RN tester</summary>

https://github.com/facebook/react-native/assets/104823336/e00cd488-d98f-4ece-9cab-b8a7212acb04

</details>

Reviewed By: arushikesarwani94

Differential Revision: D56441112

Pulled By: realsoelynn

fbshipit-source-id: 82c47f6bcc1f25cfbbd55aedf9652052bb86cf47
2024-06-12 16:18:23 -07:00
Blake Friedman d54fd6219e disable on PRs (#44912)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44912

While moving from CircleCI → GHA, we're removing this blocking folks landing PRs and just running on main.  We will re-enable once GHA is stable.

Changelog: [General][Changed] Disable GHA on PRs until it's stable

Reviewed By: NickGerleman

Differential Revision: D58478000

fbshipit-source-id: 053ee53455956bf19b6f9113cb796346359ad4ef
2024-06-12 14:41:25 -07:00
Peter Abbondanzo b6c3433537 Hybrid image aliasing (#44803)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44803

This change introduces a new prop to the Android `Image` component: `resizeMultiplier`. This prop can be used when the `resizeMethod` is set to `resize`, and it directly modifies the resultant bitmap generated in memory from Fresco to be larger (or smaller) depending on the multiplier. A default of 1.0 means the bitmap size is designed to fit the destination dimensions. A multiplier greater than 1.0 will set the `ResizeOptions` provided to Fresco to be larger that the destination dimensions, and the resulting bitmap will be scaled from the hardware size.

This new prop is most useful in cases where the destination dimensions are quite small and the source image is significantly larger. The `resize` resize method performs downsampling and significant image quality is lost between the source and destination image sizes, often resulting in a blurry image. By using a multiplier, the decoded image is slightly larger than the target size but smaller than the source image (if the source image is large enough).

It's important to note that Fresco still chooses the closest power of 2 and will not scale the image larger than its source dimensions. If the multiplier yields `ResizeOptions` greater than the source dimensions, no downsampling occurs.

Here's an example:
If you have a source image with dimensions 200x200 and destination dimensions of 24x24, a `resizeMultiplier` of `2.0` will tell Fresco to downsample the image to 48x48. Fresco picks the closest power of 2 (so, 50x50) and decodes the image into a bitmap of that size. Without the multiplier, the closest power of 2 would be 25x25, which is half the quality.

## Changelog

[Android][Added] - Adds a new `Image` prop `resizeMultiplier` to help increase quality of small images on low DPI devices

Reviewed By: javache

Differential Revision: D58120352

fbshipit-source-id: e0ebf4bd899170134825a29f72a68621447106c0
2024-06-12 12:57:53 -07:00
Edmond Chui deb4819229 Update debugger-frontend from fa5df76...06a25f7 (#44907)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44907

Changelog: [Internal] - Update `react-native/debugger-frontend` from fa5df76...06a25f7

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](fa5df76040...06a25f749e).

Reviewed By: huntie

Differential Revision: D58469457

fbshipit-source-id: c79a41888726d526ffc851bcc7550fd287bbf26b
2024-06-12 12:11:53 -07:00
Pieter Vanderwerff 54997e429a Cleanup accessibility checks (#44885)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44885

Cleanup accessibility related props checks to ensure we are doing the minimal amount of work. e.g. reduce duplicate `null` checks and shift checks to conditional branches that use them.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D58390430

fbshipit-source-id: f2c8989b6520cda9f14f9a04cd4fd6e126c501fd
2024-06-12 11:51:44 -07:00
Gijs Weterings b44e3f69a4 Add java and JS coverage collection to RNTester for Jest E2E (#44856)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44856

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D58360098

fbshipit-source-id: dd06f9d3f2fe887cb9311ccfef811a2965ca5750
2024-06-12 11:48:07 -07:00
Moti Zilberman df35e258b2 Prevent Fusebox infra crash if RCTBridge is dealloc'ed off the main queue (#44877)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44877

Changelog: [Internal]

We're seeing a sporadic iOS crash that suggests `[RCTBridge dealloc]` is being called off the main queue (despite a comment suggesting it shouldn't be). This exposes a race condition between destroying the `HostTarget` and attempting to unregister the instance+runtime from it . Here we use `RCTExecuteOnMainQueue` to make sure the `HostTarget` destruction is always sequenced after the `unregisterFromInspector()` call.

Reviewed By: huntie

Differential Revision: D58415684

fbshipit-source-id: a22e239c80c3204fe32b9e73719ffaa131feaffb
2024-06-12 11:31:56 -07:00
Riccardo Cipolleschi 11e5394796 Revert D58288489: Multisect successfully blamed "D58288489: [RN][Fusebox][iOS] Implement new HostTargetMetadata fields (iOS)" for one test failure (#44911)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44911

This diff reverts D58288489
D58288489: [RN][Fusebox][iOS] Implement new HostTargetMetadata fields (iOS) by huntie causes the following test failure:

Tests affected:
- [fbsource//xplat/js/react-native-github/packages/react-native/ReactCommon/jsinspector-modern:testsAndroid - main](https://www.internalfb.com/intern/test/844425054538351/)

Here's the Multisect link:
https://www.internalfb.com/multisect/5466028
Here are the tasks that are relevant to this breakage:
T191385299: 50+ tests unhealthy for react_native

The backout may land if someone accepts it.

If this diff has been generated in error, you can Commandeer and Abandon it.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D58475289

fbshipit-source-id: 3a4476d1350c4986cdb673bdb4ac52af353a00ea
2024-06-12 11:30:13 -07:00
Peter Abbondanzo 297ded90aa Fall back to app AlertDialog for non AppCompat themes (#44495)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44495

## Summary
Migrates the `AlertFragment` from `android.app.AlertDialog` to `androidx.appcompat.app.AlertDialog`. This backports tons of fixes that have gone into the AlertDialog component over the years, including proper line wrapping of button text, dark mode support, alignment of buttons, etc.

This change provides a fallback to the original `android.app.AlertDialog` if the current activity is not an AppCompat descendant.

## For consideration
- Alert dialog themes may no longer need the `android` namespace, meaning themes can now be specified as `alertDialogTheme` rather than `android:alertDialogTheme`.

## Changelog:

[Android] [Changed] - Migrated `AlertFragment` dialog builder to use `androidx.appcompat`

Reviewed By: zeyap

Differential Revision: D57113950

fbshipit-source-id: ba5109c9d79b6ceb042ff93eebe796a2d14ebd63
2024-06-12 11:24:56 -07:00
Peter Abbondanzo 600d3f6ff1 Migration RN Alert Dialog to androidx (#44494)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44494

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

Migrates the `AlertFragment` from `android.app.AlertDialog` to `androidx.appcompat.app.AlertDialog`. This backports tons of fixes that have gone into the AlertDialog component over the years, including proper line wrapping of button text, alignment of buttons, etc.

## For consideration
- Alert dialog themes may no longer need the `android` namespace, meaning themes can now be specified as `alertDialogTheme` rather than `android:alertDialogTheme`.
- This change requires all implementing activities to have a theme that inherits from `Theme.AppCompat`. Creation of any activities which do not have a descendant of this style will result in an `IllegalStateException`: https://www.internalfb.com/intern/signalinfra/exception_owners/?mid=5ee93f6ecd59f3d8ad82a78c213ea016&result_id=16044073705339118.281475102518721.1715097866

## Changelog:

[Android] [Changed] - Migrated `AlertFragment` dialog builder to use `androidx.appcompat`

Reviewed By: zeyap

Differential Revision: D57019423

fbshipit-source-id: 84d8f69d896d32e72434149c0e31735d358370a9
2024-06-12 11:24:56 -07:00
Riccardo Cipolleschi ae7d543d31 Move HelloWorld jobs from CCI to GHA (#44875)
Summary:
This change migrates the GHA template jobs to the HelloWorld package for iOS.

## Changelog:
[Internal] - Move iOS template jobs to HelloWorld

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

Test Plan: GHA are green

Reviewed By: cortinico

Differential Revision: D58459398

Pulled By: cipolleschi

fbshipit-source-id: 95404445d7375186860af5835b750b4735795434
2024-06-12 10:21:49 -07:00
Christoph Purrer c5d380fc98 Avoid static_pointer_cast in GenerateModuleH.js (#44889)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44889

Avoid static_pointer_cast. It provides no type-safety, and requires increasing the shared_ptr

## Changelog:

[Internal] [Fixed] - Avoid static_pointer_cast in GenerateModuleH.js

Reviewed By: javache

Differential Revision: D58449748

fbshipit-source-id: 4d46b4e18fc28758296a67271182a471a99b5d83
2024-06-12 10:14:48 -07:00
Edmond Chui 20462ca984 fix timing of terminating an unresponsive debugger socket (#44811)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44811

Changelog:
[General][Fixed] - Debugger frontend socket-termination countdown now begins after the ping message is actually sent

The debugger is currently disconnected if a ping-pong message is missed.

This causes the debugger to be unusable if it happens to be lagging, e.g. when the initialisation is competing with the flood of log spam T191394188

There are a few ways to fix this as discused with motiz88 and robhogan:

1. Ensure the websocket has a chance to respond, e.g. in via web worker
1. Lengthen the time allowed for the pong resopnse

I've done some digging to find the root cause of the UI being blocked in CDT, However, profiling shows that most of the work is not simple to break up, i.e. the number of expensive re-layout calls. Diving into that rabbit hole could mean accidentally writing React.

Because we ping every 10 seconds, we could get un/lucky where CDT happens to be busy _at that exact moment_, making this a flaky symptom to fix, even if we lengthen the allowed time-to-respond.

# V2+

So upon further investigation, CDT websocket is actually responding to the pings in due time:

{F1679132204}

(CDT doesn't show the ping/pong API as frames, so a custom tick/tock message was used to visualise the timing)

Over here in dev-middleware, we currently start a timeout to terminate the socket after sending the ping:

https://www.internalfb.com/code/fbsource/[813870db697a8701f2512d25a7fed730f0ec6ed9]/xplat/js/react-native-github/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js?lines=306-307

If CDT doesn't respond in time, websocket would be terminated.

But we saw CDT respond immediately above, even during the log spam, so the delay must be coming from somewhere else.

The intuition is that during the log-spam, the middleware takes a perf hit too when it's processing the spam from the device and forwarding it to the CDT websocket.

We can confirm this by passing a "sent" callback via `socket.ping(cb)`:

9bdb58070d/lib/websocket.js (L246-L254)

This gives us the timing between calling `socket.ping()` and when the ping is actually sent.

Regular, stress-free operation without log-spam shows most pings are sent within the same millisecond:

 {F1679223326}

With the pong response grace period at 5 seconds, there's plenty of time for CDT to `pong` back. That's why it has been working in most cases.

However, during the log-spam, we easily see this send-sent delay over 5 seconds. In extreme cases, almost 30 seconds would have passed before middleware sent a message to CDT, which then responded under 2 seconds:

 {F1679163335}

This means while CDT is getting flooded and has observable lag in the UI, the smoking gun is actually the middleware.

Digging a little deeper, we know that incoming messages from the target goes into a Promise queue, including the console logs:

https://www.internalfb.com/code/fbsource/[d5d312082e9c]/xplat/js/react-native-github/packages/dev-middleware/src/inspector-proxy/Device.js?lines=155-157

This means during the flood of logs from the target, the Promise queue keeps getting chained rapidly for each message.

Meanhile, the `ws` lib uses the underlying NodeJS `Socket.write` method for `ping(…)` and `send(…)`:

9bdb58070d/lib/sender.js (L349)

…which is guaranteed to fire the callback asynchronously:

https://github.com/nodejs/help/issues/1504#issuecomment-422879594

Promise queue is in the macro task queue, which gets priority before the micro task queue. So if the Promise queue is not cleared yet, the websocket queue will have a hard time getting executed in time – explaining the extreme send-sent durations during a log spam.

The fix is simple:

1. Start the terminate-socket-timer until the `ping` is actually sent
1. Treat any incoming message (along with `pong`s) as a terminate-socket-timer reset
    1. This also applies if `pong` comes in between `send` and `sent`, which can happen sometimes due to the async nature of the callback:

 {F1679288626}

# V1

~~In this diff, a more forgiving mechanism is introduced, i.e. CDT is allowed to miss a ping-pong roundtrip 3 times before the websocket connection is terminated.~~

~~This allows a bit more breathing room for CDT's initialisation during log spam while maintaining the same ping-pong interval for VS Code to keep the auto SSH tunnel alive.~~

Reviewed By: huntie

Differential Revision: D58220230

fbshipit-source-id: 7111c9878492d8755a6110a5cdf4ef622265001d
2024-06-12 09:45:34 -07:00
Alex Hunt 14914bd816 Implement new HostTargetMetadata fields (iOS) (#44893)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44893

Adds the following debugger metadata fields (sent over the `ReactNativeApplication.metadataUpdated` CDP event), and implements these on iOS (Bridge and Bridgeless).

- `appIdentifier`
- `deviceName`
- `platform`
- `reactNativeVersion`

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D58288489

fbshipit-source-id: 7105ad3b70d409bcd98b232154ebd6b7c827fb2b
2024-06-12 09:39:08 -07:00
Alex Hunt aced4072cf Add ReactNativeApplication CDP domain (#44894)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44894

Adds the new CDP domain `ReactNativeApplication`, with the following messages:

- `ReactNativeApplication.enable` (method) — Sent by the connected frontend to enable features under this domain.
- `ReactNativeApplication.metadataUpdated` (event) — Sent by the backend containing a metadata object about the host.

We intend to use this for displaying richer information in the debugger frontend, such as device information and React Native version.

Changelog:
[General][Added] - Add `ReactNativeApplication.[enable,metadataUpdated]` CDP messages for reading host metadata

Reviewed By: motiz88

Differential Revision: D58288490

fbshipit-source-id: 02384f0cdfaa35f1c5de9fad7ddd5aab483b2768
2024-06-12 09:39:08 -07:00
Alex Hunt 28ded2c6cd Move SessionMetadata to HostTargetDelegate (#44878)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44878

A refactor moving `SessionMetadata` (now renamed as `HostTargetMetadata`) out of `inspectorTarget->connect()` calls into a `HostTargetDelegate::getMetadata` method. This provides a cleaner interface and location for extending metadata fields in future.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D58288491

fbshipit-source-id: 67e8b9a3fb6d0b7966187fa98d9852222f242b9d
2024-06-12 09:39:08 -07:00
Samuel Susla 18be49e7bb split trace blocks inside of IntBufferBatchMountItem by type of operation (#44897)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44897

changelog: [internal]

To get better understanding of where the time is spent, let's split IntBufferBatchMountItem systrace section into individual types.

Reviewed By: javache

Differential Revision: D58080444

fbshipit-source-id: d71dcc74a042c6c40270ca6f1dc7a8735c0471b8
2024-06-12 08:32:26 -07:00
Alex Hunt 55e08a9319 Enable Fusebox by default in RNTester (#44895)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44895

Enables the new debugger stack (codename Fusebox) in RNTester.

This feature is experimental and is enabled for testing purposes only. This change **should not** be adopted as the default by React Native frameworks.

Changelog: [Internal]

Reviewed By: cortinico, rubennorte, NickGerleman

Differential Revision: D58366246

fbshipit-source-id: 809a1edb79ced4a7920457ed661cc3d863b35c7b
2024-06-12 08:30:40 -07:00
Pieter De Baets c92f31d834 Fix include directive to solve redefinition error (#44891)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44891

Changelog: [Internal]

Reviewed By: cortinico, fabriziocucci, cipolleschi

Differential Revision: D58459144

fbshipit-source-id: a07280de01c9ff4333e5140c6b741d88c1c5d89a
2024-06-12 07:24:40 -07:00
Fabrizio Cucci 33aa83a0e6 Stop ReactSurface in ReactDelegate::onHostDestroy (bridgeless) (#44873)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44873

Changelog:
[Android][Fixed] - Unmount React root when activity is destroyed on bridgless

Reviewed By: javache

Differential Revision: D58411605

fbshipit-source-id: ff9940efd4cf5da5887d79d99bcf3721e16d6725
2024-06-12 05:38:02 -07:00
Nicola Corti b8f1b92298 Setup publishing of Gradle Scans on GHA (#44879)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44879

This sets up publishing of Gradle scans for every build on GHA.

Changelog:
[Internal] [Changed] - Setup publishing of Gradle Scans on GHA

Reviewed By: blakef

Differential Revision: D58419361

fbshipit-source-id: f54365ad259324747248ef0bb726dc64964507f8
2024-06-12 03:47:00 -07:00