Compare commits

...
Author SHA1 Message Date
Nick GerlemanandGitHub 686cba76cd Update dangerfile.js 2024-10-22 23:26:57 -07:00
Nick GerlemanandGitHub debad23040 Update danger-pr.yml 2024-10-22 23:22:59 -07:00
Nick GerlemanandGitHub c9943e1375 Update danger-pr.yml 2024-10-22 23:16:51 -07:00
Nick GerlemanandGitHub d91b72be3f Update danger-pr.yml 2024-10-22 23:14:09 -07:00
Sam ZhouandFacebook GitHub Bot aadb1d9eb1 Eliminate final few React$AbstractComponent (#47163)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47163

In order to adopt react 19's ref-as-prop model, we need to eliminate all the places where they are treated differently. `React.AbstractComponent` is the worst example of this, and we need to eliminate it.

This diff replaces final few in libdefs.

Changelog: [internal]

Reviewed By: alexmckenley

Differential Revision: D64776942

fbshipit-source-id: 5e96c6d4fecb1b6cf539a00aecb10b9b35fc140b
2024-10-22 16:10:54 -07:00
Nick GerlemanandFacebook GitHub Bot 7715a95895 Add more lineHeight examples (#47162)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47162

Add some more interesting cases in prepration for screenshot testing

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D64775710

fbshipit-source-id: 70b390ad944841044e0d5004bddd1a8d3cfc6cbf
2024-10-22 15:49:49 -07:00
Ruslan LesiutinandFacebook GitHub Bot 3dfe22bd27 fix[Runtime.evaluate]: registered RuntimeExecutor should go through RuntimeScheduler (#47119)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47119

# Changelog:
[General] [Fixed] - Microtasks are now correctly executed after the code evaluation in Console panel of DevTools.

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

`runtimeExecutor` which is propagated here, is actually being used by Hermes:
https://www.internalfb.com/code/fbsource/[cba75f2b515a]/xplat/js/react-native-github/packages/react-native/ReactCommon/react/runtime/ReactInstance.cpp?lines=112-113

The issue was that any expression that should be evaluated as part of `Runtime.evaluate` was not going through `RuntimeScheduler`, because specified `runtimeExecutor` was not going through it as well, and it was defined prior to `RuntimeScheduler`. Because of this, `RuntimeScheduler` was not draining out the microtasks queue and basically any scheduled Microtasks were not executed, see T200616136.

With this fix, we create an executor that goes through `RuntimeScheduler`, which is using another executor that makes sure that all scheduled callbacks are only executed after `Inspector` was setup.

It is extremely messy and in the future we should untangle these circular dependencies and try to simplify the approach.

Reviewed By: rubennorte

Differential Revision: D64552372

fbshipit-source-id: 467d37c71a2eb7c940297ce90ca8d68268b1ff33
2024-10-21 22:10:28 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot cc23aea2fc Enable new **Border** and **Background** drawables on BackgroundStyleApplicator (#47124)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47124

With this we start the experiment to analyze the effect of the new `BackgroundDrawable.kt` and `BorderDrawable.kt` classes. This is also essentially a kotlinification of `CSSBackgroundDrawable`

We also start using CompositeBackgroundDrawable as the source of truth for **borderRadius** and **borderInsets**

We are hoping to get neutral results and a general win for code readability.

In general when the FeatureFlag passes we should not generate a CSSBackgroundDrawable at all and just use BackgroundDrawable and BorderDrawable

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63287222

fbshipit-source-id: 7ca98290c2e152b22d09b838e5f0e1cac97b1268
2024-10-21 21:24:19 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot b3d5b793a4 Add BorderDrawable to replace border logic on CSSBackgroundDrawable (#46745)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46745

**Note:** This diff still does nothing yet, it will be enabled on a diff further up the stack. This split is just to simplify reviewing

`CSSBackgroundDrawable` holds the drawing logic for both **Borders** and **Background**. This is not ideal since it results in a huge file which does 2 things.

We now have `CompositeBackgroundDrawable` which allows us to set a different drawable per "layer" on our view.

By splitting up **Border** and **Background** logic we get better modularity and it'll make it easier to implement more `backgroundImage` features without further bloating the `CSSBackgroundDrawable` file

Also, this helps with the kotlinification efforts

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D62898246

fbshipit-source-id: 15d1a4ef61f0c757e648c002fc7ef26626d8e3f6
2024-10-21 21:24:19 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot f41c59da96 Add BackgroundDrawable to replace background logic on CSSBackgroundDrawable (#46709)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46709

**Note:** This diff still does nothing yet, it will be enabled on a diff further up the stack. This split is just to simplify reviewing

`CSSBackgroundDrawable` holds the drawing logic for both **Borders** and **Background**. This is not ideal since it results in a huge file which does 2 things.

We now have `CompositeBackgroundDrawable` which allows us to set a different drawable per "layer" on our view.

By splitting up **Border** and **Background** logic we get better modularity and it'll make it easier to implement more `backgroundImage` features without further bloating the `CSSBackgroundDrawable` file

Also, this helps  with the kotlinification efforts

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63137921

fbshipit-source-id: fc459beadfda1832e146e36d74c3d424a28ca905
2024-10-21 21:24:19 -07:00
SamChou19815 (Meta Employee)andFacebook GitHub Bot 6205aad81e Eliminate usage of more than 1-arg React.AbstractComponent in React codebase (#31314)
Summary:
<!--
  Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.

Before submitting a pull request, please make sure the following is
done:

1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
  2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn test --debug --watch TestName`,
open `chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

In order to adopt react 19's ref-as-prop model, Flow needs to eliminate
all the places where they are treated differently.
`React.AbstractComponent` is the worst example of this, and we need to
eliminate it.

This PR eliminates them from the react repo, and only keeps the one that
has 1 argument of props.

## How did you test this change?

yarn flow

DiffTrain build for [45804af18d589fd2c181f3b020f07661c46b73ea](https://github.com/facebook/react/commit/45804af18d589fd2c181f3b020f07661c46b73ea)

Reviewed By: jbrown215

Differential Revision: D64725736

Pulled By: SamChou19815

fbshipit-source-id: c9f6f316c95d12a9ae98926faba111395b550ccf
2024-10-21 19:52:01 -07:00
Panos VekrisandFacebook GitHub Bot 363818ea20 pre-suppress errors before enabling experimental.object_freeze_fix (#47141)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47141

D64152004 fixed a soundness hole in Flow's checking of frozen object types (e.g. try-Flow https://fburl.com/rmct2mf6). This diff suppresses Flow errors that appear when this fix is enabled (`experimental.object_freeze_fix` flag is set).

For most of these cases the result of `Object.freeze()` is assigned to some variable typed as a mutable type. The variable is then passed to a context where its fields can be written to. Thus changing the annotation type to a readonly version would only cause more errors downstream. So, instead, these assignments are suppressed so that the choice of using Object.freeze can be revisited.

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D64699992

fbshipit-source-id: 48e4376d4ed3dbda21d32cabe512e6457384994f
2024-10-21 19:26:02 -07:00
Panos VekrisandFacebook GitHub Bot d25f0c5edd prepare for fix in Object.freeze typing [2/n] (#47131)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47131

D64152004 fixed a soundness hole in Flow's checking of frozen object types (e.g. try-Flow https://fburl.com/rmct2mf6)

This diff prevents Flow errors from appearing when `experimental.object_freeze_fix` flag is set.

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D64641920

fbshipit-source-id: b6de954d3474f5c4c2e2a58f69cf8cff61be53e5
2024-10-21 19:26:02 -07:00
Sam ZhouandFacebook GitHub Bot 036e4f64c4 Eliminate 2 more remaining React.AbstractComponent<...> in react native
Summary:
In order to adopt react 19's ref-as-prop model, we need to eliminate all the places where they are treated differently. `React.AbstractComponent` is the worst example of this, and we need to eliminate it.

This diff replaces 2 more remaining ones in react-native. Now the only remaining one is the one synced from react repo.

Changelog: [Internal]

Reviewed By: alexmckenley

Differential Revision: D64722899

fbshipit-source-id: 2b2484c385fc5d6c173253f9bee66dfc736368a5
2024-10-21 19:10:42 -07:00
Sam ZhouandFacebook GitHub Bot 71e9039e9f Prepare typing changes for HostComponent (#47150)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47150

In https://github.com/facebook/react/pull/31314, I will change the host component type that will be synced to react-native. Notably, it will expose the issue where all the `HostComponent<mixed>` types are wrong, since it doesn't make sense to write `React.AbstractComponent<mixed>`. This diff fixes the existing usages first in prep for that typing change.

Changelog: [Internal]

Reviewed By: alexmckenley

Differential Revision: D64722939

fbshipit-source-id: 14e1477090128205d8be8fc7b135a8478f94b790
2024-10-21 18:15:34 -07:00
Eli WhiteandFacebook GitHub Bot 4c37431c7f Support new codegen schema for native modules (#47114)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47114

Export the EventEmitter annotation from the codegen

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D63995813

fbshipit-source-id: 0211c21d7813da03bf8b6680095e016a621c188b
2024-10-21 16:43:49 -07:00
David VaccaandFacebook GitHub Bot e10c07d5ae Rollout enableDeletionOfUnmountedViews in OSS and NewArchitecture apps (#47144)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47144

I'm fully rolling out enableDeletionOfUnmountedViews in OSS

changelog: [internal] internal

Reviewed By: shwanton

Differential Revision: D64613764

fbshipit-source-id: 6dfecb9fe143ec59ddb71b614f12563a564578fc
2024-10-21 16:39:40 -07:00
Sam ZhouandFacebook GitHub Bot 723a37cb26 Replace most of the remaining React.AbstractComponent in react-native (#47143)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47143

In order to adopt react 19's ref-as-prop model, we need to eliminate all the places where they are treated differently. `React.AbstractComponent` is the worst example of this, and we need to eliminate it.

This diff replaces most of the remaining `React.AbstractComponent` in react-native.

Changelog: [Internal]

Reviewed By: alexmckenley

Differential Revision: D64701145

fbshipit-source-id: c765674fdf59812895c4fae43df97cf8b9d24f05
2024-10-21 15:48:25 -07:00
Nicola CortiandFacebook GitHub Bot dbf09fbe58 Stable API - Make AppStateModule internal (#47121)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47121

This class should be internal. I've verified this API is not used in OSS so this is technically breaking but not really affecting anyone in OSS.

Changelog:
[Android] [Breaking] - Stable API - Make AppStateModule internal

Reviewed By: Abbondanzo

Differential Revision: D64598660

fbshipit-source-id: aebc385c741e2e1f352d473db2be87d918f0ef65
2024-10-21 15:34:50 -07:00
David VaccaandFacebook GitHub Bot 1aaedc7fca Turnon enableEventEmitterRetentionDuringGesturesOnAndroid for all apps depending on ReactNativeNewArchitectureFeatureFlagsDefaults (#47142)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47142

I'm turning on enableEventEmitterRetentionDuringGesturesOnAndroid for all apps depending on ReactNativeNewArchitectureFeatureFlagsDefaults

Reviewed By: cortinico

Differential Revision: D64610897

fbshipit-source-id: c301f616918484ed41790247d1e0cd7284602b09
2024-10-21 13:57:09 -07:00
Mateo GuzmánandFacebook GitHub Bot d784d95568 docs(rn-tester): adding extra instructions to disable fabric (#47127)
Summary:
While working on https://github.com/facebook/react-native/pull/47110, I wanted to disable fabric in the `rn-tester` to test some things in Paper. I followed all the steps but ended up deleting the whole repository locally, cloning it again and explicitly installing the pods `fabric_enabled` in all steps and it didn't work. I ended up disabling the new architecture by passing `RCT_NEW_ARCH_ENABLED=0` and then it worked immediately.

Wanted to add this extra hint as it might help other contributors.

## Changelog:

[INTERNAL] [ADDED] - extra instructions to disable fabric in the `rn-tester` package

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

Test Plan: Follow the instructions to disable fabric, try passing `RCT_NEW_ARCH_ENABLED=0` if `fabric_enabled = false` is not enough.

Reviewed By: cortinico

Differential Revision: D64652149

Pulled By: rshest

fbshipit-source-id: 0fc4149832a7973c57161b4fff5815414f304a3c
2024-10-21 09:18:25 -07:00
Parsa NasirimehrandFacebook GitHub Bot 5697d923a0 fix(Android) - remove some unused imports in canvas utils (#47132)
Summary:
Was working on something, saw that CanvasUtils has some unused imports. Figured i'd send a PR to clean up.

## Changelog:

[INTERNAL] [FIXED] - Cleanup CanvasUtils imports

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

Test Plan:
Ran yarn test:

<img width="513" alt="Screenshot 2024-10-19 at 22 54 13" src="https://github.com/user-attachments/assets/6ca86852-cab5-425a-b71c-785c7d1ea95e">

Also tried running ./gradlew test, but it appears it is not having fun with my Node version (18.20.3), so `createBundleHermesReleaseJsAndAssets` randomly fails, to be investigated why:

<img width="1515" alt="Screenshot 2024-10-19 at 22 56 02" src="https://github.com/user-attachments/assets/f860cdc5-4f42-4d54-9497-7eaa028b6bc6">

Reviewed By: NickGerleman

Differential Revision: D64663918

Pulled By: cortinico

fbshipit-source-id: a681d6ee76dfcbc56889e76da6cf8ea11907bdf2
2024-10-20 18:28:11 -07:00
Jakub PiaseckiandFacebook GitHub Bot e7a3f479fe Add support for display: contents (#46584)
Summary:
This PR adds support for `display: contents` style by effectively skipping nodes with `display: contents` set during layout.

This required changes in the logic related to children traversal - before this PR a node would be always laid out in the context of its direct parent. After this PR that assumption is no longer true - `display: contents` allows nodes to be skipped, i.e.:

```html
<div id="node1">
  <div id="node2" style="display: contents;">
    <div id="node3" />
  </div>
</div>
```

`node3` will be laid out as if it were a child of `node1`.

Because of this, iterating over direct children of a node is no longer correct to achieve the correct layout. This PR introduces `LayoutableChildren::Iterator` which can traverse the subtree of a given node in a way that nodes with `display: contents` are replaced with their concrete children.

A tree like this:
```mermaid
flowchart TD
    A((A))
    B((B))
    C((C))
    D((D))
    E((E))
    F((F))
    G((G))
    H((H))
    I((I))
    J((J))

    A --> B
    A --> C
    B --> D
    B --> E
    C --> F
    D --> G
    F --> H
    G --> I
    H --> J

    style B fill:https://github.com/facebook/react-native/issues/050
    style C fill:https://github.com/facebook/react-native/issues/050
    style D fill:https://github.com/facebook/react-native/issues/050
    style H fill:https://github.com/facebook/react-native/issues/050
    style I fill:https://github.com/facebook/react-native/issues/050
```

would be laid out as if the green nodes (ones with `display: contents`) did not exist. It also changes the logic where children were accessed by index to use the iterator instead as random access would be non-trivial to implement and it's not really necessary - the iteration was always sequential and indices were only used as boundaries.

There's one place where knowledge of layoutable children is required to calculate the gap. An optimization for this is for a node to keep a counter of how many `display: contents` nodes are its children. If there are none, a short path of just returning the size of the children vector can be taken, otherwise it needs to iterate over layoutable children and count them, since the structure may be complex.

One more major change this PR introduces is `cleanupContentsNodesRecursively`. Since nodes with `display: contents` would be entirely skipped during the layout pass, they would keep previous metrics, would be kept as dirty, and, in the case of nested `contents` nodes, would not be cloned, breaking `doesOwn` relation. All of this is handled in the new method which clones `contents` nodes recursively, sets empty layout, and marks them as clean and having a new layout so that it can be used on the React Native side.

Relies on https://github.com/facebook/yoga/pull/1725

X-link: https://github.com/facebook/yoga/pull/1726

This PR adds a few things over the corresponding one in Yoga:
- new value in the `DisplayType` enum - `Contents`
- new `ShadowNodeTrait` - `ForceFlattenView`, that forces the node not to form a host view
- updates TS types to include `display: contents`
- aliases `display: contents` to `display: none` on the old architecture

## Changelog:

[GENERAL] [ADDED] - Added support for `display: contents`

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

Test Plan:
<details>
<summary>So far I've been testing on relatively simple snippets like this one and on entirety of RNTester by inserting views with `display: contents` in random places and seeing if anything breaks.</summary>

```jsx
import React from 'react';
import { Button, Pressable, SafeAreaView, ScrollView, TextInput, View, Text } from 'react-native';

export default function App() {
  const [toggle, setToggle] = React.useState(false);
  return (
    <View style={{flex: 1, paddingTop: 100}}>
      <SafeAreaView style={{width: '100%', height: 200}}>
        <Pressable style={{width: 100, height: 100, backgroundColor: 'black'}} onPress={() => setToggle(!toggle)}>
          <ScrollView />
        </Pressable>
        <View style={{display: 'flex', flexDirection: 'row', flex: 1, backgroundColor: 'magenta'}}>
          <SafeAreaView style={{
            // display: 'contents',
            flex: 1,
            }}>
            <View style={{
              display: 'contents',
              width: '100%',
              height: 200,
              }}>
              <View style={{
                  display: 'contents',
                  flex: 1,
                }}>
                { toggle && <View style={{flex: 1, backgroundColor: 'yellow'}} /> }
                <View style={{flex: 1, backgroundColor: 'blue'}} />
                <View style={{flex: 1, backgroundColor: 'cyan'}} />
              </View>
            </View>
          </SafeAreaView>
        </View>
        {/* <View style={{width: 100, height: 100, backgroundColor: 'magenta', display: 'flex'}} /> */}
        <TextInput style={{width: 200, height: 100, backgroundColor: 'red', display: 'flex'}}>
          <Text style={{color: 'white'}}>Hello</Text>
          <Text style={{color: 'green'}}>World</Text>
        </TextInput>
      </SafeAreaView>
    </View>
  );
}
```

</details>

Reviewed By: joevilches

Differential Revision: D64584476

Pulled By: NickGerleman

fbshipit-source-id: bec77b5087ff95f0980cf02274fbb2c8581eb3c0
2024-10-18 22:05:41 -07:00
Jakub PiaseckiandFacebook GitHub Bot e5296cfc81 Add support for display: contents style (#47035)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47035

This PR adds support for `display: contents` style by effectively skipping nodes with `display: contents` set during layout.

This required changes in the logic related to children traversal - before this PR a node would be always laid out in the context of its direct parent. After this PR that assumption is no longer true - `display: contents` allows nodes to be skipped, i.e.:

```html
<div id="node1">
  <div id="node2" style="display: contents;">
    <div id="node3" />
  </div>
</div>
```

`node3` will be laid out as if it were a child of `node1`.

Because of this, iterating over direct children of a node is no longer correct to achieve the correct layout. This PR introduces `LayoutableChildren::Iterator` which can traverse the subtree of a given node in a way that nodes with `display: contents` are replaced with their concrete children.

A tree like this:
```mermaid
flowchart TD
    A((A))
    B((B))
    C((C))
    D((D))
    E((E))
    F((F))
    G((G))
    H((H))
    I((I))
    J((J))

    A --> B
    A --> C
    B --> D
    B --> E
    C --> F
    D --> G
    F --> H
    G --> I
    H --> J

    style B fill:https://github.com/facebook/yoga/issues/050
    style C fill:https://github.com/facebook/yoga/issues/050
    style D fill:https://github.com/facebook/yoga/issues/050
    style H fill:https://github.com/facebook/yoga/issues/050
    style I fill:https://github.com/facebook/yoga/issues/050
```

would be laid out as if the green nodes (ones with `display: contents`) did not exist. It also changes the logic where children were accessed by index to use the iterator instead as random access would be non-trivial to implement and it's not really necessary - the iteration was always sequential and indices were only used as boundaries.

There's one place where knowledge of layoutable children is required to calculate the gap. An optimization for this is for a node to keep a counter of how many `display: contents` nodes are its children. If there are none, a short path of just returning the size of the children vector can be taken, otherwise it needs to iterate over layoutable children and count them, since the structure may be complex.

One more major change this PR introduces is `cleanupContentsNodesRecursively`. Since nodes with `display: contents` would be entirely skipped during the layout pass, they would keep previous metrics, would be kept as dirty, and, in the case of nested `contents` nodes, would not be cloned, breaking `doesOwn` relation. All of this is handled in the new method which clones `contents` nodes recursively, sets empty layout, and marks them as clean and having a new layout so that it can be used on the React Native side.

Relies on https://github.com/facebook/yoga/pull/1725

Changelog: [Internal]

X-link: https://github.com/facebook/yoga/pull/1726

Test Plan: Added tests for `display: contents` based on existing tests for `display: none` and ensured that all the tests were passing.

Reviewed By: joevilches

Differential Revision: D64404340

Pulled By: NickGerleman

fbshipit-source-id: f6f6e9a6fad82873f18c8a0ead58aad897df5d09
2024-10-18 22:05:41 -07:00
Fabrizio CucciandFacebook GitHub Bot f3e37e29e2 Back out "Account for diffrent frame size when using maintainVisibleContentPosition in virtualized lists" (#47125)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47125

Original commit changeset: 9f05a461d178

Original Phabricator Diff: D64238887

Changelog: [Internal]

NOTE: while this seems to work on IGVR it breaks on the two use cases highlighted in D64339251, backing out the diff while trying to find out a solution that works on all cases!

Reviewed By: Abbondanzo

Differential Revision: D64611594

fbshipit-source-id: b43353b17448c181a76b2af09968cf0e4934c53c
2024-10-18 13:49:46 -07:00
Fabrizio CucciandFacebook GitHub Bot 16ceb6f74c Add maintainVisibleContentPosition example in rn-tester (#47126)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47126

This will be used to validate the fix to `maintainVisibleContentPosition` for the two major use cases when the FlatList resizes:
* when the items have fixed size
* when the items scale with the size of the list

Changelog: [Internal]

Reviewed By: Abbondanzo

Differential Revision: D64339251

fbshipit-source-id: d0ee8d73cd9e6527a7ce0950e8f3941337b70474
2024-10-18 13:48:52 -07:00
David VaccaandFacebook GitHub Bot 1cc648feca Interrupt thread before throwing in BridgelessDevSupportManager (#47100)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47100

We should interrupt thread before throwing

changelog: [internal] internal

Reviewed By: bvanderhoof, arushikesarwani94

Differential Revision: D64545258

fbshipit-source-id: dec90ca2e75b8f3bceb258edbb525372065962ee
2024-10-18 11:13:40 -07:00
Alex HuntandFacebook GitHub Bot 6f421230c1 Drop appId from /open-debugger calls, disable matching for modern targets (#47120)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47120

Fixes no-op behaviour of the "Open DevTools" Dev Menu item (bug on `main` introduced with D63329456).

This was caused by a change to the `description` field contents in our CDP `/json/list` response, when under Fusebox. In the `/open-debugger` call from the Dev Menu, we were still using the older `appId` param.

This did not affect `j` to debug, which uses the `target` param.

{F1937186832}

Changes:

In short: Matching against the `description` string is now fully eliminated for modern debugger targets.

- Update native Dev Menu implementation to omit `appId` parameter (`device` param alone is sufficient and fully precise on these platforms).
- Update `/open-debugger` implementation to ignore the `appId` parameter for modern targets, and document this in the `dev-middleware` README.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D64597581

fbshipit-source-id: 46f536e7d0a4ececab0d52f4c0704e8698466cd0
2024-10-18 11:02:51 -07:00
Nicola CortiandFacebook GitHub Bot dc1a498d39 Undo breaking change on UIManager eventDispatcher accessor (#47088)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47088

Whe migrating this interface to Kotlin we've subtly introduced a breaking change which is causing a lot of breakages in the ecosystem.

This is forcing users to do:
```
// Before
reactContext.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher
// After
reactContext.getNativeModule(UIManagerModule::class.java)!!.getEventDispatcher()
```

This reverts this breaking change.

Plus the method had a generic parameters which was completely unnecessary so I'm removing it.

Changelog:
[Android] [Fixed] - Undo breaking change on UIManager eventDispatcher accessor

Reviewed By: cipolleschi

Differential Revision: D64533594

fbshipit-source-id: c4f9a36993a22839fae90fb239f883305422ecec
2024-10-18 08:33:25 -07:00
Samuel SuslaandFacebook GitHub Bot 5c6edc6861 add comment to EventBeat clarifying its use (#47065)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47065

changelog: [internal]

Just a comment explaining intended use.

Reviewed By: tdn120

Differential Revision: D64469189

fbshipit-source-id: 65cb0c5ea4669f748abe1e78fd25816e895c3f58
2024-10-18 05:47:47 -07:00
shubhamguptadream11andFacebook GitHub Bot 45b177f50d fix: height and width added back in props (#47044)
Summary:
Fixes this: https://github.com/facebook/react-native/issues/41151

## Changelog:

[GENERAL] [FIXED] - Passed height and width as native props to support cases where source is an array.

**Issue**: Unable to use height and width as props in Image components when passing source as an array.

This functionality worked before this [commit](https://github.com/facebook/react-native/pull/34481). In Image.android.js and Image.ios.js, height and width props are extracted before passing them to the native side. This extraction makes these props ineffective when passed directly. Although setting height and width in style is a workaround, these props should still be respected since they exist for this purpose.

The issue occurs only when the source prop is an array. When source is an object, width and height are manually passed to the style object, so the issue doesn't arise.

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

Test Plan: Tested this on `rn-tester` app

Reviewed By: necolas, javache

Differential Revision: D64458292

Pulled By: cipolleschi

fbshipit-source-id: 5cacad79b8d4468a4a1fd0977221e42ce4b2e5d1
2024-10-18 05:04:11 -07:00
Samuel SuslaandFacebook GitHub Bot b0f0f0631c delete typealias RunLoopObserver::Unique (#47117)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47117

changelog: [internal]

use unique_ptr directly instead of typealias obscuring the type.

Reviewed By: christophpurrer

Differential Revision: D64302758

fbshipit-source-id: 5a7ee2408a04de6cf1e60036463227cd2b455fcf
2024-10-18 04:52:45 -07:00
Tim YungandFacebook GitHub Bot c9ea05552f RN: Fix lint/sort-imports Errors (#47109)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47109

Fixes the `lint/sort-imports` errors that are now surfaced after fixing the lint configuration.

For a couple files, I added lint suppressions instead because the unsorted import ordering is important due to interleaved calls with side effects.

Changelog:
[Internal]

Reviewed By: GijsWeterings

Differential Revision: D64569485

fbshipit-source-id: 26415d792e2b9efe08c05d1436f723faae549882
2024-10-18 04:07:02 -07:00
Frank CaliseandFacebook GitHub Bot e14a2f3862 test(rn-tester): skip loading indicators when list is empty (#47094)
Summary:
During testing for 0.76-RC6, I came across the following behavior in RNTester.

Components > FlatList > Basic > Toggle `Empty` switch

You'll notice there are activity indicators in the header/footer (see video) for some time and things appear to be somewhat janky. I think the expectations would be to see only the `ListEmptyComponent` that is defined for this to look more correct. This will help not give any false indication that something has gone wrong with the latest picks when testing newer versions.

## Changelog:

[INTERNAL] [FIXED] - Fixed FlatList Empty behavior in RNTester

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

Test Plan: https://github.com/user-attachments/assets/6e116641-5b24-473c-a654-7d32a081b83f

Reviewed By: yungsters

Differential Revision: D64541905

Pulled By: cipolleschi

fbshipit-source-id: 0447d99588d85f9e1a46c6da169a0838e94994bc
2024-10-18 03:33:22 -07:00
Pieter De BaetsandFacebook GitHub Bot 95a5d1c628 Explicity reset typeface in updateTextPaint (#47097)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47097

Calling Paint.reset() doesn't reset the active type face (https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/libs/hwui/hwui/PaintImpl.cpp;l=86), which causes measurements bugs for Text which don't specify a font to be incorrect.

Changelog: [Android][Fixed] Text without explicit font styles was potentially cut-off.

Reviewed By: NickGerleman

Differential Revision: D64535719

fbshipit-source-id: d300c26bf828a0e2e4b170254f9be5f409aff2dc
2024-10-18 03:29:34 -07:00
Nick GerlemanandFacebook GitHub Bot 0a2dec175e Remove legacy absolute positioning path (#46984)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46984

X-link: https://github.com/facebook/yoga/pull/1725

The legacy (wrong) absolute positioning path positions in two places, including work that is definitely always overwritten in the new absolute layout path.

This came up before for position: static, but we didn't clean this up at the time. This code is also now leading display: contents impl being more annoying.

This diff tries to converge to the more spec correct implementation of positioning here, that also only happens in one place.

Previous path would potentially also incorrectly justify when `justify-content` was non-default, but not handled in the previous few cases? We don't have access to the flexLine at this point later, and apart from the existing tests now passing I reused the new correct logic for justification (spec says we should position child as if its the only child in the container https://www.w3.org/TR/css-flexbox-1/#abspos-items).

I added a new, more scoped errata `AbsolutePositionWithoutInsetsExcludesPadding` to preserve some of the legacy behavior that showed as very breaking.

I also did not try removing `AbsolutePercentAgainstInnerSize` which I suspect would be more breaking than this change.

Changelog:
[General][Breaking] - More spec compliant absolute positioning

Reviewed By: joevilches

Differential Revision: D64244949

fbshipit-source-id: ca97570e0de82e8f0424a0912adfd0b05254559e
2024-10-17 22:40:16 -07:00
Phillip PanandFacebook GitHub Bot 2ffd31bbd7 set modal rendered state to false on unmount (#47078)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47078

Changelog: [Internal]

in fabric, we've found a scenario where this modal state update is required to cleanup all artifacts from the modal presentation views. it is safe to add this back, as it was originally removed for a scenario that no longer exists.

Reviewed By: shwanton

Differential Revision: D64388550

fbshipit-source-id: f13571260379554b0126c379ace9f9e1b81866be
2024-10-17 22:09:43 -07:00
Nick GerlemanandFacebook GitHub Bot 0ba00fc998 Merge Android ViewNativeComponent ViewConfig into BaseViewConfig (#47105)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47105

`codegenNativeComponent` expects we declare props as extending `ViewProps`, but the generated ViewConfig extends from BaseViewConfig.

This doesn't matter on iOS, where ViewProps are implemented more uniformly across components, but on Android, means we miss about 40 view props, since `ReactViewManager` backing `<View>` supports quite a bit more than `BaseViewManager`. This means that any components which extend `ReactViewManager` have some ViewProps omitted.

In this diff, I went with the solution of moving the props specific to View's ViewConfig to BaseViewConfig. This means the SVC may treat more props as valid than the underlying native component, but this should be safe compared to undercounting, and this will make future moves from ReactViewManager to BaseViewManager safer.

BaseViewConfig was already exposing props not supported by BaseViewManager, like those related to border widths (which effect LayoutShadowNode, but cannot be drawn out of the box?), so this shouldn't be too out there.

The alternative to this was to publicly expose the View ViewConfig and extend from that in codegen instead, but this seemed more complicated without much benefit.

Changelog:
[Android][Fixed] - Merge Android ViewNativeComponent ViewConfig into BaseViewConfig

Reviewed By: elicwhite

Differential Revision: D64570806

fbshipit-source-id: de5c590e935c879e33d59c36ddce1f2481023c19
2024-10-17 20:51:11 -07:00
Sam ZhouandFacebook GitHub Bot 797d013308 Deploy 0.250.0 to xplat (#47108)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47108

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D64577261

fbshipit-source-id: 265e1f6755fde3836bb7aa15116e2bb380cee091
2024-10-17 19:54:04 -07:00
Shawn DempseyandFacebook GitHub Bot d78cb78b15 React Activity exposes ReactHost (#46980)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46980

Changelog: [Android][Added]  React Activity exposes ReactHost

**Context:**

*These changes will not impact `DefaultReactHost` which is the way most OSS apps interface with `ReactHost`*

* We are simplifying `ReactHost` and `ReactHostDelegate` for Brownfield uses.
* We fetch the `ReactHost` to create the `ReactDelegate`
https://www.internalfb.com/code/fbsource/[00ee07afc695]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java?lines=110-112

* With Bridgeless, you must use or extend `ReactHostDelegate` to get the `ReactHost` since we don't expose a getter on `ReactActivity`.
* If there is a custom Application, then getting the `ReactHost` will need a custom implementation.
* For the base case, we shouldn't need to subclass the delegate.

**Change:**

* Expose `ReactHost` on `ReactActivity` for Bridgeless access.
* Expose `ReactActivity` on `ReactActivityDelegate`. This will help us avoid keeping a reference to Activity in each subclass.
* Update the RN Android API's

Reviewed By: arushikesarwani94

Differential Revision: D64150994

fbshipit-source-id: a9d790a4b4ce4eca29dee4bdc8d9fc56cf742f1f
2024-10-17 19:33:40 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot 398512a4ed Fix getOpacity() for drawables (#47103)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47103

`getOpacity()` is supposed to return a PixelFormat enum instead of a value between 0..255.
https://developer.android.com/reference/android/graphics/drawable/Drawable#getOpacity()

Also, I'm taking the value from the paint instead of the color's alpha since the paint might've been modified by setAlpha by this point and otherwise the paint will hold the alpha set by the color anyway since setAlpha() on Paints is just a helper for setColor() (https://developer.android.com/reference/android/graphics/Paint#setAlpha(int))

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D64273014

fbshipit-source-id: e2c524f1d816ee3705c5118232be759898e666ea
2024-10-17 17:37:25 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot 02e4f3e16a Nullable borderRadius optimization on shadows and outline (#46819)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46819

Just some preparation to implement the new `BackgroundDrawable` and `BorderDrawable`.

This makes shadows and outline rely on `CompositeBackgroundDrawable` to set the state of `BorderRadiusStyle` and also makes them have a nullable borderRadius variable and initialize it only if we have it set saving a bit of overhead and performance

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63798853

fbshipit-source-id: 994327415ba160cf8e5ccb3135c4917809499f81
2024-10-17 17:37:25 -07:00
Tim YungandFacebook GitHub Bot 892ce1b980 RN: Fix sort-imports Lint Configuration (#47104)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47104

In https://github.com/facebook/react-native/pull/46082, the lint configuration for `lint/sort-imports` was accidentally removed.

This has happened on more than one occasion in the past. In order to prevent this from happening again in the future, I'm also adding a Jest integration test to verify that this lint rule is enabled in the `eslintrc.js` configuration.

Changelog:
[Internal]

Reviewed By: robhogan

Differential Revision: D64547410

fbshipit-source-id: ec4f14aff140691b644189dfa3116a3d39285f80
2024-10-17 17:06:20 -07:00
Rubén NorteandFacebook GitHub Bot 14bbb87516 Fix incorrect type being passed to NativePerformance.mark (#47102)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47102

Changelog: [internal]

In D64466057 / https://github.com/facebook/react-native/commit/32f7b3b4e0b8be1d1138f43c46b3c86d9a64c29a we accidentally modified the API of `NativePerformance.mark` (which we wanted to preserve and move the changes to `NativePerformance.markWithResult` after some iteration) to make `startTime` optional, which isn't compatible with the previous native API.

This fixes the issue by reverting the type back to being required and always passing it from the JS API.

Differential Revision: D64557467

fbshipit-source-id: 3ade4271622ac6213fd4c2d4948c7d40e4abe715
2024-10-17 13:05:01 -07:00
Edmond ChuiandFacebook GitHub Bot d11954e800 add appId to Telemetry (#47099)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47099

Changelog: [Internal]

As discussed in D64547367, recent changes caused `description` to stop reporting `appId`.

This impacted Telemetry's "top apps" dashboards.
{F1936011487}

Reviewed By: hoxyq

Differential Revision: D64548348

fbshipit-source-id: 46af650a89e2bef7be000482e7b774f56f84cac3
2024-10-17 12:47:05 -07:00
Edmond ChuiandFacebook GitHub Bot 0d591d9dc3 add appId as a standalone field (#47098)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47098

Changelog: [Internal]

D63329456 updated the `description` field to be human-readable.
Unfortunately, InspectorProxy relies on this field to compare the incoming `/open-debugger` calls.

hoxyq discovered the symptom of Fusebox failing to launch with `No compatible apps connected. React Native DevTools can only be used with the Hermes engine.` in Metro

Reviewed By: hoxyq

Differential Revision: D64547367

fbshipit-source-id: deed6851f3ede2c74be2b492def1eba6e58c43e6
2024-10-17 12:47:05 -07:00
Joe VilchesandFacebook GitHub Bot 1d6ac09530 Fix animating background colors in View (#47101)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47101

See https://github.com/facebook/react-native/issues/47011

borders do not have this problem because they call `removeAllAnimations` on the layer after changing it, which is what I am doing here

Changelog: [iOS] [fixed] - Fixed bug where background colors would sometimes animate when changing on Views

Reviewed By: cipolleschi

Differential Revision: D64493968

fbshipit-source-id: cf81549f21b124b67c6e7647c6ae827bfe80a9cf
2024-10-17 11:58:12 -07:00
Samuel SuslaandFacebook GitHub Bot d3fa580508 unify overlapping logic among platform specific EventBeats (#47085)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47085

changelog: [internal]

Move induce method from  AppleEventBeat and AndroidEventBeat to its subclass EventBeat.

# Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override EventBeat::request and EventBeat::induce.

Reviewed By: christophpurrer

Differential Revision: D64302639

fbshipit-source-id: cdea5ee64dc25633ae59fdce5b1ce6aff8a97d68
2024-10-17 11:51:22 -07:00
Samuel SuslaandFacebook GitHub Bot 9fe253d677 delete AsynchronousEventBeat in favour of platform specific EventBeats (#47058)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47058

changelog: [internal]

# Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override EventBeat::request and EventBeat::induce.

Reviewed By: christophpurrer

Differential Revision: D64291889

fbshipit-source-id: fa46e2c5246e1a9a1b5f3bd02e5c0efa562188e9
2024-10-17 11:51:22 -07:00
Nicola CortiandFacebook GitHub Bot 7168a9d1a2 Stable API - Make AccessibilityInfoModule internal (#47092)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47092

This class should not be public. I'm updating the BUCK rule to make it `internal` and remove it from the public API surface.

Technically breaking however I haven't found meaningful usages of this API in OSS so this should be safe to ship.

Changelog:
[Android] [Breaking] - Make `AccessibilityInfoModule` internal

Reviewed By: mdvacca

Differential Revision: D64539866

fbshipit-source-id: 21c9965dc95b697bef93bbad23872921a73566aa
2024-10-17 11:46:41 -07:00
Peter AbbondanzoandFacebook GitHub Bot c54b23ff9e Ensure alert dialog title wraps to two lines, uses default style (#47095)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47095

The [internal `DialogTitle` implementation from Android](https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/com/android/internal/widget/DialogTitle.java;l=63?q=DialogTitle) makes additional checks to see if the title should wrap to two lines before applying ellipsis, so this change recreates those same checks. This change also removes the text appearance and size changes made to the layout.

Reverts some of the changes made to https://github.com/facebook/react-native/pull/45395.

**Changelog:**
[Android][Fixed] - Fixed styling on alert dialog titles to wrap two lines and retain bold appearance

Reviewed By: cortinico

Differential Revision: D64543105

fbshipit-source-id: 30d1f9091aa7216eb5d00e4f8f14cbc719c803ea
2024-10-17 11:34:00 -07:00
yungsters (Meta Employee)andFacebook GitHub Bot dc737a7356 Delete __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED from React Native Renderer (#31276)
Summary:
## Summary

The React Native Renderer exports a
`__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED` property with a
single method that has no remaining call sites:
`computeComponentStackForErrorReporting`

This PR cleans up this unused export.

## How did you test this change?

```
$ yarn
$ yarn flow fabric
$ yarn test
```

DiffTrain build for [a3d9ea05bf01f3c3d7aedc2d938c581ad11fd14a](https://github.com/facebook/react/commit/a3d9ea05bf01f3c3d7aedc2d938c581ad11fd14a)

Reviewed By: rickhanlonii, kassens

Differential Revision: D64484457

Pulled By: yungsters

fbshipit-source-id: 9a7629210739d23175480191d30fc02ba3ee2fee
2024-10-17 10:56:28 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 8e80257f23 Add Changelog for 0.76.0-rc.6 (#47096)
Summary:
See changelog

## Changelog:
[Internal] - Add changelog for 0.76.0-rc.6

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

Test Plan: N/A

Reviewed By: blakef

Differential Revision: D64545320

Pulled By: cipolleschi

fbshipit-source-id: ebfe57f5009f9b1906856cc90a19dd858e7e6583
2024-10-17 10:39:08 -07:00
Cristian MatteuandFacebook GitHub Bot 4ae999b90b Add announceForAccessibilityWithOptions method mock. (#47063)
Summary:
Currently, tests on components that use the `AccessibilityInfo.announceForAccessibilityWithOptions` method fail because a mock for this method is not present in the `jest` setup file. This PR adds the mock for the before mentioned method in the appropriate `setup.js` file
## Changelog:
[General][Added] - Added the missing `announceForAccessibilityWithOptions` function mock in the `packages/react-native/jest/setup.js` file.

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

Test Plan:
Here are the commands I executed after making the modification:
- `yarn prettier`
- `yarn lint`
- `yarn test`
### Test output
![rn-tests-output](https://github.com/user-attachments/assets/81e9772e-37ce-43ad-9869-5f7f64c292f0)

Reviewed By: tdn120

Differential Revision: D64495941

Pulled By: lunaleaps

fbshipit-source-id: 6ab835e2934b87ec3ac64cf0aebd8dcb58cd0da1
2024-10-17 09:20:32 -07:00
Alex HuntandFacebook GitHub Bot 52ea8b07e2 Specify package manager version for project (#47091)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47091

Prompted by https://github.com/facebook/react-native/pull/47083, this change adds a `"packageManager"` field to the root `package.json` specifying `yarn@1.22.22`. This will configure a compatible, predictable version of Yarn for users using [Corepack](https://nodejs.org/api/corepack.html) via the Yarn Modern install process.

See https://yarnpkg.com/getting-started/install and https://nodejs.org/api/corepack.html.

Tested on a fresh system (GitHub Codespaces).

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D64536673

fbshipit-source-id: 535c0ca725172e4a06de04b19c6cd2d31788f5a4
2024-10-17 07:55:07 -07:00
Riccardo CipolleschiandFacebook GitHub Bot f1d2331dfb We use the right filename as hash in CI cache key (#47087)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47087

In the repo, we don't have a `build-apple-framewroks.sh` file, but we do have a `build-apple-framewrok.sh` file, with no ending `s`

## Changelog:
[Internal] - Fix CI cache key

Reviewed By: cortinico

Differential Revision: D64531456

fbshipit-source-id: 05c104390b875eeef2cf15f8a30c8672cfc9b61d
2024-10-17 07:47:51 -07:00
Robert PasińskiandFacebook GitHub Bot 32f7b3b4e0 fix: performance.measure with mark names (#46786)
Summary:
This PR improves PerformanceObserver Native Public API and fixes issue with `performance.measure` not working with mark names.

## Changelog:

 - Made `PerformanceEntryReporter::report[Mark|Measure]` return the created entry with computed data.
 - Updated JS-Native interface to return computed data from Native side to JS.
 - Updated JS tests

[GENERAL] [FIXED] - Fixed `performance.measure` with mark names
[GENERAL] [INTERNAL] - `PerformanceEntryReporter::reportMark` and `PerformanceEntryReporter::reportMeasaure` now return created performance entries.

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

Test Plan:
- [ ] Update JS tests
 - [ ] Update Native tests

Reviewed By: rshest

Differential Revision: D64466057

Pulled By: rubennorte

fbshipit-source-id: d280d66c268a9830fbc9e6f3304e108ecf870a59
2024-10-17 07:25:50 -07:00
Edmond ChuiandFacebook GitHub Bot ff113545cf Update debugger-frontend from a897db8...117c96a (#47072)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47072

Changelog: [Internal] - Update `react-native/debugger-frontend` from a897db8...117c96a

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

Reviewed By: hoxyq

Differential Revision: D64487276

fbshipit-source-id: ae7efce5dadf72f62c824d0acbc6aa6d44149905
2024-10-17 07:25:20 -07:00
Nicola CortiandFacebook GitHub Bot 7bbac8ee27 Migrate MainReactPackage to Kotlin (#47070)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47070

For the sake of Stable API, I'd like to get this class converted to Kotlin

The class is becoming `final` so could be breaking for some users if they subclass `MainReactPackage` which I believe this should not be a valid usage of this API.

Changelog:
[Android] [Changed] - Migrate MainReactPackage to Kotlin (and make it final)

Reviewed By: tdn120

Differential Revision: D64479418

fbshipit-source-id: 24a07de4e5796a7b82ba34c9b36511b8fc526f1a
2024-10-17 05:29:04 -07:00
Nicola CortiandFacebook GitHub Bot 2d2bb9c588 Undo breaking change on ViewManagerDelegate.kt String params (#47086)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47086

When we migrated `ViewManagerDelegate` to Kotlin, we convered his string params to be `String` (rather than `String?`).

Existing implementation of this interface in OSS written in Kotlin were using `String?` due to this interface being in Java (and not being Nullsafe annotated).
Therefore now changing this interface from `String?` to `String` is a breaking change for them.

Affected libraries are:
https://github.com/search?q=%22fun+receiveCommand%28%22+%22commandId%3A+String%3F%22+%22args%3A+ReadableArray%22+language%3Akotlin+-org%3Afacebook+-is%3Afork&type=code&p=4

This prevents the breaking change and should be included in 0.76.

Changelog:
[Android] [Fixed] - Undo breaking change on ViewManagerDelegate.kt String params

Reviewed By: cipolleschi

Differential Revision: D64532446

fbshipit-source-id: aac286554ad0e35f557160f900bcbad1acc5930d
2024-10-17 04:45:05 -07:00
Samuel SuslaandFacebook GitHub Bot c90ab6e878 use unique_ptr instead of shared_ptr in RCTScheduler (#47055)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47055

changelog: [internal]

no need to use shared_ptr here.

Reviewed By: christophpurrer

Differential Revision: D64464645

fbshipit-source-id: 8947ac8d13322ace3204697047a7582940f98687
2024-10-17 04:42:46 -07:00
Rubén NorteandFacebook GitHub Bot 2d9fe11578 Unify feature flags for event loop (2nd attempt) (#47084)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47084

Changelog: [internal]

This unifies all the feature flags that control the new event loop on RN. Before, we'd have granular flags for different aspects of it. With this diff, we enable the event loop by default with bridgeless, and we introduce a new flag to explicitly disable it in that case if necessary.

When we're ready to clean up this opt-out, we just need to remove the `&& !ReactNativeFeatureFlags::disableEventLoopOnBridgeless()` conditions.

Reviewed By: fkgozali

Differential Revision: D64464902

fbshipit-source-id: d1a0ba38dd4c189c2da905b49de23a821223ac3a
2024-10-17 04:42:37 -07:00
Rubén NorteandFacebook GitHub Bot f92863e815 Add support for feature flags without native implementation (#47059)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47059

Changelog: [internal]

This adds a new configuration for feature flags to preserve their definition only in JavaScript and skip their native API and implementations. This is useful to preserve the API in JavaScript when JavaScript changes progress faster than native changes.

Reviewed By: sammy-SC

Differential Revision: D64464779

fbshipit-source-id: 0af9624daad7bd655172905f8f616d53655cb407
2024-10-17 04:42:37 -07:00
Samuel SuslaandFacebook GitHub Bot a72510d586 delete EventBeat's copy ctor and remove default implementation for induce (#47057)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47057

changelog: [internal]

EventBeat should never be copied. Make that explicit.
EventBeat::induce must never be empty, remove the default implementation.

# Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override EventBeat::request and EventBeat::induce.

Reviewed By: christophpurrer

Differential Revision: D64291845

fbshipit-source-id: 9265491c33b23d6ec2ccad4e2ea55e2b11211e6a
2024-10-17 04:36:28 -07:00
Samuel SuslaandFacebook GitHub Bot e6ba1db5e9 rename AsyncEventBeat to AndroidEventBeat (#47053)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47053

changelog: [internal]

AsyncEventBeat is Android specific, let's rename it to reflect that.

Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override EventBeat::request and EventBeat::induce.

Reviewed By: christophpurrer

Differential Revision: D64301829

fbshipit-source-id: cc550ce3836764519c2f4ef849d699ed66226359
2024-10-17 04:36:28 -07:00
Samuel SuslaandFacebook GitHub Bot c36806f9e8 pass eventBeat directly into EventDispatcher (#47052)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47052

changelog: [internal]

EventBeat can be constructed in Scheduler and passed to EventDispatcher. This is cleaner than passing down all dependencies and constructing it in place.

# Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override EventBeat::request and EventBeat::induce.

Reviewed By: christophpurrer

Differential Revision: D64291401

fbshipit-source-id: ef6d2bdb630767de1dab6052d9d9226c9e1a5f3c
2024-10-17 04:36:28 -07:00
Samuel SuslaandFacebook GitHub Bot b1ec76e2ad copy by value in RunLoopObserver ctor (#47051)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47051

changelog: [internal]

copy weak owner instead of using const&. const& is wrong here and hides important information because weak owner is always copied into ivat.

Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override EventBeat::request and EventBeat::induce.

Reviewed By: christophpurrer

Differential Revision: D64291515

fbshipit-source-id: 3e74270f03fac121e9f45b0a8ad287ccdb0a059a
2024-10-17 04:36:28 -07:00
Samuel SuslaandFacebook GitHub Bot e00002131c refactor EventBeat owner (#47050)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47050

changelog: [internal]

- Rename SchedulerToolbox::asynchronousEventBeatFactory to SchedulerToolbox::eventBeatFactory. There is only one eventBeat, no need to distinguish between sync and async.
- Remove typealias EventBeat::SharedOwnerBox and pass by value instead of const&.

# Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override `EventBeat::request` and `EventBeat::induce`.

Reviewed By: christophpurrer

Differential Revision: D64291288

fbshipit-source-id: 96afc56a51677ed9e61b2a662bb968678fa770f7
2024-10-17 04:36:28 -07:00
Nicola CortiandFacebook GitHub Bot 125d01286f Add -Xshare:off for Unit tests (#47066)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47066

This suppresses the warning:
```
Sharing is only supported for boot loader classes because bootstrap classpath has been appended
```

which is not relevant for us.

Changelog:
[Internal] [Changed] - Add -Xshare:off for Unit tests

Reviewed By: cipolleschi

Differential Revision: D64474372

fbshipit-source-id: 67d0a2da47ecd1d4ab906b03515b9a59f2e4f245
2024-10-17 04:33:01 -07:00
Blake FriedmanandFacebook GitHub Bot 19971092b6 Add changelog for 0.76.0-rc.5 (#47037)
Summary:
Changelog:
[Internal] - add changelog

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

Reviewed By: NickGerleman

Differential Revision: D64433991

Pulled By: blakef

fbshipit-source-id: 74c219553a40ff79554ec6a313e23eb82a5534ac
2024-10-17 02:31:08 -07:00
Douglas LowderandFacebook GitHub Bot bb8992c760 fix: Add missing tvOS steps to build-hermes-macos GH action (#47073)
Summary:
After examining Hermes artifacts built after merging of https://github.com/facebook/react-native/issues/46865 , it was apparent that tvOS frameworks were missing from the Hermes universal framework generated by CI.

I went back and discovered additional steps that need to be added to the `build-hermes-macos` action to make CI work correctly.

## Changelog:

[Internal][Fixed] add required steps to build tvOS in build-hermes-macos action

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

Test Plan: After merging, Hermes artifacts generated by CI should contain the missing tvOS bits.

Reviewed By: rshest

Differential Revision: D64528911

Pulled By: cipolleschi

fbshipit-source-id: 61db3e154767830a4726d7ceeec229a4af30d247
2024-10-17 02:22:02 -07:00
Tim YungandFacebook GitHub Bot 01e210fd28 RN: Support Ref Cleanup in useMergeRefs (#47040)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47040

Updates `useMergeRefs` to support cleanup functions.

Changelog:
[General][Changed] - `useMergeRefs` and components using it (e.g. `Pressable`) now support ref cleanup functions.

Reviewed By: lunaleaps

Differential Revision: D64437947

fbshipit-source-id: b715abfa5b4236c1a7685ac023ff1d0384b6a3a4
2024-10-17 01:28:07 -07:00
Alan LeeandFacebook GitHub Bot 1c002c7b4e bump fbjni to 0.7.0 (#47031)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47031

fbjni 0.7.0 has updates to support 16KB page size

- https://github.com/facebookincubator/fbjni/releases/tag/v0.7.0

Changelog:
[Android][Changed] - Bump fbjni to 0.7.0

Reviewed By: cortinico

Differential Revision: D64372127

fbshipit-source-id: eb2be6aec30ea5051d55d38554c0a912ff579109
2024-10-17 00:43:21 -07:00
Sam ZhouandFacebook GitHub Bot 10d8c0df29 Deploy 0.249.0 to xplat (#47077)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47077

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D64512638

fbshipit-source-id: 6c61e13ef0b02f755a150a4d31312375ca487076
2024-10-17 00:09:24 -07:00
Nick GerlemanandFacebook GitHub Bot 6dc64d44f8 Add some unit tests for RCTIsAttributedStringEffectivelySame (#47038)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47038

tsia

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64433780

fbshipit-source-id: d29f23c3d01cbb6157ba33c682cb1d9e20f12a7a
2024-10-16 23:34:08 -07:00
Tim YungandFacebook GitHub Bot fa0358a058 RN: Fix useMergeRefs-test.js (#47076)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47076

The Jest unit tests for `useMergeRefs` were incorrectly implemented, leading to missing expected values. The root cause is that the test helpers were rendering to new roots instead of reusing the same root.

This refactors the test helpers to be simpler and easier to debug, and then fixes the bug described above.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D64498741

fbshipit-source-id: f0dd65f89e0c13721e83a8e38a699bc688812a0e
2024-10-16 16:01:10 -07:00
Thomas NardoneandFacebook GitHub Bot 9406a09f87 Add PixelUtil extensions for Int, Long (#46992)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46992

Changelog: [Android][Added] Added PixelUtil extensions for Int and Long

Reviewed By: Abbondanzo

Differential Revision: D64262473

fbshipit-source-id: 49a666662ca260b878bdfa9a81a79dd6a381c879
2024-10-16 13:55:01 -07:00
Edmond ChuiandFacebook GitHub Bot c35035ed3c Update debugger-frontend from 0ecc39f...a897db8 (#47067)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47067

Changelog: [Internal] - Update `react-native/debugger-frontend` from 0ecc39f...a897db8

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

Reviewed By: hoxyq

Differential Revision: D64475173

fbshipit-source-id: 216c88e13c292c4f857e03e135d761e7042a14c0
2024-10-16 12:21:31 -07:00
Sam ZhouandFacebook GitHub Bot 75dc0f7c73 Eliminate last React$AbstractComponent in react-native (#47069)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47069

Use of this internal type will trigger a `internal-type` error in the next version of Flow. This diff eliminates the last use in react native.

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D64479166

fbshipit-source-id: d440a2fbfe88223462ce61252082a2e7381fb4c9
2024-10-16 11:55:49 -07:00
Nicola CortiandFacebook GitHub Bot c867aba2f3 Move BridgelessDevSupportManager to .devsupport package (#46914)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46914

The `BridgelessDevSupportManager` should have lived inside the `.devsupport` package alongside all the other
devsupport related tooling.

It was instead created inside `.runtime` causing a tight coupling with `ReactHostImpl`.
This made it impossible for Frameworks to customize it (i.e. in Expo GO) also because there was a circular
dependency between ReactHostImpl and BridgelessDevSupportManager

In this diff I'm:
1. Breaking the circular dependency by using `ReactHostDevHelper`
2. Updating all the parameters to reference `ReactHost` rather than `ReactHostImpl`
3. Moving BridgelessDevSupportManager to the `.devsupport` package.

This is breaking for users that are manually composing a `BridgelessDevSupportManager` or
that are extending the `ReactInstanceDevHelper`.

- `ReactInstanceDevHelper` has 3 new method which will have to be implemented.
- `BridgelessDevSupportManager` is now living in a different package.

Changelog:
[Android] [Breaking] - Add 3 methods to ReactInstanceDevHelper

Reviewed By: rshest

Differential Revision: D64105790

fbshipit-source-id: 13478fe1a035adb5b0dc83ebb1daad6cfb243881
2024-10-16 11:25:26 -07:00
Edmond ChuiandFacebook GitHub Bot ad6a2fa612 Fusebox reload-to-profile refactor (#47060)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47060

Changelog: [internal]

Follow up on feedback from D64077813

 oliver_clean

Reviewed By: hoxyq

Differential Revision: D64469842

fbshipit-source-id: e4639defb01683090823eb6774b0c65e9157ef27
2024-10-16 10:31:15 -07:00
Ruslan LesiutinandFacebook GitHub Bot f53cd7238c Encapsulate TracingAgent (#46986)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46986

# Changelog: [Internal]

Encapsulate integration with `FuseboxTracer.cpp` into `TracingAgent.cpp`, which will be responsible for handling `Tracing` domain CDP events.

Closer to the top of the stack, more changes will be added to it.

Reviewed By: huntie

Differential Revision: D64249695

fbshipit-source-id: 4adf5973299275e210e7cdf9c816efab881c9daf
2024-10-16 10:14:52 -07:00
Samuel SuslaandFacebook GitHub Bot 4e12b86bfc delete fetchImagesInViewPreallocation feature flag (#47056)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47056

changelog: [internal]

Reviewed By: Abbondanzo

Differential Revision: D64464758

fbshipit-source-id: 88b8deacac273b693c4bcdd195cbf46441330b0b
2024-10-16 09:08:28 -07:00
poonamjain96andFacebook GitHub Bot 848471b69f Add test case for set opacity in new arch examples (#47043)
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757
Solves:
- ME2E0004

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

[ Internal ] [ Added ] - Add setOpacity test in new-arch-example

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

Test Plan:
```
yarn e2e-test-ios
yarn e2e-test-android
```

Reviewed By: cortinico

Differential Revision: D64457441

Pulled By: cipolleschi

fbshipit-source-id: 310270293f5c7ec8a94c0d38fdd0897e4591ec14
2024-10-16 08:33:37 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 17455e1004 Sort the changelog properly
Summary:
While working on the changelog, I realized that version 0.75.4 ended up in between RCs of 0.76

To avoid to lose the changelog of 0.75.4 once we release 0.76, I moved it to the right place, above 0.75.3's changelog
bypass-github-export-checks
## Changelog:
[Internal] - Sort Changelog properly

Reviewed By: cortinico

Differential Revision: D64470420

fbshipit-source-id: 0602b6cf4d7b9d9b3befb2535de6079d28545a15
2024-10-16 08:18:59 -07:00
antFranconandFacebook GitHub Bot 6aeca53b3e fix(android): Prevent ArrayIndexOutOfBoundsException in permission check (#47047)
Summary:
This PR addresses a potential `ArrayIndexOutOfBoundsException` in the Android module's permission checking logic.

```diff
- results.length > 0 && results[j] == PackageManager.PERMISSION_GRANTED
+ results.length > j && results[j] == PackageManager.PERMISSION_GRANTED
```

It ensures that we only access the results array when the index `j` is within bounds, preventing crashes due to invalid array access that have been occurring in the production environment.

Here is the Crashlytics dashboard concerning this type of crash on my app last week (react-native 0.75.4 - old arch):
![image](https://github.com/user-attachments/assets/0b7c1a10-39f6-4a17-9eee-4b17986f5b85)

## Changelog:

[ANDROID] [FIXED] - Prevent ArrayIndexOutOfBoundsException in permission check

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

Test Plan:
1. Verify normal permission request scenarios still work on Android:
   - Request a permission (e.g., camera, location)
   - Grant the permission
   - Verify the app functions correctly with the granted permission

2. Monitor production crash reports:
   - Deploy the fix to production
   - Observe a decrease in ArrayIndexOutOfBoundsException occurrences in the permission check logic

Note: As this crash was only observed in production, we'll rely on production monitoring to verify the fix's effectiveness over time.

Reviewed By: rshest

Differential Revision: D64464171

Pulled By: cortinico

fbshipit-source-id: 87beacf7ee749a51665577d05a56cc8d6889d70f
2024-10-16 07:30:30 -07:00
David VaccaandFacebook GitHub Bot 6b67772204 Enable 'useFabricInterop' by default in new architecture (#47017)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47017

Enable 'useFabricInterop' by default in RNOSS

changelog: [Android][Changed] Enable fabric interop by default in new architecture for Android

Reviewed By: cortinico, rshest

Differential Revision: D64340659

fbshipit-source-id: b94421aaf482675dbe8838a97d9968494e4fa75f
2024-10-16 04:37:14 -07:00
Douglas LowderandFacebook GitHub Bot f673759c83 feat: Add tvOS support to Hermes artifacts (#46865)
Summary:
Adds tvOS to the list of Apple platforms supported by the Hermes artifacts. After this, the React Native TV builds will be able to use the same Hermes artifacts as those used by RN core.

~Added some code in `hermes-utils.rb` so that the Hermes podspec can use a local Maven repo (`/tmp/maven-local`).~

> *Note:* ~This PR should not be merged until the corresponding Hermes PR https://github.com/facebook/hermes/pull/1529 is merged.~ (https://github.com/facebook/hermes/pull/1529 has been merged)

## Changelog:

[iOS][Added] tvOS support for Hermes artifacts

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

Test Plan: - tvOS is also added to the build and test GitHub workflows.

Reviewed By: rshest

Differential Revision: D64461324

Pulled By: cipolleschi

fbshipit-source-id: d63889c60c72519818e7076cd0ab5851791715a1
2024-10-16 03:39:58 -07:00
Edmond ChuiandFacebook GitHub Bot 4df224ca6d Fusebox reload-to-profile (Part 2 of 2: JS) (#46905)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46905

Changelog: [General][Added] - Add support for reload-to-profile in Fusebox (Part 2 of 2: JS)

Reviewed By: hoxyq

Differential Revision: D64077813

fbshipit-source-id: a6d3326d8514f49e47074d21d37e00044ad62fd8
2024-10-16 01:27:28 -07:00
Shawn DempseyandFacebook GitHub Bot 85f1d9a518 Back out "Unify feature flags for event loop" (#47041)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47041

Original commit changeset: b879447def8a

Original Phabricator Diff: D64175216

Reviewed By: fkgozali

Differential Revision: D64439014

fbshipit-source-id: efc1bb7baa547d270322aabf6c5a4f50ace23e1b
2024-10-15 21:53:42 -07:00
Nick GerlemanandFacebook GitHub Bot 557e3447f5 Include existing attributes in newly typed text (#47018)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47018

This change makes it so that newly typed text in a TextInput will include the existing attributes present based on cursor position. E.g. if you type after an inner fragment with blue text, the next character will be blue (or, an event emitter specific to an inner fragment will also be expanded). This is a behavior change for the (admittedly rare) case of uncontrolled TextInput with initially present children AttributedText, but more often effect controlled components, before state update (we are after, less likely to need to reset AttributedString because of mismatch).

Originally included this in D64121570, but it's not needed to fix the common case since we include paragraph-level event emitter as part of default attributes, and has some of its own risk, so I decided it is better separate.

Changelog:
[iOS][Changed] - Include existing attributes in newly typed text

Reviewed By: cipolleschi

Differential Revision: D64352310

fbshipit-source-id: 90ef8c49f50186eadf777e81cf6af57e1aada207
2024-10-15 16:24:53 -07:00
Nick GerlemanandFacebook GitHub Bot 36fd5533f6 Fix cursor moving while typing quickly and autocorrection triggered in controlled single line TextInput on iOS (New Arch) (#46970)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46970

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

This one is a bit of a doozy...

During auto-correct in UITextField (used for single line TextInput) iOS will mutate the buffer in two parts, non-atomically. After the first part, after iOS triggers `textFieldDidChange`, selection is in the wrong position. If we set full new AttributedText at this point, we propagate the incorrect cursor position, and it is never restored.

In the common case, where we are not mutating text in the controlled component, we shouldn't need to be setting AttributedString in the first place, and we do have an equality comparison there currently. But it is defeated because attributes are not identical. There are a few sources of that:
1. NSParagraphStyle is present in backing input, but not the AttributedString we are setting.
2. Backing text has an NSShadow with no color (does not render) not in the AttributedText
3. Event emitter attributes change on each update, and new text does not inherit the attributes.

The first two are part of the backing input `typingAttributes`, even if we set a dictionary without them. To solve for them, we make attribute comparison insensitive to the attribute values in a default initialized control. There is code around here fully falling back to attribute insensitive comparison, which we would ideally fix to instead role into this "effective" attribute comparison.

The event emitter attributes being misaligned is a real problem. We fix in a couple ways.
1. We treat the attribute values as equal if the backing event emitter is the same
2. We set paragraph level event emitter as a default attribute so the first typed character receives it

After these fixes, scenario in https://github.com/facebook/react-native-website/pull/4247 no longer repros in new arch. Typing in debug build also subjectively seems faster? (we are not doing second invalidation of the control on every keypress).

Changes which do mutate content may be susceptible to the same style of issue, though on web/`react-dom` in Chrome, this seems to not try to preserve selection at all if the selection is uncontrolled, so this seems like less of an issue.

I haven't yet looked at old arch, but my guess is we have similar issues there, and could be fixed in similar ways (though, we've been trying to avoid changing it as much as possible, and 0.76+ has new arch as default, so not sure if worth fixing in old impl as well if this is very long running issue).

Changelog:
[iOS][Fixed] - Fix cursor moving in iOS controlled single line TextInput on Autocorrection (New Arch)

Reviewed By: javache, philIip

Differential Revision: D64121570

fbshipit-source-id: 2b3bd8a3002c33b68af60ffabeffe01e25c7ccfe
2024-10-15 16:24:53 -07:00
Ruslan LesiutinandFacebook GitHub Bot d287c72804 Update debugger-frontend from 6f29504...0ecc39f (#47036)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47036

Changelog: [Internal] - Update `react-native/debugger-frontend` from 6f29504...0ecc39f

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

Reviewed By: EdmondChuiHW

Differential Revision: D64405153

fbshipit-source-id: 1fe491aa878d203bee207f5c4163aac98f4524c2
2024-10-15 13:15:07 -07:00
Ruslan LesiutinandFacebook GitHub Bot c1a7b4a8e9 upgrade[react-devtools-*]: ^6.0.1 (#47034)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47034

allow-large-files

# Changelog: [Internal]

Upgrades React DevTools npm packages to 6.0.1 for whole xplat.

Reviewed By: EdmondChuiHW

Differential Revision: D64403912

fbshipit-source-id: 39310fcb300a2a2e48d38faacef97ef65c49bbe8
2024-10-15 13:15:07 -07:00
Joe VilchesandFacebook GitHub Bot dd1aea5ccf fix(iOS): Replace uses of CGColorRef with UIColor to avoid manual memory management v2 (#47019)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47019

NOTE: This code is largely the same as https://github.com/facebook/react-native/pull/46847, I am merely fixing some internal issues

The original diff (D63989547) was backed out because it was causing some crashes related to some internal code that had to be changed. That code did not necessarily need to be changed - we could have just left the `RCTCreateCGColorRefFromSharedColor` function and not touched the internal code - which is what I am going to do here

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D64201626

fbshipit-source-id: a8ead7a542514aee0749973e284cb7727d393c03
2024-10-15 12:59:58 -07:00
evanbaconandFacebook GitHub Bot 043e2fe14a prevent fatal crashes when launching App Clips (#47000)
Summary:
App Clips are full of bugs. One such bug is how launching an App Clip from Test Flight (and perhaps other systems) will cause the user activity to be of type `NSUserActivityTypeBrowsingWeb` but with a nullish `userActivity.webpageURL` (even though it's typed as never being nullish in this mode).

## Changelog:

[IOS] [FIXED] - Fix launching App Clips with nullish URLs.

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

Test Plan:
The following was failing cryptically and required extensive debugging to get launching.

https://github.com/user-attachments/assets/ffd26297-b20b-45a2-97cc-35a48b740cb2

Reviewed By: cipolleschi

Differential Revision: D64372170

Pulled By: lunaleaps

fbshipit-source-id: 388f05530f3bccdd9b446382931f127421bc8a27
2024-10-15 11:50:12 -07:00
Rubén NorteandFacebook GitHub Bot f9460deda7 Clean up feature flag removeNestedCallsToDispatchMountItemsOnAndroid (#47026)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47026

Changelog: [internal]

Clean up feature flag after we tested it's safe.

Reviewed By: javache

Differential Revision: D64332654

fbshipit-source-id: 33e92abb24c9350628a814ecab195f995316d2bc
2024-10-15 10:59:03 -07:00
tarunrajputandFacebook GitHub Bot 3f633473c3 Add maestro e2e test for Legacy Style Event (#46784)
Summary:
part of https://github.com/facebook/react-native/issues/46757
closes ME2E0006, ME2E0007

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

[Internal] - add e2e test for Legacy Style Event

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

Test Plan:
```
yarn e2e-test-ios
yarn e2e-test-android
```

Reviewed By: cortinico

Differential Revision: D64172277

Pulled By: cipolleschi

fbshipit-source-id: adf3a55b354f1a293c4620dc617a6a08e3aebd2b
2024-10-15 10:57:32 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 118c1f7035 Add support for new iOS text content type cellular EID and cellular IMEI (#46507)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46507

Support for new iOS text content type to autofill cellular EID or cellular IMEI:
- https://developer.apple.com/documentation/uikit/uitextcontenttypecellulareid?language=objc
- https://developer.apple.com/documentation/uikit/uitextcontenttypecellularimei?language=objc

## Changelog:

[General][Added] - Add JS layer for new text content type cellular EID and cellular IMEI

Reviewed By: cortinico

Differential Revision: D62737200

fbshipit-source-id: 4db9c29079e63107deeb00a3a1558aa151d80fc1
2024-10-15 10:55:03 -07:00
Rubén NorteandFacebook GitHub Bot 9e5b6e88c5 Unify feature flags for event loop (#46953)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46953

Changelog: [internal]

This unifies all the feature flags that control the new event loop on RN. Before, we'd have granular flags for different aspects of it. With this diff, we enable the event loop by default with bridgeless, and we introduce a new flag to explicitly disable it in that case if necessary.

When we're ready to clean up this opt-out, we just need to remove the `&& !ReactNativeFeatureFlags::disableEventLoopOnBridgeless()` conditions.

Reviewed By: javache

Differential Revision: D64175216

fbshipit-source-id: b879447def8ab47c6ab772812ff1031177494069
2024-10-15 09:44:01 -07:00
Rubén NorteandFacebook GitHub Bot 3ebf4f3b0e Force bridgeless feature flags in RCTAppDelegate when bridgeless is enabled (#46972)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46972

Changelog: [internal]

I'm unifying the feature flags for the new event loop (so it's enabled by default when bridgeless is enabled, unless a feature flag is explicitly set), and I realized that the feature flags for Bridgeless, Fabric and Turbo Modules aren't being set in iOS, causing my changes to be incorrect (as we're using bridgeless but the bridgeless flag is off).

This forces the right flags when using bridgeless so the configuration is consistent.

Reviewed By: rshest, cipolleschi

Differential Revision: D64234056

fbshipit-source-id: bfdbe6742ee84c23d6d2c0c56e6ca8fce1788b26
2024-10-15 09:44:01 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 7b6e8e7765 Codegen fails with Local Module (#47027)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47027

While I was writing the documentation for extracting a module in a library, I realized that Codegen ignored the local node modules.

The reason is that `require.resolve` fails to resolve a local path.

bypass-github-export-checks

## Changelog
[General][Fixed] - Make Codegen work with local modules

Reviewed By: cortinico

Differential Revision: D64242713

fbshipit-source-id: cc5167665a49df1d09eb66a0dc9d76466f087a25
2024-10-15 09:30:50 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 40bcf0edba Do not kill emulators when testing (#47030)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47030

Looking at the videos from the E2E tests, it seems that the tests are pretty reliable aside from the first one that often fail. And it looks like it is failing not because the test is wrong, but because maestro hits some sort of timeout and kills the test sooner.

With these changes we are:
- giving more time to maestro to run
- not killing the emulator anymore

Killing and restarting the simulator was making this problem workse, because a newly started simulator required more time to boots and to work properly

## Changelog:
[Internal] - stop killing simulators and increase timeouts

Reviewed By: cortinico

Differential Revision: D64398111

fbshipit-source-id: 17b107fee24d0fbd4897212c1907be3761e337ab
2024-10-15 08:32:37 -07:00
poonamjain96andFacebook GitHub Bot 8cf27e8b6f Add test for Console.log measure in new-arch-examples (#47020)
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757
Solves:
- ME2E0005

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

[ Internal ] [ Added ] - Add console.log measure test in new-arch-example

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

Test Plan:
```
yarn e2e-test-ios
yarn e2e-test-android
```

Reviewed By: cortinico

Differential Revision: D64397112

Pulled By: cipolleschi

fbshipit-source-id: c9192d66065038528751e2e366f58158b06eb864
2024-10-15 08:29:47 -07:00
zhongwuzwandFacebook GitHub Bot c1178ac208 Fixes scrollIndicatorInsets not work in old arch (#46944)
Summary:
Fixes https://github.com/facebook/react-native/issues/46918 . break change comes from https://github.com/facebook/react-native/pull/44820 and https://github.com/facebook/react-native/pull/44789 .

## Changelog:

[IOS] [FIXED] - Fixes scrollIndicatorInsets not work in old arch

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

Test Plan: scrollIndicatorInsets should work in old arch.

Reviewed By: philIip

Differential Revision: D64173490

Pulled By: cipolleschi

fbshipit-source-id: f7186439146d1b811c02e584fd1d94fcbb5d88a2
2024-10-15 08:11:59 -07:00
Qichen ZhuandFacebook GitHub Bot 08bd8ac47d Fix KeyboardAvoidingView not aware of the keyboard closing after it is unmounted (#46952)
Summary:
In the new architecture, if you open the soft keyboard, unmount `KeyboardAvoidingView`, close the keyboard, and then remount `KeyboardAvoidingView`, it still assumes the keyboard is open and displays the keyboard avoiding area.

We need to check if the keyboard is still open after remounting.

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

## Changelog:

[GENERAL] [FIXED] - Fix KeyboardAvoidingView not aware of the keyboard closing it is unmounted

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

Test Plan:
Code to reproduce in RNTester:

```JSX
import type {RNTesterModuleExample} from '../../types/RNTesterTypes';
import {Button, KeyboardAvoidingView, Text, TextInput, View} from 'react-native';
import {Fragment, Suspense, useState} from "react";

const infiniteThenable = { then() {} };

function Suspender({ freeze, children }) {
  if (freeze) {
    throw infiniteThenable;
  }
  return <Fragment>{children}</Fragment>;
}

function Freeze({ freeze, children }) {
  return (
    <Suspense>
      <Suspender freeze={freeze}>{children}</Suspender>
    </Suspense>
  );
}

function Playground() {
  const [isFrozen, setIsFrozen] = useState(false);

  return (
    <>
      <TextInput style={{ height: 100 }} />
      <Button title="Freeze" onPress={() => setIsFrozen(true)} />
      <Button title="Unfreeze" onPress={() => setIsFrozen(false)} />

      <Freeze freeze={isFrozen}>
        <KeyboardAvoidingView behavior="padding" style={{ flex: 1 }}>
          <View style={{ backgroundColor: '#909090', flex: 1, alignItems: 'center', justifyContent: 'flex-end' }}>
            <Text>Test</Text>
            <Text></Text>
          </View>
        </KeyboardAvoidingView>
      </Freeze>
    </>
  );
}

export default ({
  title: 'Playground',
  name: 'playground',
  render: (): React.Node => <Playground />,
}: RNTesterModuleExample);
```

### Steps

1. Tap the text input to show the soft keyboard.
2. Tap Freeze.
3. Tap the Enter or Done button on the soft keyboard to hide it.
4. Tap Unfreeze.
5. Verify that there is no blank area at the bottom of the screen.

### Videos

#### iOS

Before | After
-- | --
<video src="https://github.com/user-attachments/assets/0c8d840e-14a6-47ad-a163-d34ac9cfbf40" /> | <video src="https://github.com/user-attachments/assets/1d88a70c-e029-433d-920d-da7582edb3f2" />

#### Android

Before | After
-- | --
<video src="https://github.com/user-attachments/assets/f29f6526-c5a4-4b6a-b3aa-7c4c7ff3ed30" /> | <video src="https://github.com/user-attachments/assets/c4e92356-694b-4fca-8897-7dfca8495db0" />

Reviewed By: andrewdacenko

Differential Revision: D64178982

Pulled By: cipolleschi

fbshipit-source-id: 8d71654aac599cec4e1928b14d87cff34f28174a
2024-10-15 08:03:13 -07:00
Edmond ChuiandFacebook GitHub Bot 2c9176ac0f Update debugger-frontend from 87b2feb...6f29504 (#47029)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47029

Changelog: [Internal] - Update `react-native/debugger-frontend` from 87b2feb...6f29504

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

Reviewed By: vzaidman

Differential Revision: D64393541

fbshipit-source-id: 4c87b37a192efa68a579b94bb4219099d4400714
2024-10-15 07:24:41 -07:00
Nicola CortiandFacebook GitHub Bot 11392c74d7 AGP to 8.7.1 (#47022)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47022

That's just a patch bump for AGP from 8.7.0 to 8.7.1

Changelog:
[Internal] [Changed] - AGP to 8.7.1

Reviewed By: cipolleschi

Differential Revision: D64390797

fbshipit-source-id: b48218b5737b8e7379ab4f13dfa57a97c3e30cbd
2024-10-15 06:08:09 -07:00
Nicola CortiandFacebook GitHub Bot 091025e18b Fresco to 3.4.0 (#47024)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47024

This bumps Fresco from 3.3.0 to 3.4.0
Most notable change is NDK 27 support + 16K Page support.

Changelog:
[Android] [Changed] - Fresco to 3.4.0

Reviewed By: cipolleschi

Differential Revision: D64391402

fbshipit-source-id: 4dc9b2a045d0901bd6ee41cdbd4f1db2e22eb576
2024-10-15 06:01:27 -07:00
Nicola CortiandFacebook GitHub Bot 44c5cc36ad Silence CMake warning caused by PROJECT_ROOT_DIR (#47015)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47015

CMake is complaining that this variable is set outside the build but not used.
I'm using it inside our top level .cmake file to silence this warning.
We need this variable as user projects might use it.

Changelog:
[Internal] [Changed] - Silence CMake warning caused by `PROJECT_ROOT_DIR`

Reviewed By: javache

Differential Revision: D64334462

fbshipit-source-id: 558bfc9f647e62890e3cc25628b5544880c47e4b
2024-10-15 04:27:04 -07:00
YunPeng ChongandFacebook GitHub Bot 3485e9ed87 Fix onEndReached not being called when getItemLayout is present and we scroll past render window (#46990)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46990

This is a reattempt land D63643856 to fix the scroll onendreached event not firing.

Changelog:
[General][Fixed] - Fix onEndReached not being called when getItemLayout is present and we scroll past render window

Reviewed By: NickGerleman

Differential Revision: D64222424

fbshipit-source-id: 7e22f377d2f754beb39fff2b5c097cea350daa7e
2024-10-14 15:09:25 -07:00
Rob HoganandFacebook GitHub Bot 0902b0af75 Update Metro to 0.81.0 (#47012)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47012

Update Metro from `0.81.0-alpha.2` to `0.81.0`.

This is also intended to be the final, stable release for RN 0.76.

Changelog:
[General][Changed]: Update Metro to 0.81.0

Reviewed By: blakef

Differential Revision: D64329574

fbshipit-source-id: e12bed356b46e4ed68c75b397b7f9e2228c377be
2024-10-14 10:08:36 -07:00
Peter AbbondanzoandFacebook GitHub Bot 6e120b3b46 Add e2e test for Image resize method (#46982)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46982

E2E test setup for each of the `resizeMethod` methods for Image on Android

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D64136839

fbshipit-source-id: 876939a50243836030401c6456410f119abe01b5
2024-10-14 08:54:28 -07:00
Vitali ZaidmanandFacebook GitHub Bot e08c7eb22a fix how @babel/register is used and update it (#46987)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46987

X-link: https://github.com/facebook/metro/pull/1371

Update `babel/register` to latest version, fixing the bug that were preventing us from updating it previously.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D64245277

fbshipit-source-id: f3d07b06a11fbe3a0ed28e22f5b687541782dda9
2024-10-14 06:30:59 -07:00
Gabriel DonadelandFacebook GitHub Bot 4dd47eeb9e Make PackagerConnectionSettings class open again (#47005)
Summary:
When migrating `PackagerConnectionSettings` from Java to Kotlin in https://github.com/facebook/react-native/pull/45800 the new class ended up being declared as final, causing a breaking change in 0.76.

We should add the `open` directive to `PackagerConnectionSettings.kt` to restore the old behavior. That would be crucial for the `expo-dev-client` package, given that Expo needs to be able to extend this class in order to overwrite the `debugServerHost` value.

## Changelog:

[ANDROID] [FIXED] - Make PackagerConnectionSettings class open again

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

Test Plan: Run RNTester on Android

Reviewed By: huntie

Differential Revision: D64323645

Pulled By: cortinico

fbshipit-source-id: 6870a3dee929ba664e4c402f321f84af7704f892
2024-10-14 04:43:52 -07:00
Fabrizio CucciandFacebook GitHub Bot 6c19996e10 Account for diffrent frame size when using maintainVisibleContentPosition in virtualized lists (#46979)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46979

It seems that, when the items in a virtualized list don't have a fixed size (i.e. they dynamically scale with the size of the container), we need to also take into account their size when updating the scroll position as a consequense of setting `maintainVisibleContentPosition`.

Changelog:
[Android][Fixed] - Account for items dynamically scaling with the container when using `maintainVisibleContentPosition` in virtualized lists

Reviewed By: javache, NickGerleman

Differential Revision: D64238887

fbshipit-source-id: 9f05a461d178bc191137b1a350072337ba62e224
2024-10-14 04:28:31 -07:00
Rubén NorteandFacebook GitHub Bot b5271779ec Fix race condition when reporting mounting transactions for deallocated surfaces (#47008)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47008

Changelog: [internal]

This code is gated anyway so there's no harm in production.

Reviewed By: javache

Differential Revision: D64322331

fbshipit-source-id: 005eb385f7e5ccd3d33e2d8c28e45b84f1537d68
2024-10-14 04:16:04 -07:00
Sam ZhouandFacebook GitHub Bot 60bc3c5aed Deploy 0.248.1 to xplat (#47004)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47004

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D64280903

fbshipit-source-id: f3f7a7bfdab30574fa911ba940032255932cd508
2024-10-13 12:58:21 -07:00
Samuel SuslaandFacebook GitHub Bot b7fec235de small refactor of EventBeat (#47001)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47001

changelog: [internal]

EventBeat::beat is only used on Windows, let's move it there.

EventBeat::induce is only called by subclasses, doesn't need to be public.

Reviewed By: christophpurrer

Differential Revision: D64287646

fbshipit-source-id: 48edceddd273b45e8a4e63f4c1d5fda6c5adf425
2024-10-13 03:27:40 -07:00
Jeff BahrandFacebook GitHub Bot 9ba6237bff Update google-java-format to 1.23.0 (#46860)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46860

Pulling library into our repository

Result of:
  arc artificer download com.google.googlejavaformat:google-java-format:1.23.0 --interactive

Deps
```
➜  arc artificer rquery dependencies --cross-reference com.google.googlejavaformat:google-java-format:1.23.0
com.google.googlejavaformat:google-java-format:1.23.0 
└╼ com.google.guava:guava:32.1.3-jre:compile 

```

Formatted with

```
tools/arcanist/lint/codemods/googlejavaformat_fbsource
```

Reviewed By: hick209

Differential Revision: D60787993

fbshipit-source-id: dbadc5184c0a7cccd967173e21602657013ddac7
2024-10-12 08:51:46 -07:00
Samuel SuslaandFacebook GitHub Bot 3130f0d646 add timestamp to onScroll on iOS (#46978)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46978

changelog: [internal]

Add timestamp to onScroll event on Android.

Reviewed By: fabriziocucci

Differential Revision: D64068207

fbshipit-source-id: 3d4c31bbf43ef5f06af4933867380d3ef297b550
2024-10-12 04:55:12 -07:00
Samuel SuslaandFacebook GitHub Bot f4855d7d37 add timestamp to onScroll on Android (#46977)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46977

changelog: [internal]

Add timestamp to onScroll event on Android.

Reviewed By: fabriziocucci

Differential Revision: D64235402

fbshipit-source-id: 606446f2a711dcb4edd94a2a54ec50c54f622904
2024-10-12 04:55:12 -07:00
David VaccaandFacebook GitHub Bot 34431272c3 Move execution of ReactNativeFeatureFlags::enableDeletionOfUnmountedViews() out of destructor (#46993)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46993

Calling ReactNativeFeatureFlags::enableDeletionOfUnmountedViews() from the destructor increases the chance of accessing ReactNativeFeatureFlags during the tear down of React Native.

We are moving this call into the contructor of the object which always happen on the js thread

changelog: [internal] internal

Reviewed By: rubennorte

Differential Revision: D64190029

fbshipit-source-id: 377b85e8ff0704db0f6603662f595b75a6705693
2024-10-12 00:39:21 -07:00
David VaccaandFacebook GitHub Bot 621622a5b1 Refactor Systrace.traceSection() to unblock CI (#46994)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46994

This diff makes a small refactor on Systrace.traceSection() to unblock CI, which was broken by D64141515

changelog: [internal] internal

Reviewed By: Abbondanzo

Differential Revision: D64276651

fbshipit-source-id: e35950f88cde3d547992bb700208a4d4d309710f
2024-10-12 00:39:21 -07:00
Benoit GirardandFacebook GitHub Bot 401991c3f0 Better instrument the startup timeline.
Summary:
Using a new JVM profiler (D64128815) to find blind spot in the early startup init markers and adding them.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D64141515

fbshipit-source-id: d2968ed5dafdd891b8cc5a6115479c0678bfdc80
2024-10-11 12:50:28 -07:00
Blake FriedmanandFacebook GitHub Bot 54c29a7acf Add changelog for 0.76.0-rc.4 (#46907)
Summary:
Changelog:
[Internal] - add changelog

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

Reviewed By: rshest

Differential Revision: D64081074

Pulled By: blakef

fbshipit-source-id: 8da22806036632cd266dcc83d023235231cce20b
2024-10-11 11:32:07 -07:00
Blake FriedmanandFacebook GitHub Bot a7023414fd add yargs#usage typing (#46983)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46983

X-link: https://github.com/facebook/metro/pull/1370

Add support for `.usage` overload: https://github.com/yargs/yargs/blob/main/docs/api.md#usagemessagecommand-desc-builder-handler

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D64241927

fbshipit-source-id: 9928f08bad16a5e1a6bcfa7c2cf2bfa73668ff57
2024-10-11 11:27:09 -07:00
Rubén NorteandFacebook GitHub Bot c86b5c1232 Add new dangerouslyForceOverride method to feature flags (#46963)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46963

Changelog: [internal]

This introduces a new method in `ReactNativeFeatureFlags` to force setting overrides without triggering any errors (they're returned a string instead to be handled in userland). This is partially equivalent to calling `dangerouslyReset` and `override` but completely avoids the hard crashes that could be caused by race conditions.

Reviewed By: javache, rshest

Differential Revision: D64186262

fbshipit-source-id: 854caa03810ec78217999292a4335dad373b7fcb
2024-10-11 10:05:25 -07:00
Sam ZhouandFacebook GitHub Bot 105aa129d8 Deploy 0.248.0 to fbsource
Summary: Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D64225120

fbshipit-source-id: ce00574ea5d367737191ac430017332799906ebe
2024-10-11 09:59:44 -07:00
Thomas NardoneandFacebook GitHub Bot fc199bb5f3 Convert ReactViewManager to Kotlin (#46965)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46965

Converting this class as close to 1:1 as possible.

Changelog: [Internal]

Reviewed By: NickGerleman, rshest

Differential Revision: D64124890

fbshipit-source-id: 2034ed8ecb877bb267a953b183b77daaf883a80a
2024-10-11 09:14:55 -07:00
Peter AbbondanzoandFacebook GitHub Bot 483b928224 Swallow exceptions on draw, forward to onError (#46964)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46964

Graceful degradation is better than outright crashing. When rendering images that exceed Android's memory limits, React Native applications will fatally crash. This change intervenes by swallowing the exception that Android raises and forwards it to the `onError` handler. As a result, no image will be rendered instead of fatally crashing.

Fresco already intervenes by default. It will raise a `PoolSizeViolationException` if the bitmap size exceeds memory limits set by the OS and applies a 2048 pixel maximum dimension to JPEG images, but it's still possible for these configuration limits to be removed and for images to fall just short of Fresco's memory limit. The exception is raised when we attempt to draw the bitmap, not when the bitmap is allocated in memory, so we must handle the exception here and not in Fresco.

## Changelog

[Android][Fixed] - Apps will no longer fatally crash when trying to draw large images

Reviewed By: tdn120

Differential Revision: D64144596

fbshipit-source-id: 32b69ad4ecef0564c2cad7a287a31b56688f38b8
2024-10-11 09:10:30 -07:00
Blake FriedmanandFacebook GitHub Bot 44fe0643ff Add changelog for 0.76.0-rc.3 (#46752)
Summary:
Add changelog for 0.76.0-rc.3

Changelog:
[Internal] - add changelog

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

Reviewed By: cortinico, cipolleschi

Differential Revision: D63693195

Pulled By: blakef

fbshipit-source-id: a1a0ef6b24c3caab11527f8c89ce9d642be125a8
2024-10-11 08:56:45 -07:00
Samuel SuslaandFacebook GitHub Bot ca6dc67570 fix stale contentSize in ScrollView (#46981)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46981

changelog: [internal]

stateUpdate with closure syntax has to be used in order to not override contentSize stored inside of C++ state.

Reviewed By: jessebwr

Differential Revision: D64242221

fbshipit-source-id: 32d55ccc03e32922f2746293ccb6c0941ca67d92
2024-10-11 08:44:29 -07:00
Nick LefeverandFacebook GitHub Bot aacd4bba29 Disable shadow node reference updates by default (#46961)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46961

Changelog: [Internal]
Runtime Shadow Node Reference Syncing causes asserts when updating the shadow tree without passing through the JS-thread. This diff disables the feature by default to avoid the asserts encountered on RN Windows.

Reviewed By: sammy-SC

Differential Revision: D64188839

fbshipit-source-id: eb65206662d842f8150f1771c86dc8d190cbc3aa
2024-10-11 08:35:34 -07:00
Fabrizio CucciandFacebook GitHub Bot c09f824962 Replace React.AbstractComponent with component type in ActivityIndicator (#46951)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46951

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D64175898

fbshipit-source-id: 4db76dda0c4ac604c38dc3acf5bc39448cad006e
2024-10-11 06:53:43 -07:00
Fabrizio CucciandFacebook GitHub Bot bcb6dafedc Replace React.AbstractComponent with component type in Pressable (#46950)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46950

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D64175859

fbshipit-source-id: 56c3fe658a372b5148952850166781b733bbb37a
2024-10-11 06:53:43 -07:00
Riccardo CipolleschiandFacebook GitHub Bot ce5358866f Disable e2e on PR (#46974)
Summary:
Commit https://github.com/facebook/react-native/commit/d4edbcffbf9e797d33bf06a8873c73874ec51bdc mistakingly enable iOS e2e on PRs
This change disable them again

## Changelog:
[Internal] - disable e2e in PRs

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

Test Plan: GHA

Reviewed By: cortinico

Differential Revision: D64239005

Pulled By: cipolleschi

fbshipit-source-id: 5b3655d1f8ebb07fd552f656fee0e8e3f255301a
2024-10-11 06:40:40 -07:00
Nicola CortiandFacebook GitHub Bot 972c2c864c Bump Kotlin 1.9.x to 2.0.x (#46955)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46955

This is a major bump of Kotlin. It comes with no breaking changes for the Kotlin API, but there are several new warnigns that I had to fix.
Most importantly several `override` methods that are overriding Deprecated API, also need to be deprecated as well in Kotlin.

Changelog:
[Android] [Changed] - Bump Kotlin 1.9.x to 2.0.x

Reviewed By: tdn120

Differential Revision: D64179842

fbshipit-source-id: 295ab2636ce9f9bb04e9d8c7ed27d9f8a1a64338
2024-10-11 05:34:02 -07:00
Riccardo CipolleschiandFacebook GitHub Bot d4edbcffbf Move E2E tests to larger machines to see if flakyness decreases (#46960)
Summary:
This change move E2E tests to larger mac machines to see if we can reduce the flakyness.
Most of the time the flakyness is due to slowness in connecting to the simulator or slowness in Metro to provide the bundle to RNTester when we run the tests in Debug.
More power should speed-up those processes.

E2E tests took < 30 min in this diff
on Main, they took > 120 min

## Changelog:
[Internal] - Move the E2E tests to bigger machines

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

Test Plan: GHA

Reviewed By: blakef

Differential Revision: D64237659

Pulled By: cipolleschi

fbshipit-source-id: c2458413c8de70c07fae8f2b5f202371c6293815
2024-10-11 05:10:10 -07:00
Nicola CortiandFacebook GitHub Bot 2c4567562c RNGP - Pass PROJECT_ROOT_DIR to CMake (#46958)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46958

This will make it easier to link against custom C++ TM which will most likely live inside ./shared or
some other paths outside of ./android.

CMake will have access to `PROJECT_ROOT_DIR` which points to ./android (the folder where the settings.gradle file exists).

Changelog:
[Internal] [Changed] - RNGP - Pass PROJECT_ROOT_DIR to CMake

Reviewed By: cipolleschi

Differential Revision: D64183641

fbshipit-source-id: 347256c04f10e92cf5a13e9c70db16aa29bcb741
2024-10-11 03:34:54 -07:00
Nick GerlemanandFacebook GitHub Bot b69a92e2c9 Add boxShadow support to BaseViewManager (#46936)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46936

Let's enable box-shadow everywhere! This should be safe, now that we assume any background mutating methods in BaseViewManager go through BackgroundStyleApplicator. `boxShadow` is also already in `BaseViewConfig` instead of configs for each native component (bc we were already planning to make this change).

Changelog:
[Android][Added] - Add boxShadow support to BaseViewManager

Reviewed By: mdvacca

Differential Revision: D64140841

fbshipit-source-id: e937a4bcaa4506fd25d0916633313083c7e49333
2024-10-10 18:02:50 -07:00
Nick GerlemanandFacebook GitHub Bot 6741fd94ad Add missing BaseViewManager props to BaseViewManagerDelegate (#46934)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46934

BaseViewManagerDelegate is a handcrafted second source of truth, used specifically for codegen.

The organization here has some problems, but this diff adds the props currently missing from it, so that these work correctly in generated view managers.

Changelog:
[Android][Fixed] - Add missing BaseViewManager props to BaseViewManagerDelegate

Reviewed By: mdvacca

Differential Revision: D64137615

fbshipit-source-id: 4ff85f2524e5472f3b768e212fd5f2d4d9a36e17
2024-10-10 18:02:50 -07:00
Ramanpreet NaraandFacebook GitHub Bot 9119c32785 earlyjs: Implement decoratedExtraDataKey (#46932)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46932

In the old error handling pipeline, when the app [assigns an object to error[ExceptionsManager.decoratedExtraDataKey]](https://fburl.com/code/9t9u8rgv)

```
        const error = new Error('Some error happened');
        // Annotates the error with some custom extra data.
        error[ExceptionsManager.decoratedExtraDataKey] = {foo: 'bar'};
        ExceptionsManager.handleException(error, true);
```

That object [gets forwarded as extraData](https://fburl.com/code/gy7v173u) to ExceptionsManager.

This diff implements that functionality within the c++ earlyjs pipeline.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63927091

fbshipit-source-id: ac88bf3e545714aa42531e8e1365e2eba32a7c2b
2024-10-10 16:03:02 -07:00
Ramanpreet NaraandFacebook GitHub Bot 9619ba5ce6 Integrate logbox into earlyjs c++ pipeline (#46935)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46935

Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript.

## The API

```
if (global.RN$registerExceptionListener != null) {
  global.RN$registerExceptionListener(
    (error: ExtendedExceptionData & {preventDefault: () => mixed}) => {
      error.preventDefault();

      // show logbox
    },
  );
}
```

## The Future API
We want something more aligned with the HTML spec:

```
addEventListener('error', (event) => {
   event.preventDefault();
   // show logbox
});
```

## Fatals vs soft errors
The earlyjs pipeline covers just main bundle execution for now.

So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63769385

fbshipit-source-id: 9c01e1cfe0ec80842af2e5bcfbf0adfb040dbcf3
2024-10-10 16:03:02 -07:00
Ramanpreet NaraandFacebook GitHub Bot 509abff063 Extend earlyjs c++ pipeline for soft errors (#46893)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46893

Before, the c++ pipeline only supported fatal errors.

Now, it supports soft errors!

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63927090

fbshipit-source-id: ddaad0ea9b4aa1f889b24ca388cd6b9b1c83adba
2024-10-10 16:03:02 -07:00
Ramanpreet NaraandFacebook GitHub Bot 934af0c59e Align earlyjs c++ stack trace parsing with js (#46894)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46894

This diff re-implements [js error stack trace parsing](https://github.com/facebook/react-native/blob/86cac6836502aaeb5c894bff6427e837c52c09e0/packages/react-native/Libraries/Core/Devtools/parseErrorStack.js#L41-L57) in c++.

Details:
- I migrated [stacktrace-parser](https://github.com/errwischt/stacktrace-parser/blob/ad379de5e5ac056012bbeb12923cf502aefe4710/src/stack-trace-parser.js#L7)
- I migrated [parseHermesStack.js](https://github.com/facebook/react-native/blob/86cac6836502aaeb5c894bff6427e837c52c09e0/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js#L82)

I also migrated all their tests to c++:
- [stacktrace-parser tests](https://github.com/errwischt/stacktrace-parser/blob/ad379de5e5ac056012bbeb12923cf502aefe4710/test/stack-trace-parser.spec.js#L5)
- [parseHermesStack tests](https://github.com/facebook/react-native/blob/86cac6836502aaeb5c894bff6427e837c52c09e0/packages/react-native/Libraries/Core/Devtools/__tests__/parseHermesStack-test.js#L16)

Changelog: [Internal]

Reviewed By: javache, NickGerleman

Differential Revision: D63659013

fbshipit-source-id: 146acc9db7d4e8907b9fa1d42e4979133ef020f6
2024-10-10 16:03:02 -07:00
Ramanpreet NaraandFacebook GitHub Bot e4645d033a easy: Align earlyjs c++ native data structures with js (#46895)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46895

For the js error handling pipeline, the javascript data structure looks like [this](https://www.internalfb.com/code/fbsource/[6181b57f4ba3619f58056bcec65382650d6ff59a]/xplat/js/react-native-github/packages/react-native/src/private/specs/modules/NativeExceptionsManager.js?lines=17-35):

```
export type StackFrame = {|
  column: ?number,
  file: ?string,
  lineNumber: ?number,
  methodName: string,
  collapse?: boolean,
|};
export type ExceptionData = {
  message: string,
  originalMessage: ?string,
  name: ?string,
  componentStack: ?string,
  stack: Array<StackFrame>,
  id: number,
  isFatal: boolean,
  // flowlint-next-line unclear-type:off
  extraData?: Object,
  ...
};
```

So, I made the c++ data structure look similar
```
  struct ParsedError {
    struct StackFrame {
      std::optional<std::string> file;
      std::string methodName;
      std::optional<int> lineNumber;
      std::optional<int> column;
    };

    std::string message;
    std::optional<std::string> originalMessage;
    std::optional<std::string> name;
    std::optional<std::string> componentStack;
    std::vector<StackFrame> stack;
    int id;
    bool isFatal;
    jsi::Object extraData;
  };
```

Notes:
* [parseErrorStack](https://fburl.com/code/e27q9gkc) doesn't actually generate a collapse property on the error object. So, I omitted it from the c++.
* ExceptionsManager [always provides an extraData field](https://fburl.com/code/2bvcsxac). So, I made it required.
* In C++, I just stored extraData as a jsi::Object. I wanted the freedom to store arbitrary key/value pairs. But, I also didn't want to use folly::dynamic.

Changelog: [Internal]

Reviewed By: alanleedev

Differential Revision: D63929580

fbshipit-source-id: 51d8fcc79c9383789d456cfe4527cdd3f579395f
2024-10-10 16:03:02 -07:00
Eli WhiteandFacebook GitHub Bot ff698f542e Make RN ColorScheme a Union (#46872)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46872

This can now be flow typed as a union because the codegen supports it.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D63681874

fbshipit-source-id: 97783df5ae71292dd10602dee0bea39743e62234
2024-10-10 14:20:49 -07:00
Joe VilchesandFacebook GitHub Bot b0e2cb3371 Back out "fix(iOS): Replace uses of CGColorRef with UIColor to avoid manual memory management" (#46967)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46967

Original commit changeset: 5e85e17567e3

Original Phabricator Diff: D63989547

This is causing some crashes internally

Changelog: [Internal]

Reviewed By: shwanton

Differential Revision: D64194385

fbshipit-source-id: 835469e09971ae39d2db6e82f6c05970b1e6238c
2024-10-10 13:41:13 -07:00
Nicola CortiandFacebook GitHub Bot f25abe51ce Remove Deprecated DefaultDevSupportManagerFactory.create() (#46959)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46959

This method was deprecated in: b8893c7003
since React Native 0.72.

I verified that no-one is using it in OSS so I'm removing it.

This is necessary as I'll need to refactor the BridgelessDevSupportManager a bit.

Changelog:
[Android] [Breaking] - Remove Deprecated DefaultDevSupportManagerFactory.create()

Reviewed By: javache

Differential Revision: D64184635

fbshipit-source-id: a4081b2189d2e22cd9b2067f982a6ffd4f8b054e
2024-10-10 11:32:37 -07:00
Pieter De BaetsandFacebook GitHub Bot e4bdde6562 Remove default false/null props from Text (#46956)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46956

isHighlighted/isPressable/selection color are the same as the native default, there's no need to send these in our props payload needlessly.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D64179256

fbshipit-source-id: 22e62c8d440d3bd219a79f445e49739c24fa5d52
2024-10-10 11:30:11 -07:00
Peter AbbondanzoandFacebook GitHub Bot 09682b5109 Fix dark mode text (#46898)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46898

Replaces *many* `Text` component usages with `RNTesterText`: a thin wrapper around `Text` that applies color based on the color scheme chosen by the user. It makes text legible for dark mode across 41 different example files. This changes intentionally do not touch a few larger component sites that expand beyond RNTester, like `Animated` and `NewAppScreen`

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D64053464

fbshipit-source-id: 9516fef2afe1b364eb38e85e3a2dbb5c434e44db
2024-10-10 11:02:18 -07:00
Nikita LutsenkoandFacebook GitHub Bot f7b28e86aa rn/objc | Suppress warnings about set but unused variables. (#46945)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46945

Fixing a warning, so we can enable it globally.

Changelog:
[iOS][Fixed] - Silenced 'set but unused variable' warning.

Reviewed By: cipolleschi

Differential Revision: D64161528

fbshipit-source-id: 39f80d46a04422dd167334a4492fd2119503ca23
2024-10-10 11:00:34 -07:00
Fabrizio CucciandFacebook GitHub Bot f98006830c Replace React.AbstractComponent with component type in ProgressBarAndroid.android.js (#46928)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46928

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64113211

fbshipit-source-id: f850739f9116cf0cc8705e541a97333aa04c3a44
2024-10-10 10:59:58 -07:00
Fabrizio CucciandFacebook GitHub Bot c00f0d36b1 Replace React.AbstractComponent with component type in ScrollView (#46927)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46927

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64112934

fbshipit-source-id: d869ccd814cd3bbda2a548c7c2d405f651605716
2024-10-10 10:59:58 -07:00
Fabrizio CucciandFacebook GitHub Bot c8fd793cff Replace React.AbstractComponent with component type in ScrollViewStickyHeader (#46926)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46926

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64111478

fbshipit-source-id: 674316b9545dd12420e50f77cff6ac1c94783d4e
2024-10-10 10:59:58 -07:00
Fabrizio CucciandFacebook GitHub Bot 5d07c7232c Replace React.AbstractComponent with component type in TextInput (#46925)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46925

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64109824

fbshipit-source-id: 9823a459c9bd4f3eed4d3c560f0bdaf4be16d410
2024-10-10 10:59:58 -07:00
Ruslan ShestopalyukandFacebook GitHub Bot e39c91703d Add an event start timestamp field into RawEvent (#46949)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46949

# Changelog:

[Internal] -

This adds an (optional) event start time field into RawEvent, so that it can be threaded by the platform-specific code to tell where is the earliest point of the event start (depending on the platform).

For example, on Android platform it can be the point of time when the original MotionEvent was received.

Reviewed By: rubennorte

Differential Revision: D64175467

fbshipit-source-id: 535c95c695713dbbed74c554bceb70fa5e511d6a
2024-10-10 09:12:15 -07:00
David RickardandFacebook GitHub Bot 26d8d490e4 Fix null ref on iOS 18 (#46929)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46929

Got this error on Marketplace Home when I tried on the iOS 18 simulator:

```
Cannot read property 'stack' of null

if (rejection.stack && ...
```

This indicated `rejection` was null.

Fixed by adding an extra null check there.

Changelog:
[iOS][Fixed] Fixed crash on promise rejection handler in iOS 18.

Differential Revision: D64116020

fbshipit-source-id: 4198748b47d27c6def9957ff475ee780962d3baa
2024-10-10 09:11:53 -07:00
sarthak-d11andFacebook GitHub Bot af4907025e fix: change opacity logic from random to decrement by -0.20 (#46830)
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757
Solves:

ME2E0003

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[ Internal ] [ Changed ] - The opacity logic is changed from random to decrement the opacity by -0.2
For more details, see:

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

Test Plan:
yarn e2e-test-ios
yarn e2e-test-android

Reviewed By: rshest

Differential Revision: D64173519

Pulled By: cipolleschi

fbshipit-source-id: 69a09b64e7e4f098d3bfd72529401dadb49b93d7
2024-10-10 08:59:25 -07:00
Fabrizio CucciandFacebook GitHub Bot 1e8bee94cb Replace React.AbstractComponent with component type in TouchableBounce (#46924)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46924

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64108765

fbshipit-source-id: bc10f958948c24b16964e63790a9cb40bce095e9
2024-10-10 08:36:53 -07:00
Fabrizio CucciandFacebook GitHub Bot 90523b62a5 Replace React.AbstractComponent with component type in TouchableHighlight (#46923)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46923

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64107889

fbshipit-source-id: 824e318da8e833f82d2bd869a8c6485ec9dd541e
2024-10-10 08:36:53 -07:00
Fabrizio CucciandFacebook GitHub Bot 8d230fa78a Replace React.AbstractComponent with component type in TouchableOpacity (#46922)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46922

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64107774

fbshipit-source-id: f7b9afa8b0a08cedc07c055054bd2cda9a2b5b84
2024-10-10 08:36:53 -07:00
Fabrizio CucciandFacebook GitHub Bot 15f5ba4f9e Replace React.AbstractComponent with component type in DebuggingOverlay (#46921)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46921

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64107726

fbshipit-source-id: abd75fbb79db0b8f75b55c7c57e8b021b800256f
2024-10-10 08:36:53 -07:00
Thomas NardoneandFacebook GitHub Bot 6c35ff92dc View clipping tweaks (#46933)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46933

Some small tweaks to either resolve or better log clipping-related crashes in ReactViewGroup
Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D63914809

fbshipit-source-id: cf8bfd260c6affb85b8e1ac13447ae9f01d19135
2024-10-10 08:32:15 -07:00
Qichen ZhuandFacebook GitHub Bot ca0abd1b9e Set TextInput selection correctly when attached to window in Android (#46948)
Summary:
On Android, when `ReactEditText` is attached to window, `setTextIsSelectable` moves the caret to the beginning, so we need to restore the selection.

This is similar to what we did in https://github.com/facebook/react-native/pull/17851.

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

## Changelog:

[ANDROID] [FIXED] - Fix TextInput caret moving to the beginning when attached to window

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

Test Plan:
Code to reproduce in RNTester:

```TSX
import type {RNTesterModuleExample} from '../../types/RNTesterTypes';
import {TextInput} from 'react-native';
import {useEffect, useRef} from 'react';

function Playground() {
  const input = useRef(null);
  useEffect(() => { setTimeout(() => input.current?.focus(), 1000); }, []);
  return <TextInput ref={input} value='1.00' selection={{start: 4, end: 4}} />;
}

export default ({
  title: 'Playground',
  name: 'playground',
  render: (): React.Node => <Playground />,
}: RNTesterModuleExample);
```

Before | After
-- | --
![Screenshot_1728553990](https://github.com/user-attachments/assets/382cf3ec-7437-4b0d-8c15-c8923d677afd) | ![Screenshot_1728553884](https://github.com/user-attachments/assets/9883e966-e9b8-4f8a-bedb-6ee43880d482)

Reviewed By: cortinico

Differential Revision: D64175774

Pulled By: rshest

fbshipit-source-id: ef9fdbecca582c8075bcdfd2d9b810b04d87e3d9
2024-10-10 08:29:56 -07:00
Sam ZhouandFacebook GitHub Bot 2bc25be88c Replace last React.Ref type usage in react-native (#46931)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46931

Prepare for deletion of this deprecated type that contain support for string ref in the next flow release.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D64127228

fbshipit-source-id: 9d3a1c0e6303efb35a540349fdc8e42b7b70be8b
2024-10-10 08:19:34 -07:00
Ruslan LesiutinandFacebook GitHub Bot 4eceb7e568 Implement Runtime.releaseObject and releaseObjectGroup (#46032)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46032

Changelog: [Internal]

Implements the [`Runtime.releaseObject`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Runtime#method-releaseObject) and [`Runtime.releaseObjectGroup`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Runtime#method-releaseObjectGroup) CDP methods. These are used by CDT in a few places to release inspected objects (e.g. as part of the [popover](https://github.com/facebookexperimental/rn-chrome-devtools-frontend/blob/7b143e5d05a102c8c9cc7e282bab7b0751f75d61/front_end/panels/sources/DebuggerPlugin.ts#L766) feature), which is important to prevent memory leaks in long-running Fusebox sessions.

Reviewed By: dannysu, robhogan

Differential Revision: D61280394

fbshipit-source-id: 82181c6d0d6e52cf606ef2f48d389631e44b295e
2024-10-10 07:49:46 -07:00
Oskar KwaśniewskiandFacebook GitHub Bot 7e1674fc59 feat: deprecate passing separate new arch flags to RCTRootViewFactory (#46652)
Summary:
This PR follows up with the deprecation introduced here: https://github.com/facebook/react-native/pull/46228

The idea is to have new architecture depend on one flag, namely `newArchEnabled`. It exposes additional initializers for RCTRootViewFactory.

## Changelog:

[IOS] [CHANGED] - Use `newArchEnabled` flag in RCTAppDelegate and RCTRootViewFactory

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

Test Plan: CI Green

Reviewed By: javache

Differential Revision: D64173015

Pulled By: cipolleschi

fbshipit-source-id: 49474baf5415a2527e481a5d68ec94ae874185e6
2024-10-10 07:39:16 -07:00
Fabrizio CucciandFacebook GitHub Bot 865f302e0c Replace React.AbstractComponent with component type in ImageTypes (#46920)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46920

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64107532

fbshipit-source-id: 9fb09e0b5735f9f7b91b46867e35043fe9d679f0
2024-10-10 07:01:29 -07:00
Fabrizio CucciandFacebook GitHub Bot 5f058018dc Replace React.AbstractComponent with component type in various examples (#46919)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46919

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64105531

fbshipit-source-id: 5729862a95f544a3c1e1a88484d145ba92e192a6
2024-10-10 07:01:29 -07:00
Fabrizio CucciandFacebook GitHub Bot 6e2b9daf7d Replace React.AbstractComponent with component type in VScrollViewNativeComponent (#46917)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46917

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64108764

fbshipit-source-id: 44cf9316a03bb18b658aeb45b7d951ad346ae3f0
2024-10-10 07:01:29 -07:00
Fabrizio CucciandFacebook GitHub Bot f86a14e4ad Replace React.AbstractComponent with component type in View (#46916)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46916

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64104990

fbshipit-source-id: c747f4e89b5631a6c1543aca86cbea4db4987f5a
2024-10-10 07:01:29 -07:00
DawidandFacebook GitHub Bot ab8f3ff3e9 fix: vertical scroll views are detected as horizontals (#46836)
Summary:
There is a numerical issue that causes vertical scroll view to be considered as the horizontal one and leads to problems described [here](https://github.com/facebook/react-native/issues/46592). The problem is no longer visible after checking if the scroll view is horizontal with float equality.

~~I am not sure if it also happens on Android, so I am leaving it as a draft for now.~~

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

## Changelog:

[IOS] [FIXED] - check if scroll view is horizontal with float equality.

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

Pick one each for the category and type tags:

[IOS] [FIXED] - fixed scroll view

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

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

Test Plan: Tested on the repro provided in the above issue.

Reviewed By: rshest

Differential Revision: D64114476

Pulled By: cortinico

fbshipit-source-id: a5048e1403c4bb675d32928937d6411cfb12fd51
2024-10-10 06:37:28 -07:00
Fabrizio CucciandFacebook GitHub Bot 46a9711454 Replace React.AbstractComponent with component type in SafeAreaView (#46913)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46913

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64104922

fbshipit-source-id: 3210b6b7368872f13f9006bb1b19de9f92aa4bc8
2024-10-10 05:21:53 -07:00
Edmond ChuiandFacebook GitHub Bot 91a40a28de Fusebox reload-to-profile (Part 1 of 2: native) (#46856)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46856

Changelog:
[General][Added] - Add support for reload-to-profile in Fusebox. (Part 1 of 2: native)

CDT: https://github.com/facebookexperimental/rn-chrome-devtools-frontend/pull/117
React: https://github.com/facebook/react/pull/31021

This diff adds support for reload2profile under bridge and bridgeless for iOS, Android, and C++

Reviewed By: hoxyq

Differential Revision: D63233256

fbshipit-source-id: f2f2814491e785b03af143cc26639ef178881fff
2024-10-10 05:20:18 -07:00
zhongwuzwandFacebook GitHub Bot 77889afa1c Fixes missing char mode of linebreakmode (#46941)
Summary:
cipolleschi , Fixes missing char mode of linebreakmode.

## Changelog:

[IOS] [FIXED] - Fixes missing char mode of linebreakmode

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

Test Plan: char mode works.

Reviewed By: cipolleschi

Differential Revision: D64166107

Pulled By: javache

fbshipit-source-id: 1b1a5c603652e1d3bc9f7a32039fab4de7f59627
2024-10-10 04:24:49 -07:00
Joe VilchesandFacebook GitHub Bot 0d6908f4ed Sunset the value namespace (#46930)
Summary:
X-link: https://github.com/facebook/yoga/pull/1720

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

This is not really needed anymore, we can just use `StyleLength` statics instead

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63922280

fbshipit-source-id: cd953bae8e9f68574463eafc49c33c2e85ac1856
2024-10-09 19:20:15 -07:00
Saad NajmiandFacebook GitHub Bot b70709dbc2 fix(iOS): Replace uses of CGColorRef with UIColor to avoid manual memory management (#46847)
Summary:
Update React Native on iOS to do less manual memory management, by replacing uses of `CGColorRef` with `UIColor`, and only calling `UIColor.CGColor` when needed. This results in much less manual memory management, which is probably a good thing in 2024 :D. The downside is there is a breaking change: the signature of a method in `RCTBorderDrawing` changes.

This is a followup to https://github.com/facebook/react-native/issues/46797 . After that PR merged and I tested merging React Native macOS to the `0.76-stable` branch cut commit again, I saw even more places I needed to manually call `CGColorRetain` / `CGColorRelease`. The reason is due to React Native macOS specifics (explained below) and I could update React Native macOS to not need these changes, but I thought I would at least throw up a PR to propose the changes, as it may be good to move away from using Core Graphics' C base API as much as possible.

## Longer Explanation

With https://github.com/microsoft/react-native-macos/pull/2209 , I wrote a shim of [UIGraphicsImageRenderer](https://developer.apple.com/documentation/uikit/uigraphicsimagerenderer) for macOS. The main difference is my shim calls the NSImage API [imageWithSize:flipped:drawingHandler:](https://developer.apple.com/documentation/appkit/nsimage/1519860-imagewithsize?language=objc) to shim the UIGraphicsImageRenderer API [imageWithData:](https://developer.apple.com/documentation/uikit/uiimage/1624137-imagewithdata). The difference between the two is that the macOS API copies the block, and executes it when Appkit is about to draw the image, while the iOS API executes the block right away. Because of this, I think I am hitting way more places where `CGColorRef` variables needed to be retained / released. Additionally, I hit more of them when I merge to the 0.76 branch cut commit (this is why I didn't catch it with https://github.com/facebook/react-native/issues/46797).

Given this constraint, I have a couple of options:
1. Refactor my macOS shim to use the deprecated API [[NSImage lockFocus]](https://developer.apple.com/documentation/appkit/nsimage/1519891-lockfocus)
    - I am not a fan of this because `lockFocus` was deprecated for `imageWithSize:flipped:drawingHandler:`
2. Refactor my macOS shim to do what we used to do: Create a CGContext manually and write it to an image
    - This is probably OK. Relies on less Appkit specifics, and potentially gives more control to RN on the rendering layer, which I recall lenaic told me is better for Fabric)
3. Refactor React Native to avoid CGColorRef altogether, and use `UIColor` (which ARC will memory manage for us) as much as possible.
    - This is the approach of this PR and my preferred approach. The downside is this changes the signature of some of the methods in `RCTBorderDrawing` which is a breaking change. I've seen other PRs do this, so maybe its OK?

## Changelog:

[IOS] [BREAKING] -  Replace uses of `CGColorRef` with UIColor to avoid manual memory management

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

Test Plan: Launching RNTester's View example (which tests a lot of the border / outline / shadow rendering) does not crash for me on both iOS and macOS.

Reviewed By: NickGerleman

Differential Revision: D63989547

Pulled By: joevilches

fbshipit-source-id: 5e85e17567e3dd8b4b0388452398954ad2e02464
2024-10-09 16:42:17 -07:00
Tatiana KaposandFacebook GitHub Bot 0794fa909b fix(Windows): Fix cast and control paths errors on windows (#46899)
Summary:
Windows has a stricter set of rules for C++ files where we treat warning as error, the following files have fixes to correctly cast numbers and fix control path errors.

Control Path Error on React-Native-Windows repo:
```
1>react-native-windows\node_modules\react-native\ReactCommon\react\performance\timeline\PerformanceEntryReporter.h(138,1): warning C4715: 'facebook::react::PerformanceEntryReporter::getBufferRef': not all control paths return a value
1>react-native-windows\node_modules\react-native\ReactCommon\react\performance\timeline\PerformanceEntryReporter.h(154,1): warning C4715: 'facebook::react::PerformanceEntryReporter::getBuffer': not all control paths return a value
```

Apply these fixes will allow us to unfork these files in our repo :)

## Changelog:

[GENERAL] [FIXED] - Fix cast and control paths errors on windows

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

Test Plan: Tested on the RNW repo, these files are already forked with the respective fix

Reviewed By: cipolleschi

Differential Revision: D64086963

Pulled By: arushikesarwani94

fbshipit-source-id: fdad72dafa1a01c426536fc1b007dd4a83588d93
2024-10-09 16:12:16 -07:00
Nick GerlemanandFacebook GitHub Bot 7fb3d830be Breaking: Remove BaseViewManagerInterface (#46809)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46809

BaseViewManagerInterface isn't adding much value right now. It was added in D16984121 to allow codegen generated ViewManager delegates to apply to view managers which derive from ViewMangager instead of BaseViewManager (if they did some cleverness, to make VM delegate apply to a no-op class, still implementing all of BaseViewManager's methods).

All of the cases where that was used have since been moved to `SimpleViewManager`, and `BaseViewManagerAdapter` (needed to wire this together) doesn't exist anymore, so it's not possible to take any advantage of this interface existing. We should remove it, since its existence  is a source of error (e.g. it was missing setters for `accessibilityValue` or those related to pointer events), and is more generally confusing for anyone adding to `BaseViewManager` in the future.

This is a breaking change, because there are some libraries which vendor a copy of generated ViewManagerDelegate when building against legacy arch to be able to share code normally generated at build time. That means these will need to be updated to maintain compatibility with RN versions of 0.77+ with new arch disabled. This will not effect compatibility of these libraries against the default new arch, and the updated delegate is still compatible with older RN version.

```
    sourceSets.main {
        java {
            if (!isNewArchitectureEnabled()) {
                srcDirs += [
                    "src/paper/java",
                ]
            }
        }
    }
```

1. `react-native-picker/picker`
2. `rnmapbox/maps`
3. `react-native-gesture-handler`
4. `react-native-screens`
5. `react-native-svg`
6. `react-native-safe-area-context`
7. `react-native-pdf`

Changelog:
[Android][Breaking] - Remove BaseViewManagerInterface

Reviewed By: cortinico

Differential Revision: D63819044

fbshipit-source-id: 7e4935c8e43706b168f0f599a6676e8abfa66937
2024-10-09 14:49:01 -07:00
Fabrizio CucciandFacebook GitHub Bot c5a12df6f7 Replace React.AbstractComponent with component type in Text (#46912)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46912

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64103863

fbshipit-source-id: 8a443d02b2ab8836056fa8756180d7e6942f531e
2024-10-09 12:55:12 -07:00
Fabrizio CucciandFacebook GitHub Bot 37e0973bb3 Replace React.AbstractComponent with component type in Switch (#46911)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46911

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64103195

fbshipit-source-id: e0ff745c70df910dcb84ed3a824d67883bbfc44d
2024-10-09 12:55:12 -07:00
Deepanshu.shuklaandFacebook GitHub Bot 3102a58df3 test: pressable test cases (#46861)
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757

Solves:
ME2E0015
ME2E0016

## Changelog:

[ Internal ] [ Added ] - Add e2e test for pressable

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

Test Plan:
```
yarn e2e-test-ios
yarn e2e-test-android
```

Reviewed By: arushikesarwani94

Differential Revision: D63986636

Pulled By: cipolleschi

fbshipit-source-id: 4b58da97be3c7a14584f0343b6449b407c9517d2
2024-10-09 07:39:02 -07:00
sarthak-d11andFacebook GitHub Bot d0e5053528 chore: test case added for Image (#46831)
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757
Solves:

ME2E0019
## Changelog:
[ Internal ] [ Added ] - Added a test case for Image
<!-- 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/46831

Test Plan:
yarn e2e-test-ios
yarn e2e-test-android

Reviewed By: cortinico

Differential Revision: D63889719

Pulled By: cipolleschi

fbshipit-source-id: 674879066ec159f11894f24935fe39a86ea1ea63
2024-10-09 07:17:24 -07:00
Eric RozellandFacebook GitHub Bot 0449630612 Resolve Paper leak on Android (#46896)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46896

On Android Paper UIManager, when calling `ReactRootView.unmountReactApplication`, the ReactRootView tag is unset [here](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java#L926), before the round trip unmount operation to JS makes it's way back to a `dropView` call on `NativeViewHierarchyManager`.

In practice, this means that legacy architecture apps that unmount surfaces via `ReactRootView.unmountReactApplication` leak references to Views, and the "finalization" step (`onDropViewInstance`) is not universally called.

This is an attempt to fix the issue by skipping the `clearReactRoot` step on Paper, instead waiting for the round trip `UIManager.removeRootView` call.

## Changelog

[Android][Fixed] Fix issue where `onDropViewInstance` cleanup was not being handled after `ReactRootView.unmountReactApplication`

Reviewed By: javache

Differential Revision: D64054042

fbshipit-source-id: b8b8c237796674ca23a332e57a1bf2e07ab5af13
2024-10-09 05:25:10 -07:00
Marc RousavyandFacebook GitHub Bot 87bae7f734 feat: Add CallInvoker to installJSIBindings(..)/BindingsInstaller (#46851)
Summary:
While the new `installJSIBindings(..)`/`BindingsInstaller` functionality allows you to synchronously set up stuff in the JS runtime before JS runs, there is no access to the JS CallInvoker, meaning you cannot really set up anything that uses callbacks or asynchronous code.

[Nitro](https://github.com/mrousavy/nitro) needs this.

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

[IOS] [ADDED] - Add `CallInvoker` to `installJSIBindings(..)`
[ANDROID] [ADDED] - Add `CallInvoker` to `BindingsInstaller`

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

Test Plan: In `SampleTurboModuleJSIBindings`, we can now use the `CallInvoker`.

Reviewed By: rshest

Differential Revision: D63975546

Pulled By: javache

fbshipit-source-id: 43cd469de2c35581f5362d2500fc27e41d6eab72
2024-10-09 04:36:04 -07:00
Blake FriedmanandFacebook GitHub Bot eeaa3ff458 Let .xcode.env.local NODE_BINARY handle path spaces
Summary:
For users who may have node installed in a path with a space, this requires escaping.  For example:

```
NODE_BINARY=/Users/blakef/Library/Application Support/fnm/node-versions/v20.12.0/installation/bin/node
```

Needs to be:

```
NODE_BINARY=/Users/blakef/Library/Application\ Support/fnm/node-versions/v20.12.0/installation/bin/node
```

# Changelog
[iOS][Fixed] Generated NODE_BINARY in .xcode.env.local now supports paths with a space

Reviewed By: cipolleschi

Differential Revision: D64080118

fbshipit-source-id: 1045473e4fd284fc570fa538984618630be1af6d
2024-10-09 04:14:31 -07:00
Rubén NorteandFacebook GitHub Bot 5f00db970f Use CommonJS in feature flags definitions to simplify loading from Node.js (#46887)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46887

Changelog: [internal]

This is a small change to use CommonJS in `ReactNativeFeatureFlags.config.js` so the file can be easily imported from Node.js.

Reviewed By: jorge-cab

Differential Revision: D64039860

fbshipit-source-id: c84ddbdbfe942224e213d12b9496c41b73dd5731
2024-10-09 03:40:20 -07:00
Nicola CortiandFacebook GitHub Bot a268b2bf53 Enable warningAsErrors for RN-Tester (#46817)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46817

As I've cleaned up all the RN Tester warnings, I'm enable warningAsErrors for RNTester to make
sure we keep up with our warning count.

Changelog:
[Internal] [Changed] - Enable warningAsErrors for RN-Tester

Reviewed By: cipolleschi

Differential Revision: D63837633

fbshipit-source-id: f83273dadc7aa10ce7ae52ae790279819fb88345
2024-10-09 03:12:27 -07:00
Blake FriedmanandFacebook GitHub Bot e4814b0d6d Add description to CLI arguments (#46890)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46890

Add details as this is discussed in the Turbo Native Modules documentation going out in 0.76:

```
Usage: combine-js-to-schema-cli.js <outfile> <file1> [<file2> ...]

Options:
      --help      Show help                                            [boolean]
      --version   Show version number                                  [boolean]
  -p, --platform  Platforms to generate schema for, this works on filenames:
                  <filename>[.<platform>].(js|tsx?)              [default: null]
  -e, --exclude   Regular expression to exclude files from schema generation
                                                                 [default: null]
```

## Changelog:
[General][Added] Add cli --help details to combine-js-toschema-cli.js

Reviewed By: dmytrorykun

Differential Revision: D64045337

fbshipit-source-id: a4b977da2cbb0198a5d43f17ca3466ebde21e9a9
2024-10-08 19:22:29 -07:00
Panos VekrisandFacebook GitHub Bot 380175865b remove '$TEMPORARY$array' (#46897)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46897

Reviewed By: SamChou19815

Differential Revision: D64051902

fbshipit-source-id: 0cbcbb81f86f1383c7237b306cdbc839938c17b7
2024-10-08 16:33:45 -07:00
Peter AbbondanzoandFacebook GitHub Bot 768a1d8664 Add example of different resize methods (#46873)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46873

## Summary

Adds a small showcase for the different `resizeMethod` options and how downsampling is applied

## Changelog

[Android][Added] - Added showcase for Android `resizeMethod` options when applied to a large image

Reviewed By: rshest

Differential Revision: D62393212

fbshipit-source-id: 46e7ff6310617acb9eb288e3831c0b5e6b1751c8
2024-10-08 16:18:27 -07:00
Arushi KesarwaniandFacebook GitHub Bot 52f8c57ac6 RN][Android] Add a ReactNativeFeatureFlag to enable/disable LayoutAnimations in Android (#46904)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46904

Add a ReactNativeFeatureFlag to enable/disable LayoutAnimations in Android, default false

Changelog: [internal] internal

Reviewed By: fryfrog

Differential Revision: D64073913

fbshipit-source-id: 0d92fd47c4905e74d734113e921511120037bd8d
2024-10-08 16:11:12 -07:00
Arushi KesarwaniandFacebook GitHub Bot 05cc40952c Revert D64062268: Add a ReactNativeFeatureFlag to enable/disable LayoutAnimations in Android
Differential Revision:
D64062268

Original commit changeset: 474e191e6a67

Original Phabricator Diff: D64062268

fbshipit-source-id: 9003d52d60b98999a478d2bf797e2ad58c82054d
2024-10-08 15:14:27 -07:00
David VaccaandFacebook GitHub Bot 4763ef3121 Add a ReactNativeFeatureFlag to enable/disable LayoutAnimations in Android (#46903)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46903

Add a ReactNativeFeatureFlag to enable/disable LayoutAnimations in Android, default false

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D64062268

fbshipit-source-id: 474e191e6a677065681b512a93af74908e8250f5
2024-10-08 15:03:11 -07:00
Peter AbbondanzoandFacebook GitHub Bot 6202319ed5 Add resizeMethod type 'none' to disable downsampling on Android (#46866)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46866

## Summary
Adds a new `resizeMethod` called `none`. It disables downsampling on the image request and disregards the global image pipeline default. This has been a pain point raised when rendering large images on Android in issues like [this one](https://github.com/facebook/react-native/issues/21301) and [this one](https://github.com/facebook/fresco/issues/2397).

## Changelog
[Android][Added] - Adds a new `resizeMethod`, `none`, which disables downsampling for an image

Reviewed By: yungsters

Differential Revision: D62393211

fbshipit-source-id: d85e3ed098ad502c8edbdfa817c841271ee9e914
2024-10-08 13:29:15 -07:00
Nikita LutsenkoandFacebook GitHub Bot d386dfc804 rn | Remove set but unused variable. (#46891)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46891

This was set but never directly used - fix it.
Changelog:
[iOS][Fixed] Removed usage of set but unused variable.

Reviewed By: mg-here

Differential Revision: D64029449

fbshipit-source-id: 0d60428317de95aa235f249c512fa968aa04f879
2024-10-08 12:48:45 -07:00
generatedunixname89002005232357andFacebook GitHub Bot 6b2bbcf632 Revert D63643856
Summary:
This diff reverts D63643856

`_highestMeasuredFrameIndex` is not properly invalidated causing issues with previous logic when data size shrinks.

bypass-github-export-checks

Changelog:
[General][Changed] - Revert "Fix onEndReached not being called when getItemLayout is present and we scroll past render window"

Reviewed By: NickGerleman

Differential Revision: D64009287

fbshipit-source-id: 8a21b57f5247fc743e65f9a730ff33a9a89d2bc1
2024-10-08 12:13:10 -07:00
Nicola CortiandFacebook GitHub Bot cbc0978bb6 Bump AGP to 8.7.0 (#46886)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46886

This brings AGP to the latest stable version.

Changelog:
[Android] [Changed] - Bump Android Gradle Plugin (AGP) to 8.7.0

Reviewed By: tdn120

Differential Revision: D64038466

fbshipit-source-id: d7ba1c8e5840f6c8658f037fc5846fb640ab3922
2024-10-08 10:59:40 -07:00
Anatoliy MagdaandFacebook GitHub Bot d54c25fdae Improve FpsDebugFrameCallback.getTotalTimeMS accuracy (#46869)
Summary:
`FpsDebugFrameCallback.getTotalTimeMS()` implementation loses accuracy due to incorrect order of type casting to int

## Changelog:

[ANDROID] [CHANGED] - Improve FpsDebugFrameCallback.getTotalTimeMS() accuracy

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

Test Plan:
- Launch some test app
- Open up the [Dev Menu](https://reactnative.dev/docs/debugging#accessing-the-dev-menu) in your app and toggle Show Perf Monitor
- Compare results of current & improved implementations

Reviewed By: rshest

Differential Revision: D64024054

Pulled By: arushikesarwani94

fbshipit-source-id: 438792bace0e3443d151cf13364f6e94b66dfb5e
2024-10-08 10:49:10 -07:00
Panos VekrisandFacebook GitHub Bot 19fc1c75d4 replace '$TEMPORARY$object' with '$ReadOnly' [1/n] (#46879)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46879

* `js1 flow-runner codemod flow/replaceTempObjWithReadOnly`
* Suppress errors

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D64019269

fbshipit-source-id: 811deeff3be2f9ebed750719da67a4e87a074a67
2024-10-08 10:28:56 -07:00
Panos VekrisandFacebook GitHub Bot 9038a78948 replace '$TEMPORARY$string<str>' with 'str' (#46877)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46877

* Used codemods of [this commit](https://www.internalfb.com/intern/commit/cloud/FBS/3a8982d63197fff7bac8b6d448545ec9660f331e)
* `flow-runner codemod flow/replaceTempStringWithStringLiteral`
* `~/fbsource/xplat/js/scripts/flow/tool add-comments .`

Reviewed By: SamChou19815

Differential Revision: D63991777

fbshipit-source-id: 0b2314c4e88c43c0ca1f92f34516f2408a30624b
2024-10-08 10:28:56 -07:00
Sam ZhouandFacebook GitHub Bot 9b5fef32f1 Update some React.AbstractComponent type to use component type (#46855)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46855

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D63947642

fbshipit-source-id: bec8a2498961b5bc602d86ecb2b5a4b5c4785e09
2024-10-08 09:20:42 -07:00
Thibault MalbrancheandFacebook GitHub Bot d7a8aae9ac fix: override podspecs dependencies c++ version (#46888)
Summary:
Some dependencies would override C++ version like [this](https://github.com/mrousavy/react-native-vision-camera/blob/83abb0832a22b6b080f8412ed17b0992532b0eb2/VisionCamera.podspec#L36).

We force it back to be the current version set by react-native so that we are sure projects are using the correct version

## Changelog:

[IOS] [FIXED] - Enforce we use the correct C++ version for all, even if dependency tries to set it

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

Test Plan:
This can be test via
https://github.com/Titozzz/cpp17bug

Reviewed By: blakef

Differential Revision: D64042099

Pulled By: cipolleschi

fbshipit-source-id: c36dda0a718e52e19d53c3e9d895315141cb040c
2024-10-08 08:09:25 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 7c0258ab2c Add changelog for 0.73.10 (#46889)
Summary:
Add changelog for 0.73.10

## Changelog:
[Internal] - Add changelog for 0.73.10

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

Test Plan: N/A

Reviewed By: blakef

Differential Revision: D64042711

Pulled By: cipolleschi

fbshipit-source-id: b98d2793672ab031c88e96fe6047b1bb1ec486f6
2024-10-08 07:59:51 -07:00
Peter AbbondanzoandFacebook GitHub Bot ff1c3824d2 Remove unused vector drawable code path (#46878)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46878

Removes an unused code path from `ResourceDrawableIdHelper`. Vector drawables are now loaded via Fresco decoder so we don't need to offer this utility anymore. While part of the public API, it only made it into 0.76.0 RCs and should have really been marked internal.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D64021956

fbshipit-source-id: 6e8073e0f7f079d023fa1e45a5a43f8652ca2826
2024-10-08 07:24:28 -07:00
Alonso PaulinoandFacebook GitHub Bot aaf7a6a3ab Back out "cache JNI calls to FabricUIManager::getColor" (#46871)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46871

changelog: [internal]

Original commit changeset: 748efce7f0b8

Original Phabricator Diff: D59859754

This is temporarily until we find an actual solution that can both cache the colors and also react to theme changes updating the colors value properly.

Reviewed By: javache

Differential Revision: D64002346

fbshipit-source-id: 9ba3bd0d653b9a0d8617f45d42c0c3d966fba01f
2024-10-08 04:39:27 -07:00
Panos VekrisandFacebook GitHub Bot 40a4feb681 replace '$TEMPORARY$string<>' with 'string' (#46876)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46876

* Used codemods of [this commit](https://www.internalfb.com/intern/commit/cloud/FBS/3a8982d63197fff7bac8b6d448545ec9660f331e)
* `js1 flow-runner codemod flow/replaceTempStringWithString`
* `js1 flow-runner codemod flow/simplifyUnionsOfString`

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D63991775

fbshipit-source-id: 5b9d1fdf045405230ca2b0969357ae92479692b5
2024-10-07 19:18:14 -07:00
Panos VekrisandFacebook GitHub Bot bed5323374 manually remove instances of '$TEMPORARY$string<>' (#46874)
Summary:
Remove instances of an unsound flow type

Changelog: [internal]

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

Reviewed By: SamChou19815

Differential Revision: D63991776

fbshipit-source-id: 1817b1287803d22195bf521e07b3027b86562f47
2024-10-07 19:18:14 -07:00
Arushi KesarwaniandFacebook GitHub Bot 7b877a4bed Adding support for custom C++ TM wrapper to CxxReactPackage (#46822)
Summary:
Modifying the CxxReactPackage by changing the annotation from UnstableReactNativeAPI to FrameworkAPI so as to now support custom C++ TM wrapper

Changelog:
[Android][Changed] - Modify CxxReactPackage to support custom C++ TM wrapper

Reviewed By: shwanton, christophpurrer

Differential Revision: D63740964

fbshipit-source-id: 175b1104dcd11674413199b30415516d4d324a97
2024-10-07 17:28:00 -07:00
Eli WhiteandFacebook GitHub Bot a669de1dd2 Parse string unions as StringLiteralUnionTypeAnnotation (#46845)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46845

Previously, the parser was throwing away the values of a string union when storing it in the schema. It would only store the union as

```
{
  type: 'UnionTypeAnnotation',
  memberType: 'StringTypeAnnotation'
}
```

We now track the string literals through the parser and store them in the schema:

```
{
  type: 'StringLiteralUnionTypeAnnotation',
  types: [
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'light'
    },
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'dark'
    },
  ],
}
```

We aren't changing the generators, those still just output "string". They could eventually be made smarter.

The value of this is that the compat checker can now error when the union changes.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D63917685

fbshipit-source-id: 34a10e1f1910d2935837a3659f66049fd4473134
2024-10-07 16:56:04 -07:00
Eric RozellandFacebook GitHub Bot 1ffef5669c Fix for multi-root apps with Modal (#46867)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46867

In multi-root Android React Native apps (e.g., multiple ReactFragments), if the following sequence occurs:
1. a Modal is displayed via the secondary root
2. the secondary root is destroyed
3. the app is backgrounded
4. the app is foregrounded

The LifecycleEventListener on the ReactModalHostView will fire, causing the Modal to be rehydrated in the onHostResume callback.

Removing the lifecycle event listener when the modal is detached from the window resolves the issue.

## Changelog

[Android][Fixed] Fix issues with Modals and lifecycle events in multi-surface apps

Reviewed By: alanleedev

Differential Revision: D64001103

fbshipit-source-id: 10f8304cd9cca0d5c90e39f5e361290f4fc35283
2024-10-07 16:09:53 -07:00
Peter AbbondanzoandFacebook GitHub Bot 86d92e41d2 Bump Fresco version to 3.3.0 (#46864)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46864

## Summary
Fresco v3.3.0 contains necessary adjustments to allow downsample overrides per image request (see https://github.com/facebook/fresco/pull/2787), as well as numerous other bug fixes and adjustments across both Drawee and Vito images.

## Changelog
[Android][Changed] - Update Fresco from 3.2.0 to 3.3.0

Reviewed By: oprisnik

Differential Revision: D63983051

fbshipit-source-id: 9ad0c40dfc864d24ffa39ca9e2bc0ddf8210f4f7
2024-10-07 13:44:44 -07:00
Eli WhiteandFacebook GitHub Bot d2f3f06826 Add support for StringLiteralTypeAnnotation (#46827)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46827

You can now define a native module that takes an argument that is a specific string literal:

Like this:
```
export interface Spec extends TurboModule {
  +passString: (arg: string) => void;
  +passStringLiteral: (arg: 'A String Literal') => void;
}
```

On the native side, this will still generate `string`, but the schema will now store the string literal, and it will be allowed in JS. This should allow more strict flow / typescript types for modules.

This will also allow the compatibility check to fail if the literal changes.

This is a step towards accepting a union of string literals.

Changelog: [General][Added] Codegen for Native Modules now supports string literals

Reviewed By: GijsWeterings

Differential Revision: D63872440

fbshipit-source-id: e54b97d34af4a3d1af51727db0777f26fb7b778c
2024-10-07 12:35:19 -07:00
Alan LeeandFacebook GitHub Bot 73ce1984e8 fix crash for Modal not attached to window manager (2) (#46764)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46764

This is a patched fix to earlier attempt (D63700769) and resolving crash due to`java.lang.IllegalArgumentException: View=DecorView@b9f88af[AdsManagerActivity] not attached to window manager`.
- removing ` !dialogWindow.isActive` check as it is always true resulting in always doing early return causing other bugs
- adding try/ catch instead so the code can still run but can catch the known exception without crashing

Changelog:
[Android][Fixed] - Fix crash for Modal not attached to window manager

Reviewed By: mdvacca

Differential Revision: D63712422

fbshipit-source-id: 85fb6df340eb1139f954c92b5f1daf0dc41671d2
2024-10-07 12:31:20 -07:00
Thomas NardoneandFacebook GitHub Bot eb04be8ec0 Add ReactViewGroupTest (#46843)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46843

Add some simple tests for ReactViewGroup clipping logic

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63903975

fbshipit-source-id: 8ce683a4aeba2f3916a26d7b4e93b4a30227c6d5
2024-10-07 10:37:44 -07:00
Nick GerlemanandFacebook GitHub Bot 276e3a7df7 Fix mising ANTI_ALIAS_FLAG when resetting Text Paint (#46848)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46848

D63303172 introduced a bug showing truncation on versions of Android <= 28. I tracked this down to `ANTI_ALIAS_FLAG` getting cleared when we reset the paint. This applies it again after resetting, for consistency with previous behavior, and TextView.

This bug doesn't effect newer versions of Android, since API 29+ applies this flag by default. https://github.com/aosp-mirror/platform_frameworks_base/commit/47c51fe80e3dd9d6b518c11c2e1714c271835af5#diff-57b6a0bc3755a19d1faf73c130b0e56e8e13930148c5434666c5a186aeb01c78R256

Changelog:
[Android][Fixed] - Fix mising `ANTI_ALIAS_FLAG` when resetting Text Paint

Reviewed By: javache

Differential Revision: D63930051

fbshipit-source-id: bb4c98834954637b0a8f0dba8502188626a68b54
2024-10-07 10:34:32 -07:00
Vitali ZaidmanandFacebook GitHub Bot 8bbd3a8fb4 do not require @fb-tools/babel-register in open source (#46863)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46863

open source should not require `fb-tools/babel-register`

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D63976514

fbshipit-source-id: 83302adfc8059d294ca568f9edf1aa24d0244933
2024-10-07 09:36:47 -07:00
Tomasz ŻelawskiandFacebook GitHub Bot cc6d1eb844 feat: Expose MetroConfig type directly from @react-native/metro-config (#46602)
Summary:
React Native [app template provided by the CLI](https://github.com/react-native-community/template) currently uses [`metro-config` directly for `MetroConfig` type](https://github.com/react-native-community/template/blob/main/template/metro.config.js#L7).
However, it doesn't have `metro-config` as neither a dependency or dev dependency, which can lead to version mismatches.

While this is obviously a mistake on the template repo side, `metro-config` versions aren't matched with `react-native` versions. Therefore, getting the correct version of `metro-config` from `react-native/metro-config` would require reflecting on `react-native/metro-config`'s package.json etc. which is far from ideal. In my opinion it's would be much better to expose `MetroConfig` type from `react-native/metro-config` directly.

Version mismatching can happen in a monorepo setup. Say we have the monorepo structure using Yarn Modern:

```tree
.
├── RN75-app (workspace)
├── RN76-app (workspace)
│   ├── metro.config.js
│   └── node_modules
│       └── react-native
│           └── metro-config (0.76)
│               └── node_modules
│                   └── metro-config (version for 0.76)
└── node_modules
    ├── react-native
    │   └── metro-config (0.75)
    └── metro-config (version for 0.75)
```

`react-native@0.75` gets hoisted to the monorepo root while `react-native@0.76` sits in an RN 0.76 app workspace.

Say we have the following `RN76-app/metro.config.js` contents:

```js
const {getDefaultConfig, mergeConfig} = require('react-native/metro-config');

/**
 * Metro configuration
 * https://reactnative.dev/docs/metro
 *
 * type {import('metro-config').MetroConfig}
 */
const config = {};

module.exports = mergeConfig(getDefaultConfig(__dirname), config);
```

In this case, `require('react-native/metro-config')` would resolve to `RN76-app/node_modules/react-native/node_modules/metro-config` since `react-native/metro-config` is a (dev) dependency of the App.

However `import('metro-config).MetroConfig` would resolve to `node_modules/metro-config` since it's not a direct dependency.

This is how we have a mismatch - imported functions come from different packages than imported type.

## Changelog:

[GENERAL] [ADDED] - Expose `MetroConfig` type directly from `react-native/metro-config`.

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

Test Plan:
`yarn build` to generate dist for `react-native/metro-config`, see it has the export of `MetroConfig`.

## Notes

If this PR gets approved, I'll submit relevant one to the CLI template.

Reviewed By: huntie

Differential Revision: D63258881

Pulled By: robhogan

fbshipit-source-id: e6f3c880eb4a0aa902c62932d58f243c38b07c2e
2024-10-07 06:35:01 -07:00
Nick LefeverandFacebook GitHub Bot 7510ba3c2a Clean up layout-only shadow node reference update feature flag (#46825)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46825

Changelog: [Internal]

Removing the `useRuntimeShadowNodeReferenceUpdateOnLayout` feature flag after releasing `useRuntimeShadowReferenceUpdate`.

Reviewed By: shwanton

Differential Revision: D63831444

fbshipit-source-id: 61fd800f5c9f933ce5c18d066a6b5984daed2647
2024-10-07 06:11:36 -07:00
Nick LefeverandFacebook GitHub Bot 7316e3233d Remove layout-only shadow node reference updates (#46824)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46824

Changelog: [Internal]

Removing the implementation of layout-only shadow node reference updates, since the full version of shadow node reference updates are being released.

Reviewed By: shwanton

Differential Revision: D63831453

fbshipit-source-id: 84cb231be6c16bdc4a4b12a559c41b5a77064813
2024-10-07 06:11:36 -07:00
Nick LefeverandFacebook GitHub Bot de56fb6309 Enable shadow node reference updates by default (#46823)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46823

Changelog: [Internal]

Releasing runtime shadow node reference updates, enabling it by default.

Reviewed By: shwanton, rubennorte

Differential Revision: D63829891

fbshipit-source-id: 9292df3f8c7c8986d8e06d3c526ad1e6e8773916
2024-10-07 06:11:36 -07:00
Alex HuntandFacebook GitHub Bot 2f07130bb3 Align logIfUpdateAvailable to use resolved RN version from CLI (#46777)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46777

Simplifies this internal logic plus ensures there is one source of truth for `reactNativeVersion` in our CLI plugin. Also, renames the `ctx` variable to `cliConfig`, to more clearly signal that this is an integration point with the Community CLI.

Completes this wave of `community-cli-plugin` simplifications.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D63534247

fbshipit-source-id: bf5779fcf971dee1e0caf58b071df360636c53e9
2024-10-07 05:53:37 -07:00
Nicola CortiandFacebook GitHub Bot d1a256f51a Remove ReactNativeFlipper object (#46839)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46839

The `ReactNativeFlipper` object is not referenced in the template since 0.75. We can safely remove it as users should not reference it anymore.

Changelog:
[Android] [Breaking] - Remove ReactNativeFlipper object, deprecated in 0.75

Reviewed By: huntie

Differential Revision: D63897187

fbshipit-source-id: a7d73a98550518e46f8dbc0c9b859e0afb16e8a9
2024-10-07 04:51:45 -07:00
Ramanpreet NaraandFacebook GitHub Bot d0912ed067 Fix global.__fetchSegment's error case (#46854)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46854

When segment fetch fails, it seems incorrect to call the callback twice: once with error, and once with null.

This seems like a bug.

Created from CodeHub with https://fburl.com/edit-in-codehub

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D63959015

fbshipit-source-id: f3ebb0f4732d99d91b5717a5bf193f44d957bde4
2024-10-06 15:13:40 -07:00
Nicola CortiandFacebook GitHub Bot 352c063589 Removed unused mJSEngineResolutionAlgorithm from ReactHostImpl (#46842)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46842

This filed is unused, let's just remove it.

Changelog:
[Internal] [Changed] - Removed unused `mJSEngineResolutionAlgorithm` from ReactHostImpl

Reviewed By: NickGerleman

Differential Revision: D63899705

fbshipit-source-id: 09fbd57333b32071540bf4c0aab9200a83a76010
2024-10-04 20:59:22 -07:00
Nick GerlemanandFacebook GitHub Bot 0b0ac81fbe Fix some cases where we override setBackgroundColor on View-level instead of VM level (#46846)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46846

As of D61658739, BaseViewManager setting color now goes through BackgroundStyleApplicator, which gives a default implementation of setting a background color, while storing information in a way where we can impement things like border radii and shadows on background for out of the box views.

I knew this could lead to breaks where we previously overrode view-level `setBackgroundColor` to do something custom, but didn't override on VM level, but didn't see any external usages so I assumed it should be relatively safe. Turns out we have some internal usages which run into this pattern (D63913128 already fixed one), including a usage in RN itself! Let's override the view managers in these to delegate to the view's custom drawing.

Changelog:
[Android][Fixed] - Fix some cases where we override setBackgroundColor on View-level instead of VM level

Reviewed By: Abbondanzo

Differential Revision: D63922722

fbshipit-source-id: af988d1436c790be97b2be1325541aa418bf43a3
2024-10-04 18:43:49 -07:00
Joe VilchesandFacebook GitHub Bot 3f1e381ded Add RNTester box sizing example and e2e test round 2
Summary:
Add the tests back!

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63844898

fbshipit-source-id: 6c08557e54be01a1dc156cf72f187a5bb6c5d791
2024-10-04 17:07:05 -07:00
Joe VilchesandFacebook GitHub Bot 3ca796edc3 Plumbing to get boxSizing prop to Yoga round 2 (#46820)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46820

Relanding this as we had to unship due to some issues, which are fixed in the previous diff

Reviewed By: NickGerleman

Differential Revision: D63844167

fbshipit-source-id: b3e62004fe87ff732aac1c1622ac35d581b4980f
2024-10-04 17:07:05 -07:00
Joe VilchesandFacebook GitHub Bot f3d51ef519 Fix issue where padding for box sizing is resolved against wrong reference length (#46799)
Summary:
X-link: https://github.com/facebook/yoga/pull/1715

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

Content box impl had a bug where we resolved padding % against the same reference length as the dimensions. Padding should always be against containing block's width. This is also true for width, but not for height, which should be against containing block's height.

This just pipes the width into our box sizing functions.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63787577

fbshipit-source-id: e512338770f25b66506cabab5a7cde8f04397ea0
2024-10-04 17:07:05 -07:00
Benoit GirardandFacebook GitHub Bot f0527d8662 Instrument XMLHttpRequest (#46844)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46844

Currently we can't see when a network query is made. It makes it hard to debug performance in apps like Store because it's unclear which queries are preloaded, which are fetched as early as they can and which ones are fetched late.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D63858486

fbshipit-source-id: 29d74a68f96a7d4c7b212453d7c0ceba525f3e39
2024-10-04 14:27:25 -07:00
Riccardo CipolleschiandFacebook GitHub Bot ab2c47be28 Fix deadlock when a new surface is getting started while another is stopped (#46841)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46841

Some apps are crashing because surfaces are started and stopped concurrently and this can create a deadlock.

This is an attempt to disentangle the deadlock by not moving synchronously to the main queue when starting a surface

## Changelog
[iOS][Changed] - Do not move to the main queue synchronously when starting a new surface

Reviewed By: fkgozali

Differential Revision: D63899469

fbshipit-source-id: 98cb313ebd610c65f6b06a683912856a00102e44
2024-10-04 13:23:20 -07:00
Eli WhiteandFacebook GitHub Bot 3af126b562 Add support for basic unions for native modules (#46747)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46747

You can now use unions in native modules.

Support for this pretty much existed, but one callsite was throwing for non-cpp modules which meant nobody could use this.

Previously, StructCollector would throw that this was not supported because it couldn't generate it for objc. Instead of generating something smart in the native code for each option, it just tells native to treat them like the base type (number, string, object).

Changelog: [General][Added] Codegen now supports Union Types in NativeModules

Reviewed By: GijsWeterings

Differential Revision: D63664505

fbshipit-source-id: 73278ed9cd64452173c5170aba44ced71181510f
2024-10-04 12:08:51 -07:00
Ariel LinandFacebook GitHub Bot af3bee6511 add support for iOS "Darker System Colors" (Increase Contrast) setting into AccessibilityInfo (#46826)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46826

This change adds `isDarkerSystemColorsEnabled()` to `AccessibilityInfo` to enable access to iOS's "Increase Contrast" setting option. It also adds a new event, `darkerSystemColorsChanged`, to enable listeners to subscribe to changes on this setting.

## Changelog

[iOS][Added] - Added `isDarkerSystemColorsEnabled()` to `AccessibilityInfo` to read "Increase Contrast" setting value

Reviewed By: cipolleschi

Differential Revision: D63880393

fbshipit-source-id: a476f8fc4d7354826bc344876b359eb1a3485f0d
2024-10-04 11:46:10 -07:00
Nicola CortiandFacebook GitHub Bot 7bb12ebbea Convert react/nativemodule/samples/ to Kotlin (#46816)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46816

This converts the same native module from Java to Kotlin.
I've converted the whole module as it was quite simple + I've fixed some of the warnings.

Changelog:
[Internal] [Changed] - Convert react/nativemodule/samples/ to Kotlin

bypass-github-export-checks

Reviewed By: javache

Differential Revision: D63837631

fbshipit-source-id: bb126d7649a6e8a36510bf2b252ecdfae91fe09f
2024-10-04 07:57:46 -07:00
muskan27797andFacebook GitHub Bot fa62b7e1ed Add test for background color and border width in text.yml (#46829)
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757
Solves:

- ME2E0017
- ME2E0018

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

[ Internal ] [ Added ] - Add e2e test for button

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

Test Plan:
yarn e2e-test-ios
yarn e2e-test-android

Reviewed By: rshest

Differential Revision: D63889079

Pulled By: cipolleschi

fbshipit-source-id: ca2ede3142d77170fcb4121b025eab56818ffb07
2024-10-04 07:05:40 -07:00
Ahmed BilalandFacebook GitHub Bot 1a2532b1fc Add Modal Testing to modal.yml (#46796)
Summary:
This pr is part of issue https://github.com/facebook/react-native/issues/46757 solving tasks [ME2E0001] and [ME2E0002].
## 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
-->
[ Internal ] [ Added ] - Add e2e test for modal

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

Test Plan:
yarn e2e-test-ios
yarn e2e-test-android

Reviewed By: cortinico

Differential Revision: D63829299

Pulled By: cipolleschi

fbshipit-source-id: ff64d0babde8aea6e2586c2f69056a10533750f9
2024-10-04 06:02:13 -07:00
Riccardo CipolleschiandFacebook GitHub Bot fdee0ebbcb Avoid calling keyWindow on any UIScene (#46832)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46832

After bumping to minIOSVersion 15.1, we refactored the code to remove some check.
In the refactoring, we changed how the `keyWindow` is returned and now we are unsafely casting `UIScene` to `UIWindowScene`.

We have some internal apps that use `UIScene` that are not `UIWindowScene` and the change is causing them to crash.

This change fixes the crash by checking whether the selector is available in the UIScene and casting it only in that case.
Otherwise we return `nil`, the same behavior we used to have before the refactor.

## Changelog
[iOS][Fixed] - Cast the UIScene to UIWindowScene only if the scene respond to the selector

Reviewed By: javache

Differential Revision: D63890980

fbshipit-source-id: 3230e0075f06ed3f3d759b48f9c7bd13d8787b44
2024-10-04 05:53:39 -07:00
YasirandFacebook GitHub Bot 1c923ad8ab Add Pressable testing case in pressable.yml (#46808)
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757
Solves:

- ME2E0013
- ME2E0014

## 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
-->
[INTERNAL] [ADDED] - Added E2E for Pressable

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

Test Plan:
yarn e2e-test-ios
yarn e2e-test-android

Reviewed By: rshest

Differential Revision: D63838828

Pulled By: cipolleschi

fbshipit-source-id: a28f654a14fbf7f9b79dedf04f402593042fb4a3
2024-10-04 05:53:07 -07:00
shubhamguptadream11andFacebook GitHub Bot 699f73a6b0 Added Submit Application test to button.yml (#46805)
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757
Solves:
- ME2E0011
- ME2E0012

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

[ Internal ] [ Added ] - Add e2e test for button

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

Test Plan:
```
yarn e2e-test-ios
yarn e2e-test-android
```

Reviewed By: cortinico

Differential Revision: D63829243

Pulled By: cipolleschi

fbshipit-source-id: 87d8e62650c66fb07e116877a212eff79f10eaf2
2024-10-04 04:53:26 -07:00
Oskar KwaśniewskiandFacebook GitHub Bot a1ec345e2a refactor(iOS): move RCTNotifyEventDispatcherObserversOfEvent_DEPRECATED to const (#46833)
Summary:
This PR moves `RCTNotifyEventDispatcherObserversOfEvent_DEPRECATED` as it was used as string in the codebase and in OSS libraries.

## Changelog:

[IOS] [FIXED] - move RCTNotifyEventDispatcherObserversOfEvent_DEPRECATED to const

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

Test Plan: CI Green

Reviewed By: cipolleschi

Differential Revision: D63891220

Pulled By: javache

fbshipit-source-id: d4fa1f751b4b0cb131ab6c6d4dd0a345762d7c71
2024-10-04 04:26:29 -07:00
Saad NajmiandFacebook GitHub Bot 47748c7935 fix(iOS): Properly retain/release backgroundColor in RCTBorderDrawing (#46797)
Summary:
I discovered this while working on my shim of `UIGraphicsImageRenderer` for macOS (See https://github.com/microsoft/react-native-macos/pull/2209). A variable of type`CGColorRef` is not automatically retained and released when passed into a block. There was a case in `RCTBorderDrawing` where we were doing so. To fix this, we have two options:

1. Pass a `UIColor` instead (Requires a change to the signature of the function calling it)
2. Properly retain and release the variable.

The first option would technically be a breaking change (we would need to change the signature of `RCTGetBorderImage`, so I'm opting for option 2.

## Changelog:

[IOS] [FIXED] -  Properly retain/release backgroundColor in RCTBorderDrawing

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

Test Plan: CI should pass. Locally, borders still draw fine for me.

Reviewed By: joevilches

Differential Revision: D63827824

Pulled By: cipolleschi

fbshipit-source-id: 926601d062b90a7d741d7a1af3070cec4b8795ae
2024-10-04 03:56:30 -07:00
Cedric van PuttenandFacebook GitHub Bot eeb6122f39 fix(dev-middleware): respond with status code 200 when launching RNDT (#46814)
Summary:
This fixes an issue where `POST /open-debugger?appId&device&target` does not return a proper status code, meaning that the request will never be answered and clients might hang until the request timeout is hit.

## 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] - Respond with status code `200` when successfully launching RNDT

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

Test Plan:
- `curl -v -X POST "<deviceUrl>"`
- This should show a proper response for the request.

before | after
 --- | ---
![image](https://github.com/user-attachments/assets/5b820acd-1168-4642-90ec-f2eeec0afc16) | ![image](https://github.com/user-attachments/assets/82bb2a6c-3c7b-483f-a4a1-ad00e5ca0178)

Reviewed By: NickGerleman

Differential Revision: D63837025

Pulled By: huntie

fbshipit-source-id: ac72fc793e015f0eec498f4a35b4fb9e301c5b32
2024-10-04 02:45:59 -07:00
Riccardo CipolleschiandFacebook GitHub Bot bd50c4a460 Make sure that all the pods in a project use the same C++ version (#46787)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46787

This issue was raised by a some partner that were integrating with libraries that were setting the wrong C++ version.

With this change, RN takes ownership of the version of C++ that must be supported.

## Changelog
[iOS][Breaking] - Cocoapods decide the C++ version for iOS pods

Reviewed By: blakef

Differential Revision: D63760271

fbshipit-source-id: 5e629c61accd97fb10a199430d31e8b4c73d482b
2024-10-04 02:17:15 -07:00
Nick GerlemanandFacebook GitHub Bot 309cdea337 Use BackgroundStyleApplicator when setting background color in BaseViewManager (#46160)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46160

We use this for all built-in components now, and rely on going through `BackgroundStyleApplicator` to be able to set additional background effects like borders, rounded corners, box shadow, outlines.

Let's use this in `BaseViewManager`, to allow exposing those other effects to all views, letting RN manage the background drawable for views using `BaseViewManager` and exposing the props for the managed styles.

This is technically breaking, in the case where a custom component could previously inherit directly from `BaseViewManager`/`ReactViewGroupManager`, (vs `SimpleViewManager`/`ReactViewManager`), then override `setBackgroundColor` on the Android View, instead of the view manager, but this effected zero of the [276 top libraries](https://github.com/elicwhite/react-native-libraries), so I don't think it would be common to hit.

Changelog:
[Android][Breaking]  - Use BackgroundStyleApplicator when setting background color in BaseViewManager

Reviewed By: tdn120

Differential Revision: D61658739

fbshipit-source-id: 15af649328ea18fda3cd68e56d481ed1c0fd43c4
2024-10-03 14:55:15 -07:00
Joe VilchesandFacebook GitHub Bot 211534b481 Add default test for box sizing (#46800)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46800

X-link: https://github.com/facebook/yoga/pull/1716

Had a mini heart attack thinking I set the default to content box. Wrote this to double check and it passed. Might as well check it in

Technically the default to BoxSizing.h is ContentBox, but in the style we override that. Regardless I switched that around so border box was the default.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63802722

fbshipit-source-id: 49ed29657c964bc12a2bf70988061ab4599267ec
2024-10-03 12:21:16 -07:00
Peter AbbondanzoandFacebook GitHub Bot 420229d669 Disable loading XML on main thread (#46712)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46712

## Summary

Now that XML resources are loaded via Fresco decoder, this change removes the custom branch that attempts to load drawables on the main thread. Loading (i.e. binary XML decompression) is performed on a background decoder thread from Fresco the same as every other image type.

## Changelog
[Android][Fixed] - Avoid blocking the main thread when decompressing drawable resources

Reviewed By: javache

Differential Revision: D63476282

fbshipit-source-id: a8510d140f85a55b90bf4aab6fd4cf5e46dfc7fd
2024-10-03 11:41:25 -07:00
Thomas NardoneandFacebook GitHub Bot 0aef7b64dc Convert ReactClippingViewManager (#46812)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46812

Convert to Kotlin as close a 1:1 as possible.

Changelog: [Internal]

Reviewed By: alanleedev

Differential Revision: D63773448

fbshipit-source-id: 72d67ec5993ffb225b016937e6a33fc8d4a8af16
2024-10-03 11:40:41 -07:00
Cao DoanandFacebook GitHub Bot 079c0b2c87 Deprecate UIApplication.windows access (#46763)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46763

Changelog: [Internal]
[iOS][DeprecatedAPI] - Deprecate UIApplication.windows access for iOS versions higher than 13.0

> 'windows' is deprecated: first deprecated in iOS 15.0 - Use UIWindowScene.windows on a relevant window scene instead [-Werror,-Wdeprecated-declarations]

Reviewed By: cipolleschi

Differential Revision: D63708635

fbshipit-source-id: 18cfeda89def996319a46573abeb88d4672f6c0d
2024-10-03 10:44:25 -07:00
Nick GerlemanandFacebook GitHub Bot 6cf0cfb5a4 Reenable setAndroidLayoutDirection by default (#46811)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46811

I turned this off a few weeks after we turned off in FB app in (D60273063), after discovering it defeated a check used to disable `removeClippedSubviews` in RTL (reintroducing its bugged behavior).

D63318754 fixed that bug, so this is turning back on by default. This is also needed to fix border rendering direction bug introduced in BackgroundStyleApplicator in views where the contextual layout direction is different from the root Android layout direction (either because of `direction`, or `I18nManager` forceRTL). This fixes some existing RNTester RTL screenshot test failures which are hooked via forceRTL.

This also fixes rendering of some native components like `Switch` which would previously not respect contextual direction.

Changelog:
[Android][Fixed] - Reenable `setAndroidLayoutDirection` by default

Reviewed By: javache

Differential Revision: D63815077

fbshipit-source-id: fea64191d83d366c6bfc7b8c58b215773c8e8efe
2024-10-03 10:41:59 -07:00
Nick GerlemanandFacebook GitHub Bot 060c594457 Properly fix measurement of trailing newlines (#46613)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46613

https://github.com/facebook/react-native/commit/bd323929dc5be5666ee36043babec7d981a095dc added a workaround to a bug where Android new arch would return incorrect measurements when the last character in dynamically sized TextInput is a newline. This workaround works by adding a placeholder character after any trailing newlines.

Apart from a minor oversight in the impl (unnecessary `toString()` copying text on every layout), approach of mutating Spannable will create problems for `PrecomputedText`, where we want to avoid mutating Spannable after set in more common cases for normal text (though mutation must happen for a few other cases, like adjustment, or EditText).

The real root cause of the issue is that StaticLayout tries to derive the size of text for area outside of what is covered by the Spannable (whose last char is the newline, considered on the previous to last line). This causes it to use text size, family, etc from `TextPaint`, which does not have this information set in new arch (the font size (but oddly nothing else) is set in Paper).

This updates TextLayoutManager to set this information on TextPaint before creating a layout. Because TextPaint is now mutable, and TextLayoutManager can be called by multiple threads, I made the variable thread local to avoid concurrent mutation. We also have the cached Spannable scenario where we have already lost the AttributedString, but in this case, we can reuse the underlying EditText paint, which I associate with the underlying cached Spannable.

I also marked a few more methods in TextLayoutManager private which nothing else is calling, to be able to better reason.

A followup, is that `ReactTextInputManager` sets all of these extra fields on the `EditText` paint (so those will be consistent), but `ReactTextAnchorViewManager` does not set all of these, so its underlying TextView would normally show newlines with an inconsistent size compared to the attributes present (though I don't think it much matters if we add the right amount of extra space to the actual layout).

Changelog:
[Android][Fixed] - Properly fix measurement of trailing newlines

Reviewed By: cortinico, mdvacca, mellyeliu

Differential Revision: D63303172

fbshipit-source-id: 63e5e24bce7fe8866524171d9acfc8f13e1efffc
2024-10-03 10:35:10 -07:00
Nick GerlemanandFacebook GitHub Bot a11a7c3c32 Keep base TextAttributes as part of AttributedString (#46612)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46612

This information is lost by the time the AttributedString makes its way to be measured.

Pretty sure I've seen code do incorrect heuristics like grabbing first span for this (IIRC adjustFontSizeToFit does this)? Another case where we hit this on Android is when the last character is a newline (which is part of the Spannable), and layout needs to predict the size of the line which will come next (where it uses the EditText's underlying TextPaint, who is using these base attributes).

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D63303709

fbshipit-source-id: 644a97c80a9280e643514786ea6cf32faa4f1cf8
2024-10-03 10:35:10 -07:00
Peter AbbondanzoandFacebook GitHub Bot 118b7c18a6 Add custom Fresco decoder for binary XML (#46711)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46711

## Summary
Vector drawable decompression is a blocking operation and can sometimes take upwards of 20-30ms per image, especially if that vector drawable uses complex colors. Less complex vector drawables still take several milliseconds to decompress and are served from a cache on later load attempts.

Here's a list of all the load times of vector drawable images in FBVR:
 {F1891592104}

This diff aims to shift decompression to one of Fresco's decode threads, off the main thread, so we don't block while waiting for decompression operations to complete. This relies on adding a new custom decoder that reads the header of XML binary and converts encoded image requests to drawable objects that are yielded from the new `XmlDrawableFactory`.

It's important to note that this change does not stop `ReactImageView` from loading XML-based drawables on the main thread, it merely offers a new mechanism for loading them.

## Changelog
[Android][Added] - Add a new Fresco decoder for XML resource types

Reviewed By: mdvacca

Differential Revision: D63476283

fbshipit-source-id: b0f9b5af42254bcf038a9eb088e7d72dd39cdb51
2024-10-03 09:33:48 -07:00
JDMathewandFacebook GitHub Bot b0ac99b477 use unknown in Flatlist setNativeProps type for typescript >= 3.0 (#46773)
Summary:
While digging through the types I came accross this TODO. Now that react-native uses version 5 of TS this can be updated

## Changelog:

[General] [Added] - Updated FlatList setNativeProps type

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

Reviewed By: NickGerleman

Differential Revision: D63765333

Pulled By: cipolleschi

fbshipit-source-id: ad612205d168cd90f270da72092f8ce67f5038c4
2024-10-03 09:25:38 -07:00
Nicola CortiandFacebook GitHub Bot d3c7469d8c Remove several unused imports in Flow code (#46789)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46789

GitHub is reporting those warnings on each pull request. This clears them up as they're effectively unused.

Changelog:
[Internal] [Changed] - Remove several unused imports in Flow code

Reviewed By: cipolleschi

Differential Revision: D63757201

fbshipit-source-id: 21189136a03de8899adcbf18c8f0e29844ade340
2024-10-03 09:21:54 -07:00
Sam ZhouandFacebook GitHub Bot 94009f30e0 Update hermes-parser and related packages in fbsource to 0.24.0 (#46802)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46802

Bump hermes-parser and related packages to [0.24.0](https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md).

Changelog: [internal]

Reviewed By: javache

Differential Revision: D63797332

fbshipit-source-id: 98179d3cd777ff6824dfd10ceb7236a02dc6c9d6
2024-10-03 08:20:16 -07:00
Alan HughesandFacebook GitHub Bot 7487a2c277 Allow taking control of bundle loading on new arch (#46731)
Summary:
On the old architecture you could take control of loading the bundle by implementing
```objc
- (void)loadSourceForBridge:(RCTBridge *)bridge
                 onProgress:(RCTSourceLoadProgressBlock)onProgress
                 onComplete:(RCTSourceLoadBlock)loadCallback;
```
in your `RCTBridgeDelegate`. This is not currently possible in the new architecture.

I've added this using a pretty much identical api by adding a function to both the `RCTInstanceDelegate` and `RCTHostDelegate` protocols. This will be called on the `RCTRootViewFactory`. I've added two properties to the `RCTRootViewFactoryConfiguration`, `loadSourceForHost` and `loadSourceWithProgressForHost`. If one is present, we call it, otherwise we fallback to the normal loading process

## Changelog:

[iOS] [Breaking] - Add ability to control bundle loading on the new architecture similar to `loadSourceForBridge`. Removed some properties from the `RCTRootViewFactory`.

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

Test Plan: Rn-tester works as normal and it is working for our use case in expo go.

Reviewed By: blakef

Differential Revision: D63755188

Pulled By: cipolleschi

fbshipit-source-id: f1f26b2775b9e547ce7a23028665797c19bfdd9b
2024-10-03 07:12:43 -07:00
Saad NajmiandFacebook GitHub Bot 6a09fc09af Rename RCTUIGraphicsImageRenderer to RCTMakeUIGraphicsImageRenderer (#46772)
Summary:
Because `UIGraphicsImageRenderer` doesn't exist on macOS, I need to shim it for React Native macOS (See https://github.com/microsoft/react-native-macos/pull/2209). I planned to use the name `RCTUIGraphicsImageRenderer`. However.. it seems that is used by a static helper function in `RCTBorderDrawing.m`. So.. let's rename it? The function is just a helper method to make an instance of the class, so I think the name `RCTMakeUIGraphicsImageRenderer` is slightly more idiomatic anyway.

This method is not public, so it should not break the public API of React Native.

## Changelog:

[IOS] [CHANGED] - Rename `RCTUIGraphicsImageRenderer` to `RCTMakeUIGraphicsImageRenderer`

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

Test Plan: CI should pass

Reviewed By: joevilches

Differential Revision: D63765490

Pulled By: cipolleschi

fbshipit-source-id: de68dce0f92ec249ea8586dbf7b9ba34a8476074
2024-10-03 05:46:01 -07:00
Gabriel DonadelandFacebook GitHub Bot b7bcdcd8ee chore: Add changelog for 0.75.4 (#46792)
Summary:
Adds changelog for the 0.75.4 patch.

## Changelog:

[Internal] [Changed] - Add 0.75.4 changelog

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

Reviewed By: blakef

Differential Revision: D63766181

Pulled By: cipolleschi

fbshipit-source-id: f1b4e9e0676bc7dd32fe9d86386552f273fdcc75
2024-10-03 04:10:05 -07:00
Nicola CortiandFacebook GitHub Bot df396d5361 Unbreak build_android (#46806)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46806

This fixes the CI which is currently red due to wrong C++ imports.

Changelog:
[Internal] [Changed] - Unbreak build_android

Reviewed By: javache, cipolleschi

Differential Revision: D63826953

fbshipit-source-id: 4d9e407331af666a420cf56178420df40e598ef4
2024-10-03 03:40:53 -07:00
Alex HuntandFacebook GitHub Bot 19b971ff94 Remove run on iOS/Android key handlers (#46781)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46781

Implements https://github.com/react-native-community/discussions-and-proposals/discussions/821.

Changelog:
[General][Removed] - Remove "run on iOS" and "run on Android" from the dev server key commands

Reviewed By: cortinico

Differential Revision: D63534248

fbshipit-source-id: 003d4c639bbf9128f921936508a62de2caadac5e
2024-10-03 03:39:04 -07:00
Joe VilchesandFacebook GitHub Bot 5e47ef991e Back out "Plumbing to get boxSizing prop to Yoga" (#46794)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46794

Original commit changeset: f57e9a51236c

Original Phabricator Diff: D63430964

Seeing some issues with this so gonna turn it off for the meantime.

Changelog: [Internal]

Differential Revision: D63777437

fbshipit-source-id: fe8abd0110b2cf7296911c5b1e95ada40d30994c
2024-10-02 15:56:38 -07:00
Joe VilchesandFacebook GitHub Bot 32dd52e027 Back out "Add RNTester box sizing example and e2e test" (#46795)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46795

Original commit changeset: d7bb6f115bca

Original Phabricator Diff: D63471840

See previous diff, there were some problems

Changelog: [Internal]

Differential Revision: D63777438

fbshipit-source-id: ea9f370eade10282fcee84d07d709b549dde1b6d
2024-10-02 15:56:38 -07:00
Nick GerlemanandFacebook GitHub Bot 62b7396bf4 Fix onEndReached not being called when getItemLayout is present and we scroll past render window (#46736)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46736

Copying the comment in code:

> We only call `onEndReached` after we render the last cell, but when getItemLayout is present, we can scroll past the last rendered cell, and never trigger a new layout or bounds change, so we need to check again after rendering more cells.

Changelog:
[General][Fixed] - Fix onEndReached not being called when getItemLayout is present and we scroll past render window

Reviewed By: yungsters

Differential Revision: D63643856

fbshipit-source-id: 9c53789cb15b225ceac353c37cbb67f7beeaf4fb
2024-10-02 15:53:55 -07:00
Benoit GirardandFacebook GitHub Bot b3bc6ea69c Create ReactPerfLogger to log to Perfetto and Fusebox (#46793)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46793

Currently performance logging has several problems:
- We have widly different APIs. It's hard to know which to use for what.
- Most of these APIs don't allow retroactive timestamp which is important for hero logging and react flame graphs
- These APIs aren't accessible from JS/C++/Java/Koltin (this part will be fixed in another diff)
- Logging doesn't go to the right place. It either only goes to Systrace, or Perfetto but with broken async timeline etc...

This diff start addressing the problem by refactoring. Currently performance.measure/performance.mark are the best APIs. Let's start with refactoring them so that we can call them directly without the otherwise PerformanceEntry side effects.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D63560473

fbshipit-source-id: 86755b3e8491a7cf6919173a07ba9421cd30e663
2024-10-02 12:35:05 -07:00
Rubén NorteandFacebook GitHub Bot 4b82922ac5 Fix reported properties for native modules (#46788)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46788

Changelog: [internal]

This fixes the reported keys for C++ TurboModules:
```
import MyNativeCppModule from 'MyNativeCppModule';

Object.keys(MyNativeCppModule); // [] - expected
Object.keys(Object.getPrototypeOf(MyNativeCppModule)); // [] - NOT expected
```

Before, we were trying to read the properties from the method map in the public `TurboModule`, but in this implementation all the logic is actually in its delegate (also a `TurboModule` instance, yeah, confusing).

This fixes the issue by forwarding the call to the delegate that has the right information.

Reviewed By: javache

Differential Revision: D63761381

fbshipit-source-id: 90bd216efa0f60352c5ca341d210d83239c80dba
2024-10-02 12:25:06 -07:00
Samuel SuslaandFacebook GitHub Bot 7b577065a6 make sure logs reflect new class name (#46785)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46785

changelog: [internal]

Make sure logs match the class name

Reviewed By: rubennorte

Differential Revision: D63757693

fbshipit-source-id: 815e70e8ae38d99b1908d3aa2a9cfffdd9dc9851
2024-10-02 12:00:07 -07:00
Alex HuntandFacebook GitHub Bot c430083fa0 Update modern inspector targets to directly send CDP title and description (#46780)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46780

This is primarily a debugger server change to better-align the `title` and `description` fields (visible in via the CDP `/json/list` endpoint), reporting them directly from the device.

For React Native users, the net effect of this change is to improve/align the display name for each debugger target in the CLI multi-select menu (`j` to debug). This change may also be useful for discovery in non-Fusebox frontends such as VS Code (`vscode-expo` extension).

Changes:
- Rename `title` prop on `InspectorPageDescription`/`IInspector::addPage` to `description` (no call site changes).
- Add `deviceName` param to `InspectorPackagerConnection`.
- Move the page `description` to the `description` JSON field.
- Update `InspectorPackagerConnection::Impl::pages()` to return new `title` and `description` fields.
- Align `OpenDebuggerKeyboardHandler` to display `title` field.
- Deprecate the nonstandard `deviceName` field.

**Before**

```
[
    {
        "id": "3c9f24bedab0e73fca6a1b295030e7af9346a8c0-1",
        "title": "React Native Bridgeless [C++ connection]",
        "description": "com.facebook.RNTester",
         ...
    }
```

The `description` field was previously the closest thing we had to a target identifier. Today, this is not needed, since we have the stable `reactNative.logicalDeviceId` field.

**After**

```
[
    {
        "id": "3c9f24bedab0e73fca6a1b295030e7af9346a8c0-1",
        "title": "com.facebook.RNTester (iPhone 16 Pro)",
        "description": "React Native Bridgeless [C++ connection]",
         ...
    }
```

The `title` field is now more human readable and aligned with what we render in the window title of React Native DevTools. The `description` field describes the type of debugger target (the specific React Native implementation).

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D63329456

fbshipit-source-id: cfe98f77e31c729431005925cfc66e2780ef8c72
2024-10-02 07:30:31 -07:00
Samuel SuslaandFacebook GitHub Bot 07c02d4427 prevent C++ state update in RCTScrollViewComponentView if value is the same (#46782)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46782

changelog: [internal]

Avoid setting C++ state for the same contentOffset. This is redundant work and can be safely avoided.

Reviewed By: NickGerleman

Differential Revision: D63700308

fbshipit-source-id: d6ea8cf6a1da47a13787b49abd66a87e3da57d34
2024-10-02 07:28:32 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 519e07ae62 Add changelog for 0.74.6 (#46783)
Summary:
Add changelog for 0.74.6

## Changelog:
[Internal] - Add changelog for 0.74.6

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

Test Plan: N/A

Reviewed By: cortinico

Differential Revision: D63756879

Pulled By: cipolleschi

fbshipit-source-id: c36fae089c58fad49f45fa3b3380c38490d67293
2024-10-02 07:16:21 -07:00
Pieter De BaetsandFacebook GitHub Bot c06b1e9a0b Rollout destroyFabricSurfacesInReactInstanceManager (#46778)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46778

This has been rolled out internally already and is a good cleanup for OSS too. We no longer use this config externally (BRIDGE+FABRIC) so this shouldn't actually affect the new arch rollout.

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D63752084

fbshipit-source-id: da3025f7b072dc7b82f8de22ff247b3979ae64d0
2024-10-02 05:10:49 -07:00
Pieter De BaetsandFacebook GitHub Bot 17f4c45eed Add missing lock in ReactInstanceManager#attachRootView (#46776)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46776

All other paths that touch `mAttachedReactRoots` uses this lock. We expect this to address a crash we're seeing in production where `startSurface` is invoked multiple times.

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D63752083

fbshipit-source-id: f06d07aa70719945f6956fbf6e0cde3e9c8e8ed0
2024-10-02 05:10:49 -07:00
Pieter De BaetsandFacebook GitHub Bot 5b5e150eaf Fix Cxx TurboModule methods not being cached (#46751)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46751

rubennorte noticed that some turbo module methods were not getting cached on the jsRepresentation as expected. This is caused by the react-native-codegen wrappers we generate overriding the `get` method and bypassing this caching layer. Instead they should be overriding `create` to lazily allocate new properties. To prevent this from re-occuring, I've made `get` final so no other overrides can happen.

## Changelog:

[General][Fixed] Properties for C++ TurboModules using codegen were not correctly cached
[General][Breaking] TurboModule::get is now a final method, override `create` to customize property lookup

Reviewed By: rubennorte

Differential Revision: D63665966

fbshipit-source-id: c614901c2f0d698147ec9ba36a4b592ed3d37652
2024-10-02 05:10:33 -07:00
Rubén NorteandFacebook GitHub Bot 44f431b471 Make detail readonly in PerformanceMark (#46697)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46697

Changelog: [internal]

This is already the case in `PerformanceMeasure` but for some reason we didn't apply it here as well.

Reviewed By: rshest

Differential Revision: D63541134

fbshipit-source-id: 262d504ed153e07e89492945f761887729bad9e0
2024-10-02 03:13:24 -07:00
Rubén NorteandFacebook GitHub Bot 434decb409 Optimize locks in PerformanceEntryReporter (#46698)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46698

Changelog: [internal]

Small optimization to use readers/writers for locking in `PerformanceEntryReporter`.

Reviewed By: rshest

Differential Revision: D63540236

fbshipit-source-id: 80b3fd313453ad8da4f0af2deaab61a86064b4b7
2024-10-02 03:13:24 -07:00
Rubén NorteandFacebook GitHub Bot 559c6029fd Refactor Performance and PerformanceObserver internals (#46693)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46693

Changelog: [internal]

This unifies the native modules for `Performance` and `PerformanceObserver` in the same module. Keeping them separate is artificial and introduces unnecessary duplication. These APIs are very closely related so it makes sense to unify

Reviewed By: javache

Differential Revision: D63471855

fbshipit-source-id: fa8c5dc7b7c68954fc11867f68909d2c6c2ee85c
2024-10-02 03:13:24 -07:00
Rubén NorteandFacebook GitHub Bot b62ae0d02b Remove dependency to PerformanceEntryReporter singleton from RuntimeSchedulerTest (#46760)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46760

Changelog: [internal]

Relying on the singleton was causing issues in iOS tests for RuntimeScheduler. This fixes those issues.

Reviewed By: rshest

Differential Revision: D63702251

fbshipit-source-id: 42b98e673ffba6f45b52510cdb3eea410e55b894
2024-10-02 03:13:24 -07:00
Rubén NorteandFacebook GitHub Bot 0fb3c24a82 Small renames in PerformanceEntryReporter (#46688)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46688

Changelog: [internal]

Just aligns on `report*` as the public API in `PerformanceEntryReporter` (e.g.: `measure` -> `reportMeasure`, `logEventEntry` -> `reportEvent`, etc.).

Reviewed By: rshest

Differential Revision: D63471856

fbshipit-source-id: 59617160c238aaefaefe8b6fc27de4481ef32ada
2024-10-02 03:13:24 -07:00
Tim YungandFacebook GitHub Bot de927e6138 Animated: Enqueue Completion Callbacks in Microtask (#46714)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46714

Sets up a feature flag to experiment with scheduling `Animation` completion callbacks in a microtask instead of executing them synchronously. (The completion callback is the callback passed into `animation.start(<callback>)`).

There are currently 4 potential scheduling behaviors of the animation completion callback:

- Synchronously when `start()` is invoked, for spring and timing animations that immediately complete (e.g. no delays and not native driver).
- Synchronously when `stop()` is invoked, if the animation has not yet completed.
- Synchronously during the layout effect phase, or commit phase (if the `useInsertionEffectsForAnimations` feature flag is enabled), if the animation has not yet completed.
- Asynchronously when the animation completes (e.g. non-zero delay or when the native driver is employed).

The wide number of variables and the timing-dependent nature of these variables means that the behavior of the completion callback is very non-deterministic.

Imperically, we have also found that most codebases using `useNativeDriver` mostly have completion callbacks executed asynchronously. However, this leads to surprising problems where the callback causes unpredictable behavior when it is called synchronously (e.g. when the animating component is unmounted *during* the animation).

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D63573322

fbshipit-source-id: 16c48be78c9ac65a64021249fad10f7265737c44
2024-10-02 02:07:00 -07:00
Tim YungandFacebook GitHub Bot 11bf3a32e1 Animated: Rename __debouncedOnEnd to __notifyAnimationEnd (#46718)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46718

Simple rename of a protected method that should not be called by anyone outside of the `Animation` class and its subclasses, just to make it more intuitive.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D63572363

fbshipit-source-id: cf68f63a9b361767b9dbfcd73124bcdae7a1806e
2024-10-02 02:07:00 -07:00
Tim YungandFacebook GitHub Bot b519d49106 Animated: Hoist Common Logic to Parent Class (#46717)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46717

Reduces redundancy and cleans up the layers of abstraction between the `Animation` class and its subclasses, by hoisting common and duplicated logic into the parent class.

I also cleaned up the Flow types in these files while I was at it.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D63572064

fbshipit-source-id: ab6bf7265b67ab38cc5a9d5c94f8cd1456c93f23
2024-10-02 02:07:00 -07:00
Tim YungandFacebook GitHub Bot fd8cf19625 Animated: Fail Fast on Native Driver Incompatibility (#46720)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46720

Refactors the `Animation` subclasses (from Animated) such that using `useNativeDriver` with a non-native `AnimatedValue` will consistently fail when calling `start()`.

The current behavior is inconsistent because if a timing or spring animation has a non-zero delay, the error will be thrown in asynchronously in a timeout.

Changelog:
[General][Changed] - Animations started with incompatible `useNativeDriver` and `AnimatedValue` configurations will now synchronously fail. Previously, spring and timing animations with non-zero delays would throw the error asynchronously.

Reviewed By: javache

Differential Revision: D63572062

fbshipit-source-id: 2619e2867fe7754695e3347c838ad6fe136a6614
2024-10-02 02:07:00 -07:00
Tim YungandFacebook GitHub Bot 63100a9639 Animated: Simplify TimingAnimation#start Logic (#46719)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46719

Implements a minor refactor of `TimingAnimation#start` so that we standardize how the `_useNativeDriver` case is handled.

There is no behavior change from this besides more consistently assigning to `this._startTime`. (Previously, we would not set it if the duration were 0 and `!useNativeDriver`.)

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D63572066

fbshipit-source-id: 9cbd05c5ca5e00227be69441b9d7d8a502690246
2024-10-02 02:07:00 -07:00
Tim YungandFacebook GitHub Bot 85aa9278f9 Animated: Change nativeID to Private Property (#46716)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46716

Changes `_nativeId` to be a private property in the `Animation` class (from Animated).

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D63572065

fbshipit-source-id: 24facca0ccb1256f602ec4406bf8c0b22c4bbf96
2024-10-02 02:07:00 -07:00
Tim YungandFacebook GitHub Bot b3fe06b268 Animated: Change onEnd to Private Property (#46721)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46721

Currently, the `Animation` class (from Animated) defines an unofficially protected `__onEnd` property that subclasses are expected to populate. However, subclasses are expected to *not* invoke `__onEnd`, but instead call `__debouncedOnEnd`.

In order to make this code less fragile, this commit refactors the `Animation` class and its subclasses so that `onEnd` is stored in a private property and initialized by the `start` method in the `Animation` parent class. Now, the only way to invoke the `onEnd` callback is by calling `__debouncedOnEnd`.

The subclasses have been adjusted to call the `start` superclass method to initialize this.

Changelog:
[General][Changed] - The `Animation` superclass no longer exposes `__onEnd` as a property. Subclasses must instead invoke `super.start(…)` in their `start()` implementation.

Reviewed By: javache

Differential Revision: D63572063

fbshipit-source-id: 221153ca890c67c59713d607032536f57d7a5b0a
2024-10-02 02:07:00 -07:00
Tim YungandFacebook GitHub Bot fd355308fa Animated: Fix NativeAnimatedModule Mock for Jest (#46715)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46715

Properly mocks `NativeAnimatedModule` in Jest so that we can cleanup the `process.env.NODE_ENV` checks in Animated.

Changelog:
[General][Added] - Added Jest mocks for `NativeAnimatedModule`

Reviewed By: javache

Differential Revision: D63572067

fbshipit-source-id: a4fcedeebbaaa47a34bb356305652a3ed6358855
2024-10-02 02:07:00 -07:00
Tim YungandFacebook GitHub Bot 177697f539 RN: Migrate to HostInstance Type (#46742)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46742

Migrates type definitions in React Native to use the newly created `HostInstance` type instead of `NativeMethods` and `React.ElementRef<HostComponent<T>>`.

Changelog:
[General][Changed] - Simplified Flow types to use `HostInstance` (which changing nominal types).

Reviewed By: NickGerleman

Differential Revision: D63646763

fbshipit-source-id: 904894dc40da4d2e70bcb6df47018fc6248ea972
2024-10-01 22:51:48 -07:00
yungsters (Meta Employee)andFacebook GitHub Bot e24f9917c2 Define HostInstance type for React Native (#46743)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46743

Creates a new `HostInstance` type for React Native, to more accurately capture the intent most developers have when using the `NativeMethods` type or `React.ElementRef<HostComponent<T>>`.

Since `React.ElementRef<HostComponent<T>>` is typed as `React.AbstractComponent<T, NativeMethods>`, that means `React.ElementRef<HostComponent<T>>` is equivalent to `NativeMethods` which is equivalent to `HostInstance`.

Changelog:
[General][Added] - Added `HostInstance` type to represent the instance of a `HostComponent<T>`.

Test Plan:
Ran the following successfully:

```
$ cd ~/fbsource
$ js1 flow
```

Reviewed By: NickGerleman

Differential Revision: D63646555

Pulled By: yungsters

fbshipit-source-id: 075859e6b0217521ba9ab2b92843ae7e47db5be0
2024-10-01 22:51:48 -07:00
Ariel LinandFacebook GitHub Bot d4ea147b41 add support for Android's "High Text Contrast" setting into AccessibilityInfo (#46746)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46746

This change adds `isHighTextContrastEnabled()` to `AccessibilityInfo` to enable access to Android OS's "High contrast text" setting option. It also adds a new event, `highContrastTextChanged`, to enable listeners to subscribe to changes on this setting.

## Changelog

[Android][Added] - Added `isHighTextContrastEnabled()` to `AccessibilityInfo` to read `ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED` setting value

Reviewed By: NickGerleman

Differential Revision: D63155444

fbshipit-source-id: 9829b40e6c183f6beba732190dc318894e9d9a3f
2024-10-01 19:57:46 -07:00
Samuel SuslaandFacebook GitHub Bot d19a2178b6 remove use of type alias from Differentiator (#46762)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46762

changelog: [internal]

Typealias NonOwningList obscures the underlaying type and provides limited benefit. Using std::vector<ShadowViewNodePair*> is more readable.

Reviewed By: NickGerleman

Differential Revision: D63396285

fbshipit-source-id: 70cda3f33a7649cabbf5888fbefe0610d2c002b3
2024-10-01 17:31:46 -07:00
Alex HuntandFacebook GitHub Bot ebc699ce7f Tweak start command output (#46770)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46770

Small updates to the `react-native start` command CLI output:

- Change "Welcome..." text to blue.
- Display server base URL instead of port only.
- Embolden key command letters.
- "Ctrl+C to exit" prompt.
- Extra newlines for balance.

Changelog: [Internal]

Reviewed By: cortinico, cipolleschi

Differential Revision: D63328267

fbshipit-source-id: 119ddb2ba68c99df532840285c3c1f922e727e8b
2024-10-01 17:14:43 -07:00
Alex HuntandFacebook GitHub Bot df8f4d6b5d Replace and remove optional dep on cli-tools logger (#46769)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46769

(Further refactors to logging after D63255296.)

Fully decouples `community-cli-plugin` from the unlisted optional dependency on `react-native-community/cli-tools'`. This is motivated by changes in https://github.com/facebook/react-native/pull/46627 which switch to using Metro's `TerminalReporter` API for emitting logs safely.

- Swaps out logs in the dev server for the `unstable_server_log` Metro reporter event.
- Swaps out `logger.debug()` calls for the `debug` package, currently used by Metro and `dev-middleware`.
- Swaps out other logs in the `bundle` command for `console`.
- (Also specify missing `semver` dep.)

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D63328268

fbshipit-source-id: f552748ecc3456bd5fb8870c3a51d744a6bf3e70
2024-10-01 17:14:43 -07:00
Alex HuntandFacebook GitHub Bot b52bbb4d21 Simplify key handling in start command (#46768)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46768

Remove the `KeyPressHandler` util in favour of using the `process.stdin` APIs inline.

This reduces complexity (where we were effectively not using the conditional interception this previously implemented — see also https://github.com/facebook/react-native/pull/46416), and more closely mirrors our internal dev server setup.

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

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D63255321

fbshipit-source-id: 5cdf7a480053a2215fa50f544733f443bab07ef2
2024-10-01 17:14:43 -07:00
Alex HuntandFacebook GitHub Bot 7186fdeb1c Replace execa with child_process (#46767)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46767

Swaps out `execa` dependency for Node's built in `child_process`.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D63255320

fbshipit-source-id: ce7ef5e2ea78aa96c61815ff8c1e054a8f04e8b0
2024-10-01 17:14:43 -07:00
Joe VilchesandFacebook GitHub Bot e1246f04d1 Add RNTester box sizing example and e2e test (#46765)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46765

Tests are good!

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63471840

fbshipit-source-id: d7bb6f115bcae502e9f8b5ce2a12df8e850d5c26
2024-10-01 15:19:22 -07:00
Joe VilchesandFacebook GitHub Bot 39b9cf2412 Plumbing to get boxSizing prop to Yoga (#46766)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46766

tsia!

Changelog: [Internal]

Reviewed By: rozele

Differential Revision: D63430964

fbshipit-source-id: f57e9a51236cb4c7d4c284af6987f88f9c7597da
2024-10-01 15:19:22 -07:00
Joe VilchesandFacebook GitHub Bot 11ef671063 Camel case *AxisownerSize (#46744)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46744

X-link: https://github.com/facebook/yoga/pull/1714

This was annoying me :)

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63424778

fbshipit-source-id: 8f9df4e92bde251214f4c1d61ff8282d56f87816
2024-10-01 15:19:22 -07:00
Joe VilchesandFacebook GitHub Bot d06a9b356b Let flex basis support content box (#46740)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46740

X-link: https://github.com/facebook/yoga/pull/1713

The flex basis length applies to the value of `box-sizing` per the spec: https://drafts.csswg.org/css-flexbox-1/#flex-basis-property

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63424590

fbshipit-source-id: f73bffd30cc7b673453a55089ecc880819d3d788
2024-10-01 15:19:22 -07:00
Joe VilchesandFacebook GitHub Bot 353529867f Impl of content box (#46741)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46741

X-link: https://github.com/facebook/yoga/pull/1711

box sizing is really just a reinterpretation of what length properties (like `width`, `height`, `max-width`, etc) mean. So to implement this I just add the border and padding if we are in content box when we ask for any of these properties. All the math that gets done by the algorithm is still in border box land, and the layout we return is to be interpreted as the border box (this is actually the expected behavior per https://drafts.csswg.org/css-sizing/#box-sizing). This makes this implementation pretty simple actually.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63416833

fbshipit-source-id: fd76132cf51e8a5092129802c3a12ab24023018b
2024-10-01 15:19:22 -07:00
Joe VilchesandFacebook GitHub Bot 999a66b2a3 Clean up calls to dimension() with a hardcoded FlexDirection (#46739)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46739

X-link: https://github.com/facebook/yoga/pull/1710

This is a bit more clear, imo

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63408245

fbshipit-source-id: cea9723914f69d2697e18c8bfe2b55c830af2b6a
2024-10-01 15:19:22 -07:00
Joe VilchesandFacebook GitHub Bot e704f3ba9b Rename Node.h's getResolvedDimension to getProcessedDimension (#46649)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46649

X-link: https://github.com/facebook/yoga/pull/1705

To get the height and width we call a function currently named `getResolvedDimension`. This returns a `Style::Length`, which in most cases we "resolve" immediately by calling `resolve`. This is a bit confusing that you need to `resolve` something that is already `resolved`.

I plan on adding a new function soon for `contentBox` which would resolve the length for you, so I think this should be renamed.

Also deleted unused `getResolvedDimensions`

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63407730

fbshipit-source-id: e855c17d9c99817be308b7263fcb5d43559ede14
2024-10-01 15:19:22 -07:00
Nick GerlemanandFacebook GitHub Bot 267b250690 Cleanup background drawing feature flags (#46761)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46761

The legacy paths for this is all gone and non functional. We can clean thes up fully now.

Changelog: [Internal]

Reviewed By: rshest, Abbondanzo

Differential Revision: D63652264

fbshipit-source-id: cabc1af0098553c64f834e6bc30000ef7a942a4c
2024-10-01 12:46:29 -07:00
Christoph PurrerandFacebook GitHub Bot 1118cc6327 Share TextInputEventEmitter between C++ platforms (#46198)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46198

Extending on https://github.com/facebook/react-native/pull/43431 this change allows to share the TextInputEventEmitter with our C++ based platforms such as RN Windows > https://github.com/microsoft/react-native-windows/blob/main/vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.h

## Changelog:
[Internal] - Share TextInputEventEmitter between C++ platforms

Reviewed By: NickGerleman

Differential Revision: D61749959

fbshipit-source-id: 2526bf29200cd6a3dc6d5eaef5edbaf4b1df5751
2024-10-01 12:35:16 -07:00
Alex HuntandFacebook GitHub Bot aa55d765e5 Add CLI selection of multiple debug targets (#46627)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46627

IMPORTANT: Requires a Metro bump, CI will fail until updated.

Introduces a target selection API for launching React Native DevTools when more than one device is connected.

Credit to robhogan for the initial internal implementation of `OpenDebuggerKeyboardHandler`!

(This leverages recent additions to Metro's reporter API — which we should follow up on to use for the rest of `community-cli-plugin`. Notably, using `TerminalReporter` ensures server output won't conflict with Metro's own event and progress logs.)

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D63255295

fbshipit-source-id: da93500358791eabe4cab433cad31b82d518fb5f
2024-10-01 11:27:41 -07:00
Alex HuntandFacebook GitHub Bot 7c2a7de162 Bump Metro to 0.81.0-alpha.2 (#46703)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46703

Updates us in line with the release branch and unblocks https://github.com/facebook/react-native/pull/46627.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D63544047

fbshipit-source-id: 4c093e6c2fc389888f12063df013db7023761859
2024-10-01 11:27:41 -07:00
Blake FriedmanandFacebook GitHub Bot ffb10b5b4c Replace sh scripts with tested JS scripts to release template (#46363)
Summary:
The previous scripts to trigger the react-native-communty/template
release workflow has not been working. This is a rewrite is js, along
with some testing to make this more robust.

I've have a PR to combine the publish and tag steps in the template publication: https://github.com/react-native-community/template/pull/65, this takes advantage of that change.

Changelog: [Internal]

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

Test Plan:
1. Unit tests
2. Once the infrastructure lands in the `react-native-community/template` workflow, we can trigger a dry run.

## TODO:
- ~~Still needs to be used in the GH release workflow.~~
- ~~Template release workflow needs to land the dry_run input change.~~

## Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D62296008

Pulled By: blakef

fbshipit-source-id: 217326c44b1d820e36a1d847cf9ad24d228087c1
2024-10-01 11:03:36 -07:00
Rubén NorteandFacebook GitHub Bot a5e430579e Improve RNTester example for performance.mark/measure (#46759)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46759

Changelog: [internal]

This improves the example in RNTester for `performance.mark` and `performance.measure` by only listing the marks/measures explicitly emitted from the example. This removes noise if other parts of the app are logging marks/measures as well.

Reviewed By: rshest

Differential Revision: D63695731

fbshipit-source-id: f65cf59363da0e6c9e0b3ffadf05abd2eb5a214c
2024-10-01 11:03:31 -07:00
Riccardo CipolleschiandFacebook GitHub Bot eaa780de1c Fix crash for Modal not attached to window manager (#46758)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46758

There are some occurrencies where the Modal results not attached to the Window, perhaps when the app is backgrounded.

This trigger an exception `java.lang.IllegalArgumentException: View=DecorView@b9f88af[AdsManagerActivity] not attached to window manager`.\

This was fixed already but the conversion from Java to Kotlin missed a condition in the `||` clause. We are adding it back.

## Changelog
[Android][Fixed] - Fix crash for Modal not attached to window manager

## Facebook
The original fix is in this diff  D22264672 by mdvacca
Also see this post: https://fb.workplace.com/groups/rn.support/permalink/27047414764880449/

Reviewed By: cortinico

Differential Revision: D63700769

fbshipit-source-id: bc8a44868d5cacb8822e1646c2b7643682f45e1b
2024-10-01 10:59:40 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 6d6dd99ec9 Throw JS exception when calling a method if bufferedRuntimeExecutor is not initialized (#46735)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46735

We had some crash on Android where we call [`callFunctionOnModule`](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/runtime/ReactInstance.cpp#L258) when the `bufferedRuntimeExecutor_` might not be initialized. This can happen when navigating away from RN surface and quickly navigate to another one or across refreshes.

There could be a scheduled JS function from the previous surface/instance that might try to call a native module while the new instance is being created.

This change prevent the crash and replace it with a soft crash, that should show a RedBox on the screen.

## Changelog
[Internal] - Throw JS exception when calling a method if buffereRuntimeExecutor is not initialized

## Facebook
Have a look at T201983945 that generated the crash report

Reviewed By: cortinico

Differential Revision: D63638633

fbshipit-source-id: ba331f5173963265232d0810c2d12895cea3d528
2024-10-01 10:15:50 -07:00
Nicola CortiandFacebook GitHub Bot c441de5a47 Fix build warning for prepareGlog (#46756)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46756

prepareGlog was firing a warning due to a duplicate config.h file. Here I'm setting so that the file is always overridden (which is the desired behavior) to suppress this warning.

Changelog:
[Internal] [Changed] - Fix build warning for prepareGlog

Reviewed By: cipolleschi

Differential Revision: D63696664

fbshipit-source-id: 83b78afea09c4a5d39f341dd5b604cec466470ae
2024-10-01 10:04:57 -07:00
Nicola CortiandFacebook GitHub Bot 3cd46b9534 Do not reference setTranslucentBackgroundDrawable (#46754)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46754

This method has been deprecated since 0.76, but we're still using it inside our codebase.
I'm cleaning up the only usage of it replacing it with the implementation.

Changelog:
[Internal] [Changed] - Do not reference `setTranslucentBackgroundDrawable`

Reviewed By: cipolleschi

Differential Revision: D63695933

fbshipit-source-id: d39b13b584d3ac1406c61c3bf86b86b05dc984d9
2024-10-01 10:04:57 -07:00
Nicola CortiandFacebook GitHub Bot eb3d352761 RNGP - Do not apply java-gradle-plugin on root build (#46755)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46755

There is no need to apply `java-gradle-plugin` to the root build of RNGP as that does not contain any Gradle Plugins (they're in subfolders).

This is actually causing the build to be a bit slower as extra tasks for compilation/bundling will be created which are definitely not needed.

Changelog:
[Internal] [Changed] - RNGP - Do not apply `java-gradle-plugin` on root build

Reviewed By: cipolleschi

Differential Revision: D63695934

fbshipit-source-id: 84268105c73b49afdcd94610fcb7006ef53306a4
2024-10-01 10:04:57 -07:00
Nicola CortiandFacebook GitHub Bot 41c6ad5597 Fix NPE on ReactTextInputManager.setTextDecorationLine (#46750)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46750

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

Fix is pretty straightforward, parameter is annotated as Nullable, but is accessed with a `.split` call.
This causes a crash when the `textDecorationLine` property is removed (i.e. is null).

Changelog:
[Android] [Fixed] - Fix NPE on ReactTextInputManager.setTextDecorationLine

Reviewed By: cipolleschi

Differential Revision: D63689492

fbshipit-source-id: 3424897cc40beaeb579e3affd0a87656ff43afee
2024-10-01 09:20:53 -07:00
Pieter De BaetsandFacebook GitHub Bot 4ede9205a0 Fix BoxShadow support for platform colors (#46753)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46753

Colors can be more than just ints, so we need to use `ColorPropConverter` to convert it correctly. For ViewManagers, this happens automatically through the ReactProp annotation, but since this is a nested field, we need to manually apply it.

Changelog: [Android][Fixed] BoxShadow now supports platformColor.

Reviewed By: fabriziocucci

Differential Revision: D63693048

fbshipit-source-id: 26b1da24db1b6f319af8cef6f62e4739c3f65ee3
2024-10-01 08:30:25 -07:00
Oskar KwaśniewskiandFacebook GitHub Bot d24507611d feat(iOS): expose RCT_NEW_ARCH_ENABLED to Swift (#46749)
Summary:
This PR exposes `RCT_NEW_ARCH_ENABLED` flag to Swift.

It allows you to use conditional compilation:

```swift
#if RCT_NEW_ARCH_ENABLED
func test() {
	print("I'm running on new arch!)
}
#else
func test() {
	print("I'm running on old arch!)
}
#endif
```

## Changelog:

[IOS] [ADDED] - expose RCT_NEW_ARCH_ENABLED to Swift

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

Test Plan: CI Green

Reviewed By: cortinico

Differential Revision: D63689711

Pulled By: cipolleschi

fbshipit-source-id: 706013019571f597d1966ffcf13bd47ba7f29a2d
2024-10-01 07:59:25 -07:00
Alex HuntandFacebook GitHub Bot 80122678e0 Simplify FuseboxReactDevToolsDispatcher diagram and document inline (#46737)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46737

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D63637626

fbshipit-source-id: 314ec6dc6eff8d458beba84e49d5aaca3d192087
2024-10-01 06:50:49 -07:00
Alex HuntandFacebook GitHub Bot 82f4e1714d Reorganise debugger modules in src/private/ (#46738)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46738

Combines modules previously under `fusebox` and `reactdevtools` directories into a single `src/private/debugging/` directory.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D63637625

fbshipit-source-id: 58add7fa3b6553c33d59e785563b24d57b7db547
2024-10-01 06:50:49 -07:00
Pieter De BaetsandFacebook GitHub Bot 390925ea39 Add StrictAnimatedProps to fix missing Animated types (#46659)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46659

The current `AnimatedProps` maps all types to `any` which prevents us from catching many types of issues. Introduce an alternative variant which we can adopt incrementally which enforces the underlying types.

Changelog: [General][Fixed] Improved types for AnimatedProps

Reviewed By: SamChou19815

Differential Revision: D63315760

fbshipit-source-id: 718fc2754cc99891e490a48d7792f626205c37e4
2024-10-01 06:29:51 -07:00
Cedric van PuttenandFacebook GitHub Bot 39c98fb8f8 fix(react-native-codegen): upgrade jscodeshift@17.0.0 to resolve outdated dependencies (#46724)
Summary:
This upgrades `jscodeshift` from `0.14.0` to `17.0.0`, to resolve unsupported babel dependencies when installing React Native. See https://github.com/expo/expo/issues/31613

## Changelog:

[GENERAL] [FIXED] - Upgrade Codegen dependency `jscodeshift@17.0.0` to resolve outdated dependencies

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

Test Plan:
To test it out yourself:

- `npx create-expo@latest ./test-codegen`
- `cd ./test-codegen`
- `npm why babel/plugin-proposal-nullish-coalescing-operator@7.18.6 | grep codegen` - [npm deprecation](https://www.npmjs.com/package/babel/plugin-proposal-nullish-coalescing-operator/v/7.18.6)
- `npm why babel/plugin-proposal-class-properties@7.18.6 | grep codegen` - [npm deprecation](https://www.npmjs.com/package/babel/plugin-proposal-class-properties/v/7.18.6)
- `npm why rimraf@2.6.3 | grep codegen` - [npm deprecation](https://www.npmjs.com/package/rimraf/v/2.6.3)
- `npm why babel/plugin-proposal-optional-chaining@7.21.0 | grep codegen` - [npm deprecation](https://www.npmjs.com/package/babel/plugin-proposal-optional-chaining/v/7.21.0)

> [!IMPORTANT]
> There are other dependencies that require an update, unfortunately there are no flow typings available (yet).
> - `npm why glob@7.2.3 | grep codegen` - [npm deprecation](https://www.npmjs.com/package/glob/v/7.2.3)

Reviewed By: cortinico

Differential Revision: D63629133

Pulled By: huntie

fbshipit-source-id: 3799e49677b8e5fd64841e6c7f855bde10e15072
2024-10-01 05:14:16 -07:00
Nicola CortiandFacebook GitHub Bot 290258f00f Further Reduce Build Warnings (#46733)
Summary:
This further reduces the build warning coming from the Hermes build, which we can't do much about as we don't own that code.

## Changelog:

[Internal] [Changed] - Further Reduce Build Warnings

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

Test Plan: CI

Reviewed By: NickGerleman

Differential Revision: D63644753

Pulled By: cortinico

fbshipit-source-id: d0e65559715ac1fa2b920f4c3d3cf63b6171765d
2024-10-01 02:47:59 -07:00
Tim YungandFacebook GitHub Bot 223e98cc4b RN: Remove String Refs from NativeMethods (TS) (#46734)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46734

The TypeScript definition for `NativeMethods` defined a `refs` property for referencing component instances by string refs.

String refs are deprecated and support is being formally dropped in React 19.

This removes the obsolete type definition.

Changelog:
[General][Removed] - Removed `refs` property from `NativeMethods` TypeScript definition.

Reviewed By: NickGerleman

Differential Revision: D63640881

fbshipit-source-id: 82148ac91bd44d63da9a41b1d1dcebb7ca32a5bd
2024-09-30 14:54:51 -07:00
Eli WhiteandFacebook GitHub Bot 86cac68365 Promise annotations must specify their elementType (#46727)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46727

It makes scripts operating on the schema complicated when the elementType might be there or might not. Let's make it required, but VoidTypeAnnotation if it's unknown.

Arguably we shouldn't allow it to be unknown at all, but that's out of scope here.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D63616703

fbshipit-source-id: 290586384b911928e55344aa522bd296f23a074c
2024-09-30 11:19:44 -07:00
Eli WhiteandFacebook GitHub Bot ad380c011f Add test for Object with indexers (#46726)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46726

An object isn't allowed to have both an indexer and regular properties. Previously, the schema just wouldn't include the properties and would only include the indexer. Instead of failing silently and not generating the expected code, let's explicitly error out.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D63615090

fbshipit-source-id: a4c881b7a809f0b467509f7f7e2131be59ee274e
2024-09-30 11:19:44 -07:00
Eli WhiteandFacebook GitHub Bot c658e87518 Add a test for an Alias to an Alias (#46725)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46725

This covers types that deeply alias.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D62926913

fbshipit-source-id: 2fea1900f1be2893230a949db6778c76afae0423
2024-09-30 11:19:44 -07:00
Pieter De BaetsandFacebook GitHub Bot 544c4ff75b Use HybridClassBase for frequently constructed objects (#46706)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46706

Simplifies object construction and collection, and avoids additional JNI roundtrips to set HybridData.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D63537781

fbshipit-source-id: 55df2785840ec8fcd5a7a08d2c7dd73c5b5fca82
2024-09-30 09:59:52 -07:00
Frank CaliseandFacebook GitHub Bot e12c0d9551 fix(dev-menu): export for react-native package (#46723)
Summary:
In an effort to achieve a similar API in the new architecture, I was trying to replace the following code from the old architecture:
```
import { NativeModules } from 'react-native'
// ...
NaiveModules.DevMenu.show()
```

After https://github.com/facebook/react-native/issues/46694 landed, you can achieve this with the following import in the new architecture:
```
// ts-ignore
import DevMenu from "react-native/Libraries/NativeModules/specs/NativeDevMenu"

// and then use it
DevMenu.show()
```

However, this change provides the interface for `DevMenu` from the `react-native` package, similar to the API for `DevSettings`, making it easier to use via the public API and better type support.

```
import { DevMenu } from 'react-native'
DevMenu.show()
```

## Changelog:

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

Pick one each for the category and type tags:

[GENERAL] [ADDED] - Export `DevMenu` from `react-native`

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

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

Test Plan:
<img width="750" alt="image" src="https://github.com/user-attachments/assets/dc5a9876-4364-473e-9fd8-c49484d6de01">

### Before
`any` type on `show` from the private import
<img width="226" alt="image" src="https://github.com/user-attachments/assets/45a085d2-9794-482d-b5ec-3b882aadb56b">

### After
typed show method from the new import
<img width="399" alt="image" src="https://github.com/user-attachments/assets/7c7587b3-499b-40f0-8262-126e4ec17dc6">

Reviewed By: cortinico

Differential Revision: D63631196

Pulled By: huntie

fbshipit-source-id: a00efa85c8ca1aa127c9ae0a059978ba5eadb376
2024-09-30 09:22:52 -07:00
Rick HanlonandFacebook GitHub Bot cbb313253f Fix errors with component stacks reported as warnings (#46637)
Summary:
Ok so this is a doozy.

## Overview
There was a report that some console.error calls were being shown as warnings in LogBox but as console.error in the console. The only time we should downlevel an error to a warning is if the custom warning filter says so (which is used for some noisy legacy warning filter warnings internally).

However, in when I switched from using the `Warning: ` prefix, to using the presence of component stacks, I subtly missed the default warning filter case.

In the internal warning filter, the `monitorEvent` is always set to something other than `unknown` and if it's set to `warning_unhandled` then `suppressDialog_LEGACY` is always false.

However, the default values for the warning filter are that `monitorEvent = 'unknown'` and `suppressDialog_LEGACY = true`. In this case, we would downlevel the error to a warning.

## What's the fix?
Change the default settings for the warning filter.

## What's the root cause?

Bad configuration combinations in a fragile system that needs cleaned up, and really really bad testing practices with excessive mocking and snapshot testing (I can say that, I wrote the tests)

## How could it have been caught?
It was, but I turned off the integration tests while landing the component stack changes because of mismatches between flags internally and in OSS, and never turned them back on.

Changelog: [General] [Fixed] - Fix logbox reporting React errors as Warnings

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

Reviewed By: huntie

Differential Revision: D63349613

Pulled By: rickhanlonii

fbshipit-source-id: 32e3fa4e2f2077114a6e9f4feac73673973ab50c
2024-09-30 09:15:04 -07:00
Oskar KwaśniewskiandFacebook GitHub Bot fbda60e657 feat(iOS): refactor RCTDevLoadingView to use constraints (#46621)
Summary:
This PR refactors the RCTDevLoadingView to use constraints instead of explicitly defining frames.

Now the code looks like this:

```
#if TARGET_OS_MACCATALYST
      self->_window.frame = CGRectMake(0, window.safeAreaInsets.top, windowWidth, 20);
      self->_label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, windowWidth, 20)];
#else
      self->_window.frame = CGRectMake(0, 0, windowWidth, window.safeAreaInsets.top + 10);
      self->_label = [[UILabel alloc] initWithFrame:CGRectMake(0, window.safeAreaInsets.top - 10, windowWidth, 20)];
#endif
```

When working with visionOS I quickly found my self in the need of adding additional else there...

This PR uses constraints to layout the views correctly for every device.

| Device         | Screenshot |
| -------------- | ---------- |
| iOS | <img src="https://github.com/user-attachments/assets/decc146e-41a2-4ce8-bafd-77c77a39398b" width="200"/> |
| macOS Catalyst | <img src="https://github.com/user-attachments/assets/78ef4946-a6dc-49a2-864e-a483577798f1" width="200"/> |
| iPadOS | <img src="https://github.com/user-attachments/assets/a15bd1a8-84ae-47d0-becb-e14c3a9352d4" width="200"/>  |
| visionOS | <img src="https://github.com/user-attachments/assets/d74f0607-837e-4f7b-b924-fc6fce80d763" width="200"/>  |

## Changelog:

[IOS] [CHANGED] - refactor RCTDevLoadingView to use constraints

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

Test Plan: Test if DevLoading view is properly showing up

Reviewed By: blakef

Differential Revision: D63383002

Pulled By: cipolleschi

fbshipit-source-id: b17499e12d4a882facce4c45b1cc22eb43ea3bb1
2024-09-30 08:26:45 -07:00
evanbaconandFacebook GitHub Bot 4caf548a9f add missing iOS platform colors (#46730)
Summary:
- add missing platform colors on iOS https://developer.apple.com/documentation/uikit/uicolor/standard_colors

## Changelog:

[IOS] [ADDED] - Add `systemCyan` and `systemMint` colors on iOS

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

Test Plan:
- Ran it in an iOS app (text is no longer black)

![Simulator Screenshot - iPhone 15 Pro - 2024-09-30 at 15 31 30](https://github.com/user-attachments/assets/2f1d337c-d5f3-40d6-8e58-fdccb94603fd)

Reviewed By: cortinico

Differential Revision: D63635182

Pulled By: cipolleschi

fbshipit-source-id: b6fa3ff0e38630d820aacedbf88dfe9bd13c0644
2024-09-30 08:12:41 -07:00
shubhamguptadream11andFacebook GitHub Bot 5c7a166dca fix(iOS): title and title color handling added for refresh control (#46655)
Summary:
Solve a part of this issue:  https://github.com/facebook/react-native/issues/46631

## 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] [CHANGED] - Passed correct title and titleColor prop to updateTitle function

**What's the Issue:**
When updating the PullToRefreshViewProps in a React Native iOS app, changes to the title and titleColor were not being reflected properly in the RefreshControl. This happened because the function responsible for updating the title (_updateTitle) was not always receiving the correct or updated values for title and titleColor.

**Updated `_updateTitle` function:**

The _updateTitle method was modified to accept both title and titleColor as parameters. This ensures that the latest values are always used when updating the refresh control's attributedTitle.
If the title is empty, the attributedTitle is cleared by setting it to nil. Otherwise, both the title and titleColor (if present) are applied correctly.

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

Test Plan:
**Without fix:**
https://github.com/user-attachments/assets/8a83c247-bf78-4080-bdc1-ac5a852481e8

**With Fix:**
https://github.com/user-attachments/assets/52e2495a-4419-41d1-b308-acb64600f9f7

Reviewed By: javache

Differential Revision: D63466516

Pulled By: cipolleschi

fbshipit-source-id: fef61a003b658b20a25b61b6d07ee9fe0750dae7
2024-09-30 08:04:36 -07:00
Pieter De BaetsandFacebook GitHub Bot 18faf68b48 Rename Binding to FabricUIManagerBinding (#46705)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46705

We have multiple classes in React Native Android acting as a binding layer (between C++ and Java, between C++ and JS). Make it more obvious this Binding is for (Android) FabricUIManager and flatten the (now) unused Binding interface.

Changelog: [Android][Removed] BindingImpl is no longer part of the public interface

Reviewed By: cortinico

Differential Revision: D63536329

fbshipit-source-id: 329d184c1889fbe804995211cdd339b50a7c9234
2024-09-30 07:31:56 -07:00
Pieter De BaetsandFacebook GitHub Bot 8dd616410d Make more SurfaceHandler configuration go through UIManager Binding (#46701)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46701

Reduce the interface we expose in SurfaceHandler(Binding), and concentrate the logic in the FabricUIManager Binding.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D63536328

fbshipit-source-id: 5882bdd24fd3ca8f3d36210dca80587fee091dcf
2024-09-30 07:31:56 -07:00
Riccardo CipolleschiandFacebook GitHub Bot aa35a21714 Fix the generation of .xcode.env.local (#46661)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46661

The previous approach was brittle and it was not working in all the scenarios.

This is the same approach used [by Expo](https://github.com/expo/expo/blob/12f24ea7fdbc8bab864d7852ae8e7275e44db4df/packages/expo-modules-autolinking/scripts/ios/xcode_env_generator.rb#L37C44-L37C75) (thanks guys! :D) and it looks like it is more stable.

This should definitely fix [#43285](https://github.com/facebook/react-native/issues/43285).

## Changelog
[Internal] - Fix the generation of .xcode.env.local

Reviewed By: cortinico

Differential Revision: D63460707

fbshipit-source-id: c6732adce3df5f8365b17ed9c500c38f773ecee5
2024-09-30 06:03:22 -07:00
Samuel SuslaandFacebook GitHub Bot 4e38493d71 delete state alignment mechanism (#46658)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46658

changelog: [internal]

We are shipping a better solution: Runtime Shadow Node Reference Syncing which is being rolled out.

Reviewed By: lenaic, rubennorte

Differential Revision: D63456344

fbshipit-source-id: e70b7dd4be7bf0670366e5200a910195b929a14d
2024-09-30 04:59:49 -07:00
Nicola CortiandFacebook GitHub Bot d1f47f7ad5 Silence unnecessary Gradle outputs - Part 1 (#46704)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46704

Our build log for Gradle is extremely noisy due to Hermes.
Here I'm suppressing all the build output from Hermes as we can't really do much from that side of the build.

This should make it easier for folks on GitHub Actions to immediately spot where are failures.

Changelog:
[Internal] [Changed] - Silence unnecessary Gradle outputs

Reviewed By: GijsWeterings

Differential Revision: D63541175

fbshipit-source-id: d1a60098c317ff9e8c9575b5b8b2aab639f28f2f
2024-09-30 03:55:54 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot fae572d815 Fix mixBlendMode not updating on Image state updates (#46680)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46680

Since the parent of a view with mixBlendMode prop set is the one responsible for setting the compositing of the child, when updating mixBlendMode on a child we need to also invalidate the parent.

Changelog: [Android] [Fixed] - mixBlendMode now properly does state updates

Reviewed By: joevilches

Differential Revision: D63424394

fbshipit-source-id: 0eb15520f1087e25683853632943e64a66344481
2024-09-29 22:59:28 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot d2c48f3b1a Remove experimental_ and cleanup mixBlendMode experiment (#46650)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46650

tsia

Changelog: [General] [Added] - Removed `experimental` prefix and fully released `mixBlendMode` prop

Reviewed By: joevilches

Differential Revision: D63407473

fbshipit-source-id: 892ababcfe19b82d3f4c73d3cbc13fb46b7425b6
2024-09-29 22:59:28 -07:00
Nick GerlemanandFacebook GitHub Bot 513e9669e7 Fix interactions between removeClippedSubviews and RTL by applying HorizontalScrollContentView translation during layout metric assignment (#46685)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46685

This attempts a similar fix to D59566611, but keeps the removedClippedSubviews logic as is, instead moving the current translation done in ReactHorizontalScrollContainerView onLayout to ShadowNode layout metric assignment (so the world is consistent from very early on, and `removeClippedSubviews` never sees coordinates before translation),

I suspect doing this at the ShadowNode layer might also result in some fixes to DevTools in RTL.

This should let us roll out setAndroidLayoutDirection again.

Changelog:
[Android][Fixed] - Fix interactions between removeClippedSubviews and RTL

Reviewed By: mdvacca

Differential Revision: D63318754

fbshipit-source-id: 828e103e2ad21c7e886e39c163474b10ebd5099e
2024-09-27 19:19:53 -07:00
Nick GerlemanandFacebook GitHub Bot a396f6c49b Back out "Do not hold raw RuntimeScheduler pointer in BufferedRuntimeExecutor"
Summary:
A crash we are getting in the wild suggests that destruction on weak ref count going away may be delaying RuntimeExecutor task destruction to a point where jsi::Function is invalid. Let's try backing D62748768 out and seeing if the crash goes away.

Changelog:
[General][Fixed] - Attempt to fix crash from delayed RuntimeExecutor task destruction

#bypass-github-export-checks

Reviewed By: mdvacca

Differential Revision: D63568504

fbshipit-source-id: 6152e7293902d0eb67a14c5840bea56561c35b08
2024-09-27 18:19:45 -07:00
Panos VekrisandFacebook GitHub Bot d75e917753 Deploy 0.247.1 to xplat (#46710)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46710

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D63560047

fbshipit-source-id: a43ac647fee12115c794aa8002bd340a4c4bcf16
2024-09-27 15:27:53 -07:00
zhongwuzwandFacebook GitHub Bot 7c60a65ace Fabric: Fixes animations strict weak ordering sorted check failed (#46582)
Summary:
Fixes https://github.com/facebook/react-native/issues/46568 . cc cipolleschi

## Changelog:

[IOS] [FIXED] - Fabric: Fixes animations strict weak ordering sorted check failed

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

Test Plan:
See issue in  https://github.com/facebook/react-native/issues/46568

## Repro steps
- Install Xcode 16.0
- navigate to react-native-github
- yarn install
- cd packages/rn-tester
- bundle install
- RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
open RNTesterPods.xcworkspace to open Xcode

{F1885373361}

Testing with Reproducer from OSS
|  Paper |  Fabric (With Fix) |
|--------|-----------------|
| {F1885395747} | {F1885395870} |

Android - LayoutAnimation (Looks like it has been broken and not working way before this changes.)
 https://pxl.cl/5DGVv

Reviewed By: cipolleschi

Differential Revision: D63399017

Pulled By: realsoelynn

fbshipit-source-id: aaf4ac2884ccca2da7e90a52a8ef10df6ae4fc8a
2024-09-27 13:11:45 -07:00
Alex HuntandFacebook GitHub Bot d17373c4ef Require Flow types in all react-native source files (#45786)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45786

Following D60377082, `packages/react-native/Libraries/` is now 100% parsable by `flow-api-translator` and covered by `flow-api-test`. This diff increases test strictness to preserve this state going forward.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D60377123

fbshipit-source-id: 8c48bdd73d9d0d97a114d553eb70cc01faf18e89
2024-09-27 12:02:37 -07:00
Alex HuntandFacebook GitHub Bot 776e822db5 Add minimal Flow types to remaining files under Libraries/ (#45785)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45785

Adds `flow` annotation, and/or adds minimal Flow types to remaining files under `packages/react-native/Libraries/`. As of this diff, 100% of this directory is now parsable by `flow-api-translator` and covered by `public-api-test`.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D60377082

fbshipit-source-id: 67e8acafc3fdd8f107f1d8d53c69ee6c27d3ed0a
2024-09-27 12:02:37 -07:00
Alex HuntandFacebook GitHub Bot 33b78ee080 Substitute babel-preset-fbjs for metro-transform-plugins (#46689)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46689

Resubmission of D61014834 / https://github.com/facebook/react-native/pull/45959 (previously reverted).

> Addresses TODO comment. I noticed this lone reference to babel-preset-fbjs (last published 3y ago) while attempting to upgrade our Babel Flow syntax plugin.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D63532211

fbshipit-source-id: e94b55b7b61194b50131b36a2fe817e149152953
2024-09-27 10:36:42 -07:00
Alex HuntandFacebook GitHub Bot 64381d3569 Switch to hermes-parser in eslint-config
Summary:
Similar to D63541483, modernises our Flow syntax support for our published ESLint config to use `hermes-eslint` (`hermes-parser`).

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D63541856

fbshipit-source-id: 06cc5725faf5934fda07713ec1dac54ff9c32ddf
2024-09-27 10:20:19 -07:00
Alex HuntandFacebook GitHub Bot 1387f521fd Switch Babel parsing from legacy Flow plugin to hermes-parser (#46696)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46696

Following D62161923, we began to lose sync with modern Flow syntax when Metro's `transformer.hermesParser` option is disabled. This config option loads Babel for transformation (instead of `hermes-parser`), which requires a Babel plugin to parse (not strip) Flow syntax.

This diff migrates us away from `babel/plugin-syntax-flow` (see also https://github.com/babel/babel/issues/16264) and uses the modern [`babel-plugin-syntax-hermes-parser`](https://www.npmjs.com/package/babel-plugin-syntax-hermes-parser) instead (a component of the modern Hermes Parser stack).

Following this change, new projects that unset `transformer.hermesParser` will compile.

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

Changelog:
[General][Fixed] - Fix parsing of modern Flow syntax when `transformer.hermesParser = false` is configured in Metro config

Reviewed By: cipolleschi

Differential Revision: D63535216

fbshipit-source-id: d2c6ddec030d89e2698e03b76194cf3568d04e6b
2024-09-27 10:20:19 -07:00
Alex HuntandFacebook GitHub Bot dc8bc45cfa Switch to hermes-parser in eslint-* package tests (#46699)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46699

Switch from legacy Babel Flow parser integrations to the Meta-maintained `hermes-eslint` and `babel-plugin-syntax-hermes-parser` packages (both part of the `hermes-parser` codebase).

Required to unblock D63535216.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D63541483

fbshipit-source-id: 04ccfa04c9a2b8c0a87ef1a5c38e952971838b77
2024-09-27 10:20:19 -07:00
Nicola CortiandFacebook GitHub Bot 6eb21ca1fb RNGP: Read enableWarningsAsErrors property correctly (#46657)
Summary:
I've noticed that some users are reporting build failures due to warnings inside RNGP.
We do have `allWarningsAsErrors` set to true for everyone (also for users).
That's too aggressive, and can cause build failures which are not necessary. Let's keep it enabled only on our CI (when the `enableWarningsAsErrors` property is set).

## Changelog:

[INTERNAL] - RNGP: Read `enableWarningsAsErrors` property correctly

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

Test Plan: CI

Reviewed By: NickGerleman

Differential Revision: D63459601

Pulled By: cortinico

fbshipit-source-id: 0307e8d6771518038a5abe27ca5a993cb0a9f8c0
2024-09-27 08:40:14 -07:00
Pieter De BaetsandFacebook GitHub Bot 43af902693 Unbreak Android LayoutAnimation by making all surfaces go through Binding (#46691)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46691

In Bridgeless, ReactSurface would only call `registerSurface` when it started, which did not match the behaviour seen in startSurface(WithConstraints). Instead, make all calls to start the surface go through the FabricUIManager Binding so we can correctly configure `setMountingOverrideDelegate` which is required for layout animations.

Changelog: [Android][FIxed] LayoutAnimations work on full new architecture

Reviewed By: cortinico

Differential Revision: D63533635

fbshipit-source-id: f6d3db020bb2d7245f7b14f2407271d76837d40c
2024-09-27 08:32:31 -07:00
Ruslan LesiutinandFacebook GitHub Bot 459fadce77 Use native module to persist RDT settings (#46663)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46663

# Changelog: [Internal]

Now we can use the native module for persisting settings in React DevTools. Basically, this diff adds read / write implementations.

Reviewed By: huntie

Differential Revision: D62967060

fbshipit-source-id: c14ef056c8d7e30a23d2b84d1ad4fc0ad8eaaf34
2024-09-27 08:12:45 -07:00
Ruslan LesiutinandFacebook GitHub Bot d336a7c9c6 fix: pass closest public instance to React DevTools (#46664)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46664

# Changelog: [Internal]

Please see https://github.com/facebook/react/pull/31068.

Synced changes for React Native - D63453667.

Reviewed By: huntie

Differential Revision: D63421463

fbshipit-source-id: e455711206598a06f7cdce4150e79c3548843b99
2024-09-27 08:12:45 -07:00
Ruslan LesiutinandFacebook GitHub Bot 37756d7de5 fix: ReactDevToolsSettingsManagerModule in ReactModuleList for android (#46665)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46665

# Changelog: [Internal]

Looks like this module was missing on android for a while.

Reviewed By: huntie

Differential Revision: D63460309

fbshipit-source-id: 7146e7f2104f868d0f2b7271bd2c452608611ea3
2024-09-27 08:12:45 -07:00
Ruslan LesiutinandFacebook GitHub Bot cf491d769f Libraries/DevToolsSettings -> private/reactdevtools/ReactDevToolsSettings (#46662)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46662

# Changelog: [Internal]

This should not have been a public API in the first place.

1. Moving this to `src/private`.
2. Removed some unused APIs, such as profiling settings.

Reviewed By: huntie

Differential Revision: D62965492

fbshipit-source-id: fb97eccaf647ce418f500b02d153263aa8632eee
2024-09-27 08:12:45 -07:00
Ruslan LesiutinandFacebook GitHub Bot 53b7f0e764 upgrade React Native on a new RDT backend (#46669)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46669

# Changelog: [Internal]

In React DevTools 6.0.0, settings manager is [no longer used](https://github.com/facebook/react/pull/30986), because the host of the Backend is responsible for settings persistance.

Also, `installHook()` call was removed from the top level of the JavaScript module and now we need to call `initialize()` explicitly.

The logic for persisting settings will be added in one of the next diffs at the top.

Reviewed By: huntie

Differential Revision: D62967059

fbshipit-source-id: 5022546aab02540f38c8d2e2f2e7dfeb82863f3f
2024-09-27 08:12:45 -07:00
Ruslan LesiutinandFacebook GitHub Bot 6173d6ca42 Update debugger-frontend from e8c7943...87b2feb (#46673)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46673

Changelog: [Internal] - Update `react-native/debugger-frontend` from e8c7943...87b2feb

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

Reviewed By: huntie

Differential Revision: D63455520

fbshipit-source-id: 07776c17f368e895a2d526cbb9abb8e1104bb29c
2024-09-27 08:12:45 -07:00
Ruslan LesiutinandFacebook GitHub Bot ed4f6d6891 upgrade[react-devtools-core]: 6.0.0 (#46670)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46670

# Changelog:
[General] [Changed] - upgrade React DevTools to 6.0.0.

allow-large-files

Reviewed By: huntie

Differential Revision: D63460308

fbshipit-source-id: 159b0a0a074aae52c3710730a4fc2cbccb04970d
2024-09-27 08:12:45 -07:00
Nicola CortiandFacebook GitHub Bot 1bdae07d89 Add Android implementation for DevMenu Module (#46694)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46694

The DevMenu module was never implemented on Android. This adds its implementation by mirroring the iOS implementation.

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

Changelog:
[Android] [Fixed] - Add missing Android implementation for DevMenu Module

Reviewed By: cipolleschi

Differential Revision: D63535172

fbshipit-source-id: 791e72b46b7d3264b98e85a73f2d9025dc3a2c7d
2024-09-27 07:49:52 -07:00
zhongwuzwandFacebook GitHub Bot 8bfd7e1039 Fixes Appearance getColorScheme sync method UI thread issue (#46344)
Summary:
If the module sets the method queue to the main queue, we should call it on the main queue if it contains some UI operations, otherwise it may lead to some undefined behavior.

## Changelog:

[IOS] [FIXED] - Fixes the exported synchronous method not being called on the method queue when it's the main queue

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

Test Plan: The sync method should be called on the main queue if the module's method queue is main queue.

Reviewed By: cipolleschi

Differential Revision: D63532525

Pulled By: javache

fbshipit-source-id: 55baaa60af96bb1355d3641174f23bccd8eb9344
2024-09-27 06:47:53 -07:00
Blake FriedmanandFacebook GitHub Bot 8237e237ce cli: fix init when called as npx react-native init (#46677)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46677

Since removing `react-native-community/cli` as a dependency in 0.76 the `npx react-native init` command isn't working.  This is the deprecated way to run this command, but users should still expect it to work for now.

This now forks this kind of request to `npx react-native-community/cli init <args>` as described in the warning logs to the user.

Changelog: [Internal]

Issue: reactwg/react-native-releases#508

Reviewed By: cortinico

Differential Revision: D63467046

fbshipit-source-id: 84560bdae8d6f62629dee61da3cbbf544b9a83b2
2024-09-27 03:38:19 -07:00
Nicola CortiandFacebook GitHub Bot 12dda31bc1 fix: ReactDelegate crashing New Architecture apps by invoking setContentView (#46671)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46671

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

Currently `ReactFragment` and `ReactDelegate` don't work in OSS + New Architecture because we call `Activity.setContentView`
on the host activity.

That result on us replacing the whole activity layout, even when the user wants to use a Fragment.
As we do have `ReactActivityDelegate` that already does this:
https://github.com/facebook/react-native/blob/94b77938435693792e57c96d76691d58d7361530/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java#L138

So this call is unncessary.

I've also updated the relative documentation here:
https://github.com/facebook/react-native-website/pull/4232

Changelog:
[Android] [Fixed] - fix: ReactDelegate/ReactFragment crashing on New Architecture apps

Reviewed By: rozele

Differential Revision: D63464367

fbshipit-source-id: acbfbf7d68eb79657b811a5a9a0d3f72660ec94a
2024-09-27 01:49:38 -07:00
Nicola CortiandFacebook GitHub Bot 7176d11ce4 ReactFragment should properly instantiate ReactDelegate on Bridgeless (#46623)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46623

I've just noticed that ReactFragment is not properly instantiating the `ReactDelegate` with a ReactHost
when on Bridgeless. This causes Fragments to crash when the app is on bridgeless mode.

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

Changelog:
[Android] [Fixed] - ReactFragment should properly instantiate ReactDelegate on Bridgeless

Reviewed By: mdvacca

Differential Revision: D63319977

fbshipit-source-id: 08256e35b2769e18df2d24f870ec5d98e5574f85
2024-09-27 01:49:38 -07:00
Nicola CortiandFacebook GitHub Bot ecd660984c Gradle to 8.10.2 (#46656)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46656

This contains the fix for:
- https://github.com/gradle/gradle/issues/30472

Changelog:
[Internal] [Changed] - Gradle to 8.10.2

Reviewed By: tdn120

Differential Revision: D63457979

fbshipit-source-id: 1439a9ce198c1df0dafa8f5088c079c3fb3d1543
2024-09-27 00:43:25 -07:00
Sam ZhouandFacebook GitHub Bot efe51044b8 Deploy 0.247.0 to fbsource
Summary: Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D63506281

fbshipit-source-id: a992a1786a570f5d9562fbec71e0d2628c139bf3
2024-09-27 00:23:22 -07:00
Sam ZhouandFacebook GitHub Bot c2c9b78e49 Pre-suppress errors ahead of v0.247 release
Summary:
drop-conflicts

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D63506234

fbshipit-source-id: 186d60e42a8a2a3604058692ed844ba764d6ad3f
2024-09-26 22:25:21 -07:00
David VaccaandFacebook GitHub Bot d93e67d02c Enable Microtasks, ModernRuntimeScheduler and NativeViewConfigsInBridgelessMode by default only for New Architecture (#46683)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46683

Enabling these Microtask, ModernRuntimeScheduler and NativeViewConfigsInBridgelessMode in BridgeMode is risky and leads to bugs.  In this diff I'm ensuring we only enable these flags when newArchitecture is enabled

changelog: [internal] internal

Reviewed By: shwanton

Differential Revision: D63503519

fbshipit-source-id: 4ef757834b8f7fba595b3394735f4b91335d7c98
2024-09-26 22:02:42 -07:00
Nick GerlemanandFacebook GitHub Bot 3f880991aa Back out "Redo "[RN][Android] Convert ReactViewManager, ReactClippingViewManager to Kotlin""
Summary: Backing out the stack since a same crash that previously effected many apps appeared again, and there are changes soon landing that will add more conflicts.

Reviewed By: Abbondanzo

Differential Revision: D63493332

fbshipit-source-id: 4423bf41c793e00a0aa22d12a77bca69d3b1ae77
2024-09-26 15:50:26 -07:00
Nick GerlemanandFacebook GitHub Bot 8d22e3b249 Back out "Redo "[RN][Android] Convert ReactViewGroup to Kotlin""
Summary: Backing out the stack since a same crash that previously effected many apps appeared again, and there are changes soon landing that will add more conflicts.

Reviewed By: Abbondanzo

Differential Revision: D63493331

fbshipit-source-id: 44658ffc99eb4ebc947f95bb6e6bde105ac88c93
2024-09-26 15:50:26 -07:00
Nick GerlemanandFacebook GitHub Bot a886a2fa05 Back out "ReactViewGroup post-conversion cleanup"
Summary: Backing out the stack since a same crash that previously effected many apps appeared again, and there are changes soon landing that will add more conflicts.

Reviewed By: Abbondanzo

Differential Revision: D63493334

fbshipit-source-id: 175fc7b5b69aa2874c867e460ab102bb077a7cd8
2024-09-26 15:50:26 -07:00
Eric RozellandFacebook GitHub Bot 1dcaf823f5 Fix conflicting assertions for click events (#46633)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46633

There is an assertion in the "basic click test" that [checks](https://github.com/facebook/react-native/blob/d6e0bc7/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouch.js#L36-L40) that `isPrimary` is set to false. The same assertion suite also does a mouse event [validation](https://github.com/facebook/react-native/blob/d6e0bc7/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventSupport.js#L201-L204) that `isPrimary` is set to true.

This fixes the conflicting assertions, favoring the behavior observed on Firefox, which appears to be more closely aligned with the W3C spec.

## Changelog

[General][Fixed] Fixed issues with W3C PointerEvents testsx

Reviewed By: vincentriemer

Differential Revision: D63336622

fbshipit-source-id: adbfe5e1bc2a5fd7db18ae067f39e719c19c8cda
2024-09-26 14:45:44 -07:00
David VaccaandFacebook GitHub Bot fc9fcb5976 Fix initialization of FeatureFlags in DefaultNewArchitectureEntryPoint (#46681)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46681

Fix initialization of FeatureFlags in DefaultNewArchitectureEntryPoint

D60364016 introduced a bug, disabling Fabric and TurboModules when DefaultNewArchitectureEntryPoint is initialized with bridgless disabled

changelog: [internal] internal

Reviewed By: shwanton

Differential Revision: D63474698

fbshipit-source-id: 8b5aaeeda564d3463d13448b0adc7e964015000e
2024-09-26 14:23:04 -07:00
Thomas NardoneandFacebook GitHub Bot 9cd83fa9ab ReactViewGroup post-conversion cleanup (#46668)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46668

Small tweaks post-Kotlin-conversion:
- Make `overflow` a var
- Replace `+ -` with `-`
- Clean up properties and move up init block
- Iterate over entire allChildren array to clean up listeners

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D63343964

fbshipit-source-id: 2e9022e2d7e54ac338d1003419d8959771f7f270
2024-09-26 13:11:07 -07:00
Thomas NardoneandFacebook GitHub Bot be5e2b5827 Redo "[RN][Android] Convert ReactViewGroup to Kotlin" (#46672)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46672

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63129923

fbshipit-source-id: 0734f564b38e3adba704edffe45511e671ae74ac
2024-09-26 13:11:07 -07:00
Thomas NardoneandFacebook GitHub Bot f775f6919f Redo "[RN][Android] Convert ReactViewManager, ReactClippingViewManager to Kotlin" (#46667)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46667

Pre-req for converting ReactViewGroup without affecting API visibility.
Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63129925

fbshipit-source-id: 3b31df7b5450adcc961bb677114fb94d944f1ce4
2024-09-26 13:11:07 -07:00
Pieter De BaetsandFacebook GitHub Bot 3fbf5c72f3 Fix ReactSurfaceView-backed roots not reporting the end of pending transactions correctly (#46676)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46676

Changelog: [internal]

## Context

We recently "fixed" a problem in `MountingCoordinator` on Android where it would report that it doesn't have any pending transactions when, in fact, it does. The fix introduces a new method in that class to delay marking transactions as done until a mount hook is invoked for that surface.

That fixed the issue... by always reporting that there were pending transactions accidentally.

The reason for this bug is that the mount hook doesn't have access to the mounting coordinator of the surface if the surface is registered through some of the methods in `Binding.cpp` that don't add the surface to a registry. In that case, we can never mark the transactions as done and the mounting coordinator for those surfaces always report pending transactions incorrectly.

NOTE: this bug only affects apps that have the `fixMountingCoordinatorReportedPendingTransactionsOnAndroid` feature flag enabled.

## Changes

This fixes the issue by making sure that surfaces are always registered in the registry and that we can access their mounting coordinators in the mount hook to report the transactions as done.

Reviewed By: rubennorte

Differential Revision: D63466672

fbshipit-source-id: a621a12cda89a3ab7331d3c6a16c6cdfa9341821
2024-09-26 11:32:00 -07:00
Pieter De BaetsandFacebook GitHub Bot 04da3d784b Error in reportMount when surface is not found (#46678)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46678

I'm investigating some issues with surface management and noticed `surfaceHandlerRegistry_` is not updated in the bridgeless path when using ReactSurfaceView.

Adding a warning to help us validate this is resolved when we do eventually fix it.

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D63463521

fbshipit-source-id: 38995924588f1d71b9fc517c76a6e0c572fd0699
2024-09-26 11:32:00 -07:00
hoxyq (Meta Employee)andFacebook GitHub Bot 633ad4933e fix: use public instance in Fiber renderer and expose it from getInspectorDataForViewAtPoint (#31068) (#46674)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46674

bypass-github-export-checks

React DevTools no longer operates with just Fibers, it now builds its
own Shadow Tree, which represents the tree on the Host (Fabric on
Native, DOM on Web).

We have to keep track of public instances for a select-to-inspect
feature. We've recently changed this logic in
https://github.com/facebook/react/pull/30831, and looks like we've been
incorrectly getting a public instance for Fabric case.

Not only this, turns out that all `getInspectorData...` APIs are
returning Fibers, and not public instances. I have to expose it, so that
React DevTools can correctly identify the element, which was selected.

Changes for React Native are in
[D63421463](https://www.internalfb.com/diff/D63421463)

DiffTrain build for commit https://github.com/facebook/react/commit/d66fa02a303fc53d901bdb0d7bbdaec3e6774b19.

Test Plan: Sandcastle tests

Reviewed By: poteto

Differential Revision: D63453667

Pulled By: hoxyq

fbshipit-source-id: 21b1d5d4cd68b42748d4a785e0f28eaf5db57f21
2024-09-26 09:58:18 -07:00
Robert PasińskiandFacebook GitHub Bot 38b3b2195c New implementation of PerformanceObserver and related APIs (fixes #45122) (#45206)
Summary:
Changelog: [internal]

(this functionality hasn't been enabled in OSS yet, so no changelog necessary).

Fix https://github.com/facebook/react-native/issues/45122.

performance.mark is currently O(1) but performance.clearMark is O(n) (being n the number of entries in the buffer), which makes this operation very slow.

### Changes overview

 - Created new `PerformanceEntryBuffer` abstraction with the following subtypes, that differ on how entries are stored:
   - `PerformanceEntryCircularBuffer` - stores them in a ring buffer that was already implemented, removed key lookup cache (`BoundedConsumableBuffer`)
   - `PerformanceEntryKeyedBuffer` - stores them in a `unordered_map`, allowing for faster retrieval by type
   - `PerformanceEntryLinearBuffer` - a simple infinite buffer based on `std::vector`, currently used in a `PerformanceObserver`
 - Created `PerformanceObserver` abstraction on native side.
 - Created `PerformanceObserverRegistry` that collects active observers and forwards entries to observers that should retrieve them
 - Moved some method implementations to `.cpp` files to reduce potential compilation time slowdown. As the `PerformanceEntryReporter` can be included from anywhere in the code, it will be beneficial to make header files as light as possible.
 - Add comments to methods that note which standard is the method from/for.
 - Added some `[[nodiscard]]` attributes
 - Since the logic of routing entries to observers is moved to native side, JS side of the code got much simplified
 - If ever needed, `PerformanceObserver` can be created from native-side

Standards covered:

 - https://www.w3.org/TR/performance-timeline
 - https://www.w3.org/TR/event-timing/
 - https://w3c.github.io/timing-entrytypes-registry
 - https://w3c.github.io/user-timing/

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

Test Plan:
I've tested this e2e on IGVR and in the RNTester playground for the performance APIs. Everything works as expected.
There are also new unit tests for this.

C++ test results: https://www.internalfb.com/intern/testinfra/testconsole/testrun/8725724513169247/

Reviewed By: rshest

Differential Revision: D63101520

Pulled By: rubennorte

fbshipit-source-id: 5970b5c14692ff33ffda44a9f09067f6a758bdbe
2024-09-26 09:16:03 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 94b7793843 Run Maestro tests also in debug mode (#46573)
Summary:
This change runs Maestro tests also in Debug mode, by starting Metro in background.

## Changelog:
[Internal] - Add E2E tests in Debug mode too

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

Test Plan:
GHA must be green.
Successful run: https://github.com/facebook/react-native/actions/runs/11033322135?pr=46573

Reviewed By: cortinico

Differential Revision: D63452169

Pulled By: cipolleschi

fbshipit-source-id: e04b87f6a3e7aca8519dc2cb37c982dff3c20100
2024-09-26 06:01:28 -07:00
tutejsyandFacebook GitHub Bot 19d468fed9 Fix applying of tintColor and progressViewOffset props for RefreshControl component (#46628)
Summary:
While developing my project with New Architecture enabled I've found out that properties `tintColor` and `progressViewOffset` of component `RefreshControl` don't apply on iOS.  This happens due to the lack of handling of these properties in the `RCTPullToRefreshViewComponentView.mm` class.

The bug can be easily reproduced in RNTester app on RefreshControlExample.js screen, since it has property `tintColor="#ff0000"` (Red color), but RefreshControl renders with gray color:

<img width="300" alt="RefreshControlExample.js" src="https://github.com/user-attachments/assets/10931204-dbe8-4cbd-9adc-d0f38319febd">

<img width="300" alt="gray Refresh Control" src="https://github.com/user-attachments/assets/e5d088e8-b3f5-46b8-9284-9b452232ad10">

<br />
<br />

This PR is opened to fix that by applying `tintColor` and `progressViewOffset` props to `_refreshControl` in `RCTPullToRefreshViewComponentView.mm` class.

Fixes https://github.com/facebook/react-native/pull/46628

## Changelog:

[IOS][FIXED] - Fix applying of tintColor and progressViewOffset props for RefreshControl component with New Architecture enabled

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

Test Plan:
1. Run rn-tester app with New Architecture enabled on iOS
2. Open screen of RefreshControl component:

<img width="300" alt="Снимок экрана 2024-09-24 в 19 48 49" src="https://github.com/user-attachments/assets/94a2d02d-f3e3-4e18-a345-87c22d4a2620">

3. Open `/packages/rn-tester/js/examples/RefreshControl/RefreshControlExample.js` file and change properties `tintColor` and `progressViewOffset` of  RefreshControl components on the line 85:

<img width="300" alt="Снимок экрана 2024-09-24 в 22 01 19" src="https://github.com/user-attachments/assets/425826a6-d34c-4316-8484-e65f125a8b28">

4. check that your changes applied:

<img width="300" alt="Снимок экрана 2024-09-24 в 19 54 46" src="https://github.com/user-attachments/assets/b97621f1-b553-48c9-bc81-e04a99a7e099">

Reviewed By: cortinico

Differential Revision: D63381050

Pulled By: cipolleschi

fbshipit-source-id: 4f3aed8bd7a1e42ce2a75aa19740fd8be1623c86
2024-09-26 05:58:54 -07:00
Oskar KwaśniewskiandFacebook GitHub Bot 391680fe84 feat: improve RCTAppDelegate usage for brownfield (#46625)
Summary:
This PR improves the usage of `RCTAppDelegate` for brownfield scenarios.

Currently, when we want to integrate React Native with a brownfield app users might not want to initialize React Native in the main window. They may want to create it later.

Example usage:

```swift
class AppDelegate: RCTAppDelegate {
   override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
      // Disable automatically creating react native window
      self.automaticallyLoadReactNativeWindow = false

      return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}
```

```swift
import Foundation
import React
import React_RCTAppDelegate

class SettingsViewController: UIViewController {

  override func viewDidLoad() {
    super.viewDidLoad()
    self.view = (RCTSharedApplication()?.delegate as? RCTAppDelegate)?.rootViewFactory .view(withModuleName: "Settings", initialProperties: [:])
  }
}
```

## Changelog:

[IOS] [ADDED] - improve RCTAppDelegate usage for brownfield, add `automaticallyLoadReactNativeWindow` flag

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

Test Plan: CI Green

Reviewed By: cortinico

Differential Revision: D63325397

Pulled By: cipolleschi

fbshipit-source-id: 1361bda5fcd91f4933219871c64a84a83c281c34
2024-09-26 05:39:01 -07:00
David VaccaandFacebook GitHub Bot 10a33e0479 Migrate ReactFeatureFlags.enableFabricRenderer -> ReactNativeFeatureFlags (#46493)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46493

Migrate:
- ReactFeatureFlags.enableFabricRenderer -> ReactNativeFeatureFlags.enableFabricRenderer()
- ReactFeatureFlags.useTurboModules -> ReactNativeFeatureFlags.useTurboModules()
- Rename ReactFeatureFlags.enableBridgelessArchitecture -> ReactNativeFeatureFlags.enableBridgelessArchitecture()

changelog: [Android][Breaking] Delete useTurboModules, enableFabricRenderer and enableBridgelessArchitecture fields from ReactFeatureFlags class

Reviewed By: rubennorte

Differential Revision: D60364016

fbshipit-source-id: e10a44fc08deb8969104b5cb0bd426dfb0a45d30
2024-09-26 04:29:27 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 038e6eda6d Fix the trigger e2e on comment workflow (#46653)
Summary:
This change fixes the workflow by using the right URL. I also added some logging for debugging.

## Changelog:
[Internal] - Fix Trigger E2E tests workflow

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

Test Plan: Tested the script locally and verified that it triggers the workflow.

Reviewed By: cortinico

Differential Revision: D63452098

Pulled By: cipolleschi

fbshipit-source-id: f44956071edb68046ed1cb74e286e8edbe0eb23a
2024-09-26 03:49:09 -07:00
Vitali ZaidmanandFacebook GitHub Bot 23e738fb6d allow waiting for metro to be torn down (#46620)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46620

The following error was thrown when the test `packages/metro/src/integration_tests/__tests__/server-test.js` was running on Metro:
{F1816961963}

It led me to investigate why don't we wait for Metro to be torn down.

Currently we close metro by closing the http server that it launches.
```
const httpServer = await Metro.runServer(/* ... */);
httpServer.close(callback);
```
While we can listen to the callback fired when the server is closed, it only covers one of the systems running internally in metro. The systems that are not covered are:
* File watchers
* File map workers
* Dependency graph
* Bundler

And many systems that were themselves listening to the above like "eslint file map" or the "dependency analysis".

**These systems are closed by us _after_ the server is closed.** This means that a listener to `server.on('close'` would only get the indication where these systems has started to close rather than actually got closed.
https://www.internalfb.com/code/fbsource/[17e03bc6bd86]/xplat/js/tools/metro/packages/metro/src/index.flow.js?lines=359-361

This diff introduces a way to wait for all of metro to be closed.

In this diff I use that new way of listening to Metro closure to get rid of the jest test warning mentioned above in `packages/metro/src/integration_tests/__tests__/server-test.js`:
```
  let serverClosedPromise;

  beforeEach(async () => {
    config = await Metro.loadConfig({
      config: require.resolve('../metro.config.js'),
    });

    let onCloseResolve;
    serverClosedPromise = new Promise(resolve => (onCloseResolve = resolve));
    httpServer = await Metro.runServer(config, {
      reporter: {update() {}},
      onClose: () => {
        onCloseResolve();
      },
    });
  });

  afterEach(async () => {
    httpServer.close();
    await serverClosedPromise;
  });
```

Changelog: [Feature] add `onClose` to `Metro.runServer` configuration allowing to wait for metro and all associated processes to be closed.

Reviewed By: huntie

Differential Revision: D61594124

fbshipit-source-id: e3c50ef986077503bce0caa42a9f9430efc65272
2024-09-26 03:42:49 -07:00
Michael TrogerandFacebook GitHub Bot 7dcb10b6e7 Fix YogaConfig getting garbage collected #1678 (#46651)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46651

Fixes [https://github.com/facebook/yoga/issues/1678](https://github.com/facebook/yoga/issues/1678)

As described in the linked Issue, the problem is that the `YogaConfig` can get garbage collected by the JVM, while a `YogaNode` is still referring to it. This at some point leads to unexpected behaviour (0 values for `layoutWidth`/`layoutHeight`). The change coming with this PR makes sure the `YogaConfig` can not get garbage collected while it's used by a `YogaNode`.

Demo project to confirm the fix https://github.com/michaeltroger/yogabug

Kudos to rtPag, who helped identifying the issue.

X-link: https://github.com/facebook/yoga/pull/1703

Reviewed By: mdvacca

Differential Revision: D63416127

Pulled By: NickGerleman

fbshipit-source-id: efd87dac897e44d3664c228c40cda90f1e11c4f6
2024-09-25 23:53:17 -07:00
Shawn DempseyandFacebook GitHub Bot 256adcab7b Add a new playground component to rntester (#46632)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46632

Changelog: [General][Added] Add Playground to RNTester for testing out features & submitting reproducers.

**Context**

- Adding the Playground from Catalyst to RNTester
- This should help folks test React Native features for a particular version

**Change**

- Add a new playground component to RNTester
- Add a new reducer action for opening an example from navbar press
- Fixed typing issues
- Add icon from this fb asset pack: https://www.internalfb.com/assets/set/facebook_icons/nucleus-beaker/variant_outline-size_24?q=beaker
- Matched background color using this imagemagick script

**dark**
```
convert input.png -fill 'rgb(178,180,186)' -colorize 100% output.png
```
**light**
```
convert input.png -fill 'rgb(81,82,84)' -colorize 100% output.png
```

Reviewed By: NickGerleman

Differential Revision: D61972594

fbshipit-source-id: 4a5523a84a6ef09d3266d5f56825907bd3fbe4b5
2024-09-25 23:29:11 -07:00
Rick HanlonandFacebook GitHub Bot e9ec9fbde4 Refactor LogBox tests to spies (#46638)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46638

This is annoying, but in the next diff that fixes a bug I need to test using the default warning filter instead of a mock (really, all this mocking is terrible, idk why I did it this way).

Unfortunately, in Jest you can't just reset mocks from `jest.mock`, `restoreMocks` only resets spies and not mocks (wild right).

So in this diff I converted all the `jest.mock` calls to `jest.spyOn`. I also corrected some of the mocks that require `monitorEvent: 'warning',` like the warning filter sets.

I also added a test that works without the fix.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63349615

fbshipit-source-id: 4f2a5a8800c8fe1a10e3613d3c2d0ed02fca773e
2024-09-25 19:28:05 -07:00
Rick HanlonandFacebook GitHub Bot 2f85e28cde Add integration tests for console errors + ExceptionManager (#46636)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46636

Adds more integration tests for LogBox (currently incorrect, but fixed in a later diff).

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63349614

fbshipit-source-id: 8f5c6545b48a1ed18aea08d4ecbecd7a6b9fa05a
2024-09-25 19:28:05 -07:00
Rick HanlonandFacebook GitHub Bot 1787726bf9 Re-enable integration tests (#46639)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46639

These tests were skipped when we were switching to component stacks, which also hid a bug later in the stack. Re-enable them.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63349616

fbshipit-source-id: ccde7d5bb3fcd9a27adf4af2068a160f02f7432a
2024-09-25 19:28:05 -07:00
Joe VilchesandFacebook GitHub Bot 8eadb84d32 Expose box sizing getters and setters in Yoga (#46630)
Summary:
X-link: https://github.com/facebook/yoga/pull/1701

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

I would like to write some tests for box sizing that will drive a lot of my development as I implement content box. To do that, I need this publicly exposed. Obviously not that ideal since this currently does not do anything. Maybe we can name the value in such a way that its clear it is in development?

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63135970

fbshipit-source-id: 7520823bf925364eae45341531e012e80ec92284
2024-09-25 15:46:55 -07:00
Joe VilchesandFacebook GitHub Bot 9ee5fffae0 Small perf fix for new iOS view clipping (#46629)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46629

If we clipped and had no border or corner radius we would end up hitting this path every time. We can optimize this a bit to avoid that.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63299597

fbshipit-source-id: 90031f964b7669049a4a2efe00a553c888d28cd7
2024-09-25 13:35:56 -07:00
Blake FriedmanandFacebook GitHub Bot eb7c43965e Add changelog for 0.76.0-rc.2 (#46619)
Summary:
Add changelog for 0.76.0-rc.2

Changelog:
[Internal] - add changelog

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

Reviewed By: cipolleschi

Differential Revision: D63387314

Pulled By: blakef

fbshipit-source-id: c80449ff2043c26a126ec91db39f81093ac2d57f
2024-09-25 06:57:00 -07:00
Oskar KwaśniewskiandFacebook GitHub Bot 5bd751bd91 fix: running local tests (#46615)
Summary:
This PR fixes running local tests.

### Before

Tests from Pods/ are executed (including Hermes tests)

![CleanShot 2024-09-24 at 10 09 04@2x](https://github.com/user-attachments/assets/5d766321-1099-4970-bc4d-cf20ec1f5d89)

### After

![CleanShot 2024-09-24 at 10 10 24@2x](https://github.com/user-attachments/assets/356b0db3-9278-4cb3-a216-2ca78b623950)

## Changelog:

[INTERNAL] [FIXED] - Make tests run locally

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

Test Plan: 1. Run yarn run test (with and without the change). Make sure you have installed pods.

Reviewed By: huntie

Differential Revision: D63383063

Pulled By: cipolleschi

fbshipit-source-id: d7352f80c0fe4efdbb169e1adc4d5f60179f78e8
2024-09-25 05:51:49 -07:00
HaileyandFacebook GitHub Bot 99ab845a5c convert NSNull to nil before checking type in readAsDataURL (#46635)
Summary:
This issue original arose out of https://github.com/bluesky-social/social-app/issues/5100. Copying the description (with my general understanding of the problem) from the patch PR to here as well.

There's a crash that comes up in the following, pretty specific scenario:

- Have a response that has an empty body
- Do not include a `content-type` header in the response
- Set the `x-content-type-options` header to `nosniff`

RN handles the response for a request in this block of code: https://github.com/facebook/react-native/blob/303e0ed7641409acf2d852c077f6be426afd7a0c/packages/react-native/Libraries/Blob/RCTBlobManager.mm#L314-L326

Here, we see that values of `nil` - which `[response MIMEType]` will return when no `content-type` is provided in the response and the actual type cannot be determined (https://developer.apple.com/documentation/foundation/nsurlresponse/1411613-mimetype) - gets converted to `NSNull` by `RCTNullIfNil`.

When we get back over to `readAsDataURL`, we see that we grab the type from the dictionary and check if its `nil` before calling `length` on the string. https://github.com/facebook/react-native/blob/303e0ed7641409acf2d852c077f6be426afd7a0c/packages/react-native/Libraries/Blob/RCTFileReaderModule.mm#L74-L77

However, this check is dubious, because the value will never actually be `nil`. It will always either be `NSString` or `NSNull` because of the `RCTNullIfNil` call made above and `[RCTConvert NSString]` seems to just return the input if it is `NSNull`.

## Changelog:

[IOS] [FIXED] - Convert `NSNull` to `nil` before checking `type` in `readAsDataURL`

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

Test Plan:
This is a little awkward to test, but essentially this comes up in the following scenario that is described (and "tested" as being fixed by tweaking) in https://github.com/bluesky-social/social-app/issues/5100. I have personally tested by using Cloudflare rules to add/remove that particular header from an empty body response. You could also test this with a little local web server if you want.

### Before

https://github.com/user-attachments/assets/deb86c68-2251-4fef-9705-a1c93584e83e

### After

https://github.com/user-attachments/assets/9ffab11b-b2c8-4a83-afd6-0a55fed3ae9b

Reviewed By: dmytrorykun

Differential Revision: D63381947

Pulled By: cipolleschi

fbshipit-source-id: b2b4944d998133611592eed8d112faa6195587bd
2024-09-25 04:47:54 -07:00
Oskar KwaśniewskiandFacebook GitHub Bot 65575e8399 feat: get react-native package name from package.json in codegen script (#46604)
Summary:
This PR fixes the retrieval of react native package name to retrieve it from package.json.

This fixes the annoying message in codegen that poped up when installing pods:

```
[Codegen] Found react-native-macos
[Codegen] CodegenConfig Deprecated Setup for react-native-macos.
    The configuration file still contains the codegen in the libraries array.
    If possible, replace it with a single object.

BEFORE:
    {
      // ...
      "codegenConfig": {
        "libraries": [
          {
            "name": "libName1",
            "type": "all|components|modules",
            "jsSrcsRoot": "libName1/js"
          },
          {
            "name": "libName2",
            "type": "all|components|modules",
            "jsSrcsRoot": "libName2/src"
          }
        ]
      }
    }

    AFTER:
    {
      "codegenConfig": {
        "name": "libraries",
        "type": "all",
        "jsSrcsRoot": "."
      }
    }
```

## Changelog:

[GENERAL] [CHANGED] - get react-native package name from package.json in codegen script

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

Test Plan: Install pods

Reviewed By: cortinico

Differential Revision: D63335543

Pulled By: arushikesarwani94

fbshipit-source-id: 0470e54f0fc7aa962918c889855c52648d11e32d
2024-09-25 01:28:23 -07:00
Eric RozellandFacebook GitHub Bot 68a6b69b27 Fix PointerOverOut test (#46634)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46634

The PointerEventPointerOverOut.js test case is broken due to a changed assumption about the name of the native tag property (`_nativeTag` vs. `__nativeTag`). This fixes the broken assumption.

## Changelog

[General][Fixed] Fixed issue with W3C PointerEvents tests

Reviewed By: NickGerleman

Differential Revision: D63336621

fbshipit-source-id: b54270f1c1232de6845ef73cac52f06b9a85539c
2024-09-24 19:49:34 -07:00
Pieter De BaetsandFacebook GitHub Bot 0cb32d5ac9 Cleanup Fresco SystraceRequestRequestListener (#46626)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46626

Remove `!!` by reusing lookup result.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D63316175

fbshipit-source-id: 1abfb20490831f26819aef4393c9629253d33ec6
2024-09-24 13:40:47 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 303e0ed764 Fix Increment and Decrement accessibility actions (#46617)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46617

This changes fixes the Increment/Decrement accessibility actions on iOS with the New Architecture.

## Changelog
[iOS][Fixed] - Make sure that the Increment and Decrement accessibility actions works on iOS

Reviewed By: javache

Differential Revision: D63263830

fbshipit-source-id: 99dca14a002e098db2d3b0e268af32cdab6ce786
2024-09-24 09:24:24 -07:00
Pieter De BaetsandFacebook GitHub Bot a9551641b4 Cleanup Modal test code (#46603)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46603

Was debugging this test for the mounting instruction changes, and found some opportunities to clean this up.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D63258342

fbshipit-source-id: f7e6be58474f112993232ce5859ccb160f050ae8
2024-09-24 05:34:01 -07:00
Nicola CortiandFacebook GitHub Bot c005609b01 Properly set REACTNATIVE_MERGED_SO for autolinked libraries. (#46606)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46606

This fixes this issue reported here:
https://github.com/react-native-community/discussions-and-proposals/discussions/816#discussioncomment-10673136

reported by both SWM and Expo.

The problem is that `REACTNATIVE_MERGED_SO` is not properly set for autolinked libraries so they can't access it
to understand if the version of ReactNative has merged so libraries or not.
This fixes it, I've tested against
https://github.com/tomekzaw/repro-reactnative-merged-so
reproducer provided by tomekzaw

Changelog:
[Android] [Fixed] - Properly set `REACTNATIVE_MERGED_SO` for autolinked libraries

Reviewed By: rubennorte

Differential Revision: D63262687

fbshipit-source-id: c505dce9036bb4cd0366b7ab99412368963273af
2024-09-24 03:35:15 -07:00
Nick GerlemanandFacebook GitHub Bot fc8224036b Fix measuring text with incorrect hyphenationFrequency
Summary:
A typo means TextLayoutManager will incorrectly measure text as if `LineBreaker.HYPHENATION_FREQUENCY_NORMAL` is set, instead of the correct default of `LineBreaker.HYPHENATION_FREQUENCY_NONE` which we use to display the `TextView`. This causes truncation if hyphenation would have caused text to be shorter than if not hyphenated. Fix the typo.

Changelog: [Android][Fixed] - Fix measuring text with incorrect hyphenationFrequency

Reviewed By: mellyeliu

Differential Revision: D63293027

fbshipit-source-id: baaf2ae2676548cf0815ae96e324af273be6f99e
2024-09-23 17:52:30 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot 7ab0002799 Disable outline props on old architecture (#46608)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46608

tsia

Changelog: [Android][Changed] - Disabling `outline` props on Android to stay consistent with iOS

Reviewed By: NickGerleman

Differential Revision: D63143626

fbshipit-source-id: 3eafe5beeb54b1619d94fe3d886ab19d445a0b09
2024-09-23 13:46:32 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot 8ad4b7d0cf Fix outline drawing 1px width when outlineWidth = 0 (#46586)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46586

When Paint.strokeWidth is set to 0 its not actually 0 but "hairline mode" so  the fix is just to make outline not draw at all when outlineWidth = 0 {F1879399325}

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D63136220

fbshipit-source-id: 81ef7ce0b72158c6b7c332191d332008c5a919b4
2024-09-23 11:57:39 -07:00
Dmitry RykunandFacebook GitHub Bot 6e0e712c2a Bring back shouldSkipStateUpdatesForLoopingAnimations feature flag (#46598)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46598

Changelog: [General][Changed] - Bring back shouldSkipStateUpdatesForLoopingAnimations feature flag

Facebook
Also bring back `skip_state_updates_for_looping_animations` MC. This will allow the experiment to participate in a holdout properly.

Reviewed By: GijsWeterings

Differential Revision: D63252185

fbshipit-source-id: 89bc9321b12f07bd9b3b52c4fc1021d34594ebc0
2024-09-23 10:56:06 -07:00
Pieter De BaetsandFacebook GitHub Bot b846f94b1c Refactor FabricMountingManager to enable reuse of IntBuffer methods (#46600)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46600

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D63150556

fbshipit-source-id: 039a88d6444df53767be52b9e70c20ef2ffd99be
2024-09-23 09:08:00 -07:00
Renaud ChaputandFacebook GitHub Bot 3c54e1ee45 Fix <KeyboardAvoidingView> with floating keyboard on iPad (#44859)
Summary:
On iPadOS, users can change the kind of keyboard displayed onscreen, going from normal keyboard, to split keyboard (one half on the left of the screen, one half on the right), or a floating keyboard that you can move around the screen.

When a non-normal kind of keyboard is used, `<KeyboardAvoidingView>` calculations are all wrong and, depending on the `behavior` prop, can make your screen completely hidden.

This PR attempts to detect that the keyboard is not the "normal displayed-at-bottom-of-screen" keyboard, and forces `enable={false}` if this happens.

The approach of comparing the keyboard width with the window width comes from this comment: https://github.com/facebook/react-native/issues/29473#issuecomment-696658937

A better fix might be to detect the kind of keyboard used, but this involves native code changes and I do not know iOS enough to do that. In addition, I have not found an easy way to do it using iOS APIs after a quick search.

I also chose to cache the window width as a class attribute. Maybe this is not needed as `Dimensions.get('window').width` is very fast and can be called on every keyboard event?

This fixes https://github.com/facebook/react-native/issues/44068 and https://github.com/facebook/react-native/issues/29473

## Changelog:

[IOS] [FIXED] - Fix `<KeyboardAvoidingView>` with floating keyboard on iPadOS

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

Test Plan:
Tested using RNTester and the "Keyboard Avoiding View with different behaviors" example.

Before:

https://github.com/facebook/react-native/assets/42070/111598a3-286c-464d-8db8-73afb35cd7f9

After:

https://github.com/facebook/react-native/assets/42070/0b3bc94f-8b67-4f42-8a83-e11555080268

Reviewed By: cortinico

Differential Revision: D62844854

Pulled By: cipolleschi

fbshipit-source-id: 577444be50019572955a013969d78178914b5b8d
2024-09-23 07:59:33 -07:00
Pieter De BaetsandFacebook GitHub Bot a6fcad7e27 Move ShadowNodePair to Differentiator (#46590)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46590

This API should not be part of the ShadowView header, since the class is only used by Differentiator. The ShadowView header should contain public API's that the mounting layer can consume.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D63148522

fbshipit-source-id: 0545777fd311424ccd2d66de8b47b5591e8175f7
2024-09-23 07:12:09 -07:00
Pieter De BaetsandFacebook GitHub Bot 300db67b27 Remove unused FabricComponents mapping (#46591)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46591

This is a duplicate of FabricNameComponentMapping, which is not exposed. Checking GitHub codesearch, this API is not referenced elsewhere.

This component should be cleaned, with the mappings moved to a generic translation layer (eg in [ViewManagerRegistry](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java#L55)) or by fixing the JS callers.

Changelog: [Android][Removed] FabricComponents is removed from public API

Reviewed By: fabriziocucci

Differential Revision: D63099721

fbshipit-source-id: 7018deadc919e21cdf3482ae454baca72937611f
2024-09-23 07:12:09 -07:00
Pieter De BaetsandFacebook GitHub Bot 9eafec48f3 Unbreak RN_SHADOW_TREE_INTROSPECTION flag (#46589)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46589

This is a useful too for debugging ShadowTree mutations, but was broken due to some recent build changes.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D63099720

fbshipit-source-id: 9ae5ee062ef9a6a99b2517e4eedd286cd6259fbe
2024-09-23 04:57:17 -07:00
Rubén NorteandFacebook GitHub Bot 9235be3776 Add metadata to feature flag definitions (#46597)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46597

Changelog: [internal]

Adding explicit metadata to feature flags so they're easier to manage:
* Purpose: to indicate why the feature flags are added.
    * Release: gating features we don't want to expose in certain environments yet (e.g.: Fabric).
    * Experimentation: changes that we want to test before enabling them broadly. Should generally be short lived.
    * Operational: flags that enable certain behaviors in certain environments (e.g.: debugging logs).
* Date added: only for experimental flags, so we know how long we've been waiting to fully roll out the change (without having to go through the repository history, which could've been changed due to refactors).

Reviewed By: javache

Differential Revision: D62972237

fbshipit-source-id: ab51e989a2cddb8dc52197238b638609d30002f0
2024-09-23 04:40:37 -07:00
Pieter De BaetsandFacebook GitHub Bot be7b78ec9d Use CopyOnWriteArrayList for ReactHostImpl lifecycle listeners (#46567)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46567

Switch to a simpler data structure which avoids locking and doesn't require copies when iterating. This is more consistent with other listener arrays in React Native.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D62872893

fbshipit-source-id: b0ce6a904d25057f0217f7de7ec2928c8b2d1f34
2024-09-23 04:32:13 -07:00
Pieter De BaetsandFacebook GitHub Bot e27259b3db Do not hold raw RuntimeScheduler pointer in BufferedRuntimeExecutor (#46542)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46542

If `bufferedRuntimeExecutor_` is referenced beyond the lifetime of the ReactInstance, it may point to invalid memory. RuntimeScheduler already holds weak references to the actual runtime, so it's safe to retain that instead.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D62748768

fbshipit-source-id: 1cd8fcb050dd561e7d54a11d91c89eda3a5ddaaa
2024-09-23 04:32:13 -07:00
Jakub PiaseckiandFacebook GitHub Bot bd323929dc Add a workaround for text being measured incorrectly when ending with an empty line (#42331)
Summary:
It looks like `StaticLayout` used for measuring multiline text on the new architecture returns wrong metrics for the last line if it's empty, however, if it contains anything, then the returned values are correct.

Similar approach with measuring `I` was already used in `ReactEditText`: https://github.com/facebook/react-native/blob/258d8e51b451b221e557dad4647cbd210fe37392/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java#L1203-L1213

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

[ANDROID] [FIXED] - Fixed text being measured incorrectly when ending with an empty line on the new architecture

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

Test Plan:
<details>
<summary>I tested the change on this simple code on React Native 0.73.2 (with the new arch enabled)</summary>

```jsx
import React from 'react';
import {useState} from 'react';
import {SafeAreaView, TextInput} from 'react-native';

export default function App() {
  const [text, setText] = useState('ABC\nDEF\nGHI\n');

  return (
    <SafeAreaView style={{flex: 1}}>
      <TextInput
        value={text}
        onChangeText={setText}
        style={{borderWidth: 1, margin: 20, padding: 30}}
        multiline
      />
    </SafeAreaView>
  );
}
```

</details>

Before:

https://github.com/facebook/react-native/assets/21055725/0787cc86-70c6-4238-b93a-87984e527a83

After:

https://github.com/facebook/react-native/assets/21055725/2acf619f-5cb4-4869-9576-cb8cc081c15b

Reviewed By: cipolleschi

Differential Revision: D62873674

Pulled By: cortinico

fbshipit-source-id: cc2481b1924a13af7326cfc16c59b9390f0d06d8
2024-09-21 06:34:21 -07:00
Oskar KwaśniewskiandFacebook GitHub Bot 1747f57c67 feat(iOS): add colors to codegen output (#46557)
Summary:
This PR is a quality-of-life improvement, adds colors to codegen output:

![CleanShot 2024-09-18 at 12 18 00@2x](https://github.com/user-attachments/assets/13290a1c-8411-40e4-8abe-8fce4b88b6e7)

Makes it a lot easier to grasp what's going on in the actions taken by codegen.

## Changelog:

[GENERAL] [ADDED] - Add color formatting to codegen output

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

Test Plan:
1. Run codegen
2. Expect colored output

Reviewed By: christophpurrer

Differential Revision: D63031248

Pulled By: cipolleschi

fbshipit-source-id: e86bc72f16582562dc9f1e3b55dc69af4c7838f5
2024-09-20 03:33:31 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 9e2e8c1a27 Prepare scripts to simplify E2E testing (#46545)
Summary:
Add tests to simplify running Maestro e2e tests locally.
Thanks to these scripts, users can just, from the root folder:

```sh
yarn install
cd packages/rn-tester

# build android for testing
yarn e2e-build- android

# run tests on android
yarn e2e-test-android

# build iOS for testing
yarn e2e-build-ios

# run tests on iOS
yarn e2e-test-ios
```

This is a preliminary step for a future umbrella issue. We can also use these command in CI to simplify the scripts.

## Changelog:
[Internal] - add script to simplify e2e testing

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

Test Plan: Tested the command locally

Reviewed By: cortinico

Differential Revision: D62879105

Pulled By: cipolleschi

fbshipit-source-id: 6f68aebb3f8112302a458ca9e118180d3dbaf180
2024-09-20 03:29:43 -07:00
David VaccaandFacebook GitHub Bot 151008f8c2 Back out "Convert ReactViewManager, ReactClippingViewManager to Kotlin" (#46581)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46581

Original commit changeset: 09a81c91a1c9

Original Phabricator Diff: D62776270

changelog: [internal] internal

Reviewed By: bvanderhoof

Differential Revision: D63076764

fbshipit-source-id: 9cbd8ab86be356a7c35e44c86a95b80342c3da76
2024-09-19 22:56:17 -07:00
David VaccaandFacebook GitHub Bot d721d83149 Back out "Convert ReactViewGroup to Kotlin" (#46580)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46580

Original commit changeset: 780350e7e449

Original Phabricator Diff: D62642663

changelog: [internal] internal

Reviewed By: bvanderhoof

Differential Revision: D63076763

fbshipit-source-id: 01d3949c13129b71d5c96f19682bb24c51ff2552
2024-09-19 22:56:17 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot 1288e38423 Implement outline properties on iOS (#46444)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46444

This diff adds:

`outline-width`: https://developer.mozilla.org/en-US/docs/Web/CSS/outline-width
`outline-color`: https://developer.mozilla.org/en-US/docs/Web/CSS/outline-color
`outline-style`: https://developer.mozilla.org/en-US/docs/Web/CSS/outline-style
`outline-offset`: https://developer.mozilla.org/en-US/docs/Web/CSS/outline-offset

Using `BackgroundStyleApplicator`

Changelog: [iOS] [Added] - Outline properties `outline-width`, `outline-color`, `outline-style` & `outline-offset`

Reviewed By: joevilches

Differential Revision: D62273339

fbshipit-source-id: 0ed775218e7d1dfb13bbf1760bc6ec331a388b64
2024-09-19 16:41:46 -07:00
Thomas NardoneandFacebook GitHub Bot 66c3074c65 Convert ReactViewGroup to Kotlin (#46577)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46577

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D62642663

fbshipit-source-id: 780350e7e449ffd2d6378cbed6f4381e34636a24
2024-09-19 13:20:15 -07:00
Thomas NardoneandFacebook GitHub Bot d80e1e9be3 Convert ReactViewManager, ReactClippingViewManager to Kotlin (#46578)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46578

Pre-req for converting ReactViewGroup without affecting API visibility.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D62776270

fbshipit-source-id: 09a81c91a1c95685b36f4417cb1b1a2852dd7194
2024-09-19 13:20:15 -07:00
Pieter De BaetsandFacebook GitHub Bot 5f49e279f0 Fix AnimatedEvent leaking topScrollEnded handler (#46576)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46576

We automatically add this handler in `addAnimatedEventToView` but we do not remove it in `removeAnimatedEventFromView`, which causes us to leak it. This is especially bad as we attach and detach the event handler multiple times while rendering.

Changelog: [Internal]

Reviewed By: tdn120

Differential Revision: D63029768

fbshipit-source-id: 9ef2bc6887fecb7ab448af4dee94463f8be27768
2024-09-19 11:56:28 -07:00
zhongwuzwandFacebook GitHub Bot 052def0da0 Fabric: Add missing source properties of Image (#46460)
Summary:
Fabric: Add missing source properties of Image

## Changelog:

[IOS] [FIXED] - Fabric: Add missing source properties of Image

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

Test Plan: Missing props should worked.

Reviewed By: javache

Differential Revision: D62847594

Pulled By: cipolleschi

fbshipit-source-id: 83d7c836a2e96c9053aa94e0e9b8e706103d026f
2024-09-19 11:00:25 -07:00
Alex HuntandFacebook GitHub Bot a026d6d250 Update relocated JS logs message (#46558)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46558

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D62937482

fbshipit-source-id: 323d4220443e2660ff2f0cb8c019477ee245a07d
2024-09-19 10:15:05 -07:00
Pieter De BaetsandFacebook GitHub Bot d8aa664adf Clear out CreateReactInstanceTaskRef early when destroying (#46544)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46544

Experiments with `completeReactInstanceCreationOnBgThreadOnAndroid` have shown a native crash in this code path, but it also existed previously.

I believe this is due to the ordering of ReactInstance teardown: we first destroy the ReactInstance, and only then destroy the reference to it in mCreateReactInstanceTaskRef. When using the immediate executor and completeReactInstanceCreationOnBgThreadOnAndroid, we read the react instance from the task, which may no longer be valid at this point. Resetting the task at the earliest point should mitigate the issue.

Changelog: [Internal]

Reviewed By: markv

Differential Revision: D62872625

fbshipit-source-id: 5aaccd53433ca806d2b93f7e3dd2bcf9bf8c09a8
2024-09-19 07:52:59 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 6d51c5cd8e Setup homebrew in ubuntu machine (#46575)
Summary:
This change setups homebrew on Ubuntu. Due to https://github.com/actions/runner-images/issues/6283, brew is not in the PATH anymore.

## Changelog:
[Internal] - Setup homebrew in ubuntu machine

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

Test Plan: Can't test before it lands. :(

Reviewed By: cortinico

Differential Revision: D63027253

Pulled By: cipolleschi

fbshipit-source-id: e0b3a3c1a2a7b0659f0c1f57c45d8d42a74734a1
2024-09-19 07:19:00 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 0d2248557b Configure E2E test to run on comments (#46572)
Summary:
This change configure the Test All job to enable the E2E tests with an input parameter.
Then it adds another workflow that is triggered on PRs when someone posts the "/test-e2e" comment.

## Changelog:
[Internal] - Let users run E2E tests on a specific PR comment

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

Test Plan: This kind of things can only be tested once the PR lands, as workflows that are triggered by comments runs only from the main branch.

Reviewed By: cortinico

Differential Revision: D63021786

Pulled By: cipolleschi

fbshipit-source-id: 95b271f6de658ca208c773429fedef2a36417752
2024-09-19 05:34:53 -07:00
Riccardo CipolleschiandFacebook GitHub Bot c6f32828b9 Fix crash when navigating away from screens (#46559)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46559

There is an edge case when we navigate away from a screen that contains a scroll view where one of the UISCrollViewDelegates does not implement the scrollViewDidEndDecelerating method.

This happens because the Macro used assumes that the event that we are forwarding is the actual method from where the macro is called. Which is not true when it comes to `didMoveToWindow`.

This change fixes that by explicitly expanding the macro in this scenario and passing the right selector.

## Changelog:
[iOS][Fixed] - Fixed a crash when navigating away from a screen that contains a scrollView

## Facebook
This should fix T201780472

Reviewed By: philIip

Differential Revision: D62935876

fbshipit-source-id: e29aadf201c8066b5d3b7b0ada21fa8d763e9af0
2024-09-19 03:24:41 -07:00
Nicola CortiandFacebook GitHub Bot 2524c8eb72 Fix init behavior for 0.76 (#46560)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46560

The `init` command should still keep on working till 2024-12-31

This handles this scenario as currently `npx react-native@next init` is broken.

Changelog:
[Internal] [Changed] - Clarify init behavior for 0.76

Reviewed By: huntie, cipolleschi

Differential Revision: D62958747

fbshipit-source-id: ce3d974df55162720d59a7ece7fcb816e257185d
2024-09-19 03:08:10 -07:00
Samuel SuslaandFacebook GitHub Bot 0fe234cb60 execute task directly instead of going through runEventLoopTick (#46540)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46540

changelog: [internal]

avoid calling `runEventLoopTick` and execute task directly. runEventLoopTick is not designed to be called on re-entries.

Reviewed By: rubennorte

Differential Revision: D62871782

fbshipit-source-id: 259514d05eebed2e09d54233729994e56f2aa1a4
2024-09-18 18:02:06 -07:00
Joe VilchesandFacebook GitHub Bot 7e38cf32eb Fix crash that happens with shadow color with 0 alpha (#46551)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46551

We crash if we pass a shadow color with 0 alpha due to some divide by 0 logic. This fixes that for inset and outset shadows and adds a test for that case.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D62899047

fbshipit-source-id: 2aff1d016dd97bed024df1c3f89bcc62e49f0306
2024-09-18 16:44:45 -07:00
David VaccaandFacebook GitHub Bot 40638b8c26 Fix logging of internals of React Native renderer (#46562)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46562

This diff if fixing the logging of internal statistics of React Native Android renderer

changelog: [internal] intenral

Reviewed By: javache

Differential Revision: D59985973

fbshipit-source-id: 5f5020a516d236ef41b0bff087b00e7d7c721bb8
2024-09-18 13:55:44 -07:00
Rubén NorteandFacebook GitHub Bot fea0aa7f83 Create feature flag to make estimation for remaining time in frame for view preallocation more precise (#46563)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46563

Changelog: [internal]

Our current implementation of view preallocation on Android runs very early in the frame (during the `animation` stage, after `input` and before `traversal`). In that implementation, we check the remaining time in the frame and we allocate half of that time for view preallocation.

This logic can make us drop frames unnecessarily, if the work that we need to do after this allocated time is longer than we expect. Because we don't know how long the `traversal` stage will be, we don't account for that time at all (or, at best, we do only use half of the remaining time).

This creates a feature flag to move view preallocation outside of the choreographer, so we can compute the remaining time considering all the work we did in the frame, and not just the work we did in the input stage.

Reviewed By: javache

Differential Revision: D62962341

fbshipit-source-id: 69aaeecc8596906e61b47af9adad23c1075a091a
2024-09-18 13:25:49 -07:00
Pieter De BaetsandFacebook GitHub Bot 7f55dc0f45 Remove unused UIManager lookup in NativeAnimatedNodesManager (#46565)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46565

UIManager is initialized elsewhere in NativeAnimatedNodesManager so this is no longer required

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D62958646

fbshipit-source-id: af77ddbbc65124ed29d301340ad339d2a916f58c
2024-09-18 11:05:25 -07:00
Rubén NorteandFacebook GitHub Bot 68e55284c5 Ship correct fix for state updates after smooth scroll animation (#46564)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46564

Changelog: [internal]

I incorrectly set up an experiment to fix reported scroll position during smooth scroll animations on Android in D59233069. It was incorrect because I fixed the issue in "control", and I re-enabled the bug in "test".

That means we actually shipped the fix the moment we set up the experiment.

We can just apply the fix ungated.

Reviewed By: Abbondanzo

Differential Revision: D62965254

fbshipit-source-id: edf855619ff9ede6fd406f7f19b3c504ce89f1d6
2024-09-18 10:09:11 -07:00
Thomas NardoneandFacebook GitHub Bot 74aaf7baa1 Nullsafe react/views/view (#46490)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46490

Fix nulls to prepare this module for further Kotlin conversion

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D62641672

fbshipit-source-id: a426ae30bc0529cfd5057cae68f74f3a52cc514f
2024-09-18 09:47:13 -07:00
Rubén NorteandFacebook GitHub Bot a5dd56f7d0 Create flag to disable reentrancy in MountItemDispatcher (#46561)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46561

Changelog: [internal]

We have some logic in `MountItemDispatcher.tryDispatchMountItems` to recursively call itself for as long as there are new items to mount in the general queue. This queue is copied and processed every time `tryDispatchMountItems` is called, but it's possible that during this time new mount operations are added (either from JS or from the mount operations themselves).

This logic can cause frame drops, as we could be finish processing the current frame without processing new mount items (we could do that in the next frame, and in many cases it's just pre-rendering work and state updates that the user can't perceive anyway).

This creates a feature flag to test disabling this behavior and only process whatever mount items are queued at the start of the frame.

Reviewed By: sammy-SC

Differential Revision: D62958009

fbshipit-source-id: ca038c827715411375410215deb5d5e374f5fdb4
2024-09-18 09:10:00 -07:00
DawidandFacebook GitHub Bot 42bad68220 fix app crashing when reloads overlap (#46416)
Summary:
Regarding the [issue](https://github.com/facebook/react-native/issues/44755) where the app sometimes crashes due to race condition when two reloads overlap in unfortunate way. This PR fixes it in some way by introducing throttling on reload command. For now I set it to 700ms as I was still able to reproduce it on 500-550ms for provided repro in the issue. The problem may still happen for bigger apps where reload may take more time to finish.

## 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] - throttle reload command

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

Test Plan: I've tested on provided repro and a smaller app trying to brake it.

Reviewed By: huntie

Differential Revision: D62847076

Pulled By: cipolleschi

fbshipit-source-id: 6471f792d6b692e87e3e98a699443a88c6ef43cd
2024-09-18 07:32:59 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 7de3111f9b Add Maestro test for New Arch Example (#46541)
Summary:
This change adds automated tests for the New Architecture Examples page in RNTester.
It also updates the NativeComponentExample to make sure that iOS and Android behaves in the same way and in a reliable way.

## Changelog:
[Internal] - Adds

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

Test Plan:
* Android:

https://github.com/user-attachments/assets/65ead328-9c4f-4e0f-8b9b-992ffb584566

* iOS:

https://github.com/user-attachments/assets/412a4f68-c9c9-4ff2-a3e9-ae7194deef77

Reviewed By: cortinico

Differential Revision: D62879289

Pulled By: cipolleschi

fbshipit-source-id: 59e15f48f5995b18fd8b3ee24aca726b93e04d9f
2024-09-18 06:15:58 -07:00
Dmitry RykunandFacebook GitHub Bot 4b035d820d Ship shouldSkipStateUpdatesForLoopingAnimations (#46556)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46556

Changelog: [General][Breaking] - Native looping animation will not send React state update every time it finishes.

Facebook
The QE shows neutral results, and has been shipped https://www.internalfb.com/intern/qe2/rn_surface_loading_performance/skip_state_updates_for_looping_animations/wrapup/config

Reviewed By: javache

Differential Revision: D62877191

fbshipit-source-id: 5b04105b3a33535c0da3bc7835098a9c4571d482
2024-09-18 05:28:07 -07:00
Oskar KwaśniewskiandFacebook GitHub Bot 2f5adc3874 fix(iOS): subscribe to orientation changes only on iOS (#46531)
Summary:
This PR adds iOS ifdefs to `RCTUIManager` to subscribe to orientation changes on this platform.

The `UIDeviceOrientationDidChangeNotification` symbol is only available there.

## Changelog:

[IOS] [FIXED] - subscribe to orientation changes in RCTUIManager only on iOS

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

Test Plan: CI Green

Reviewed By: philIip

Differential Revision: D62864013

Pulled By: cipolleschi

fbshipit-source-id: 341df9ac765735273378d017b63fcb7a4d8e98e5
2024-09-18 03:28:26 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 6d61899fc5 Fix analyze_code to use the proper PR number (#46548)
Summary:
Analyze code was still using the CIRCLECI env variable to retrieve the PR number.
This change uses the github one and also removes a duplicated flow check

## Changelog:
[Internal] - Remove duplicated flow check and use gh PR number rather than CircleCI one

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

Test Plan: Tested locally and in CI

Reviewed By: NickGerleman

Differential Revision: D62883758

Pulled By: cipolleschi

fbshipit-source-id: 0c7e97ea9caf4465972424e0b69a899ecfd07095
2024-09-18 02:57:48 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 405d982854 Add patch script to enable E2E tests in CI (#46546)
Summary:
This chang introduces a patch file that can be applied to run the E2E tests in CI.

From the root folder `react-native`, a user can just run:

```sh
git apply packages/rn-tester/scripts/enable-e2e-tests.patch
```

And then add a commit to their PR to see whether the newly added E2E tests are actually running

## Changelog:
[Internal] - add patch to simplify running E2E tests in CI

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

Test Plan: Tested locally

Reviewed By: NickGerleman

Differential Revision: D62880559

Pulled By: cipolleschi

fbshipit-source-id: 19d639b2641aaa50e4f3e0753018d426d2da81c9
2024-09-18 02:18:26 -07:00
Benoit GirardandFacebook GitHub Bot a5dd1be889 Fix setImmediate/clearTimeout mismatch in NativeAnimatedHelper (#46525)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46525

While debugging I noticed that my setTimout was being cleared by someone else. Upon further inspection I found NativeAnimatedHelper which was mismatching setImmediate timer handle with a clearTimeout. This isn't safe and needs to be fixed.

I used this to rename the timer to be more clear to reduce the changes of mismatches.

Changelog:
[General][Fixed] - Fix setImmediate/clearTimeout mismatch in NativeAnimatedHelper that could clear an unrelated setTimeout.

Reviewed By: javache, yungsters

Differential Revision: D62775703

fbshipit-source-id: c1669c60bd08f13a59dd6159be2f471a6c1beebd
2024-09-17 20:33:43 -07:00
Rodolfo Gomez SirimarcoandFacebook GitHub Bot bebd6531b5 Fix ActionSheetIOS crash attempt to insert nil object from objects (#46550)
Summary:
There is a crash on iOS when trying to show an action sheet, but `RCTPresentedViewController` returns null. The code attempts to print an error but fails when casting values.

The issue is that some values, like _title_ or _message_ could be `nil`, which causes a failure when casting them to use in `RCTLogError`.

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

## Stacktrace:

```
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
  0   CoreFoundation                      0x00000001804ae0f8 __exceptionPreprocess + 172
  1   libobjc.A.dylib                     0x0000000180087db4 objc_exception_throw + 56
  2   CoreFoundation                      0x000000018051c84c -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 660
  3   CoreFoundation                      0x00000001804ac9cc +[NSDictionary dictionaryWithObjects:forKeys:count:] + 48
  4   AwesomeProject.debug.dylib          0x0000000106ed9138 __61-[RCTActionSheetManager showActionSheetWithOptions:callback:]_block_invoke_4 + 340
  5   libdispatch.dylib                   0x0000000103f3bec4 _dispatch_call_block_and_release + 24
  6   libdispatch.dylib                   0x0000000103f3d73c _dispatch_client_callout + 16
  7   libdispatch.dylib                   0x0000000103f4d3f8 _dispatch_main_queue_drain + 1228
  8   libdispatch.dylib                   0x0000000103f4cf1c _dispatch_main_queue_callback_4CF + 40
  9   CoreFoundation                      0x000000018040e960 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
  10  CoreFoundation                      0x0000000180409078 __CFRunLoopRun + 1936
  11  CoreFoundation                      0x00000001804084d4 CFRunLoopRunSpecific + 572
  12  GraphicsServices                    0x000000018ef2aae4 GSEventRunModal + 160
  13  UIKitCore                           0x00000001853d0a28 -[UIApplication _run] + 868
  14  UIKitCore                           0x00000001853d46b0 UIApplicationMain + 124
  15  AwesomeProject.debug.dylib          0x0000000106d47bec __debug_main_executable_dylib_entry_point + 96
  16  dyld                                0x0000000102fbd544 start_sim + 20
  17  ???                                 0x00000001030620e0 0x0 + 4345700576
  18  ???                                 0x4e6d800000000000 0x0 + 5651313844908195840
```

## Changelog:

[IOS] [FIXED] - Fix ActionSheetIOS crash `attempt to insert nil object from objects`

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

Test Plan:
I created an example project.

Example: https://github.com/RodolfoGS/react-native-fix-ios-actionsheet

### How to reproduce using the example above:
1. `git clone git@github.com:RodolfoGS/react-native-fix-ios-actionsheet.git`
2. `cd react-native-fix-ios-actionsheet`
3. `npm install`
4. `npm run ios`
5. Tap on _Show Action Sheet_ button on the app
6. Notice the crash

### Steps to create the example from scratch and reproduce the crash:
1. `npx react-native-community/cli@latest init AwesomeProject`
2. `cd AwesomeProject`
3. Install `patch-package` and add this patch to simulate a situation where `RCTPresentedViewController` returns null (https://github.com/RodolfoGS/react-native-fix-ios-actionsheet/blob/main/patches/react-native%2B0.75.3.patch)
4. `npm run ios`
5. Tap on _Show Action Sheet_ button on the app
6. Notice the crash

Reviewed By: caodoan

Differential Revision: D62897554

Pulled By: philIip

fbshipit-source-id: fb978c4648a6c4e36c609783e59367a5997e42cb
2024-09-17 17:22:54 -07:00
NishanandFacebook GitHub Bot 6866968a79 fix(android): linear gradient with platform color (#46290)
Summary:
Fix platform color on android with linear gradient.

## Changelog:

[ANDROID] [FIXED] - Linear gradient with platform colors

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

Test Plan: Added example and testcases

Reviewed By: mdvacca

Differential Revision: D62277253

Pulled By: NickGerleman

fbshipit-source-id: 376ee5ebde61f3cb1ed32e82f71ad5479ebc50a5
2024-09-17 17:21:57 -07:00
Alex Taylor (alta)andFacebook GitHub Bot 582c33b13e Deploy 0.246.0 to xplat + www (#46519)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46519

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D62763246

fbshipit-source-id: db0296d9ec5c04374c9cacb947b4879671044264
2024-09-17 15:07:17 -07:00
javache (Meta Employee)andFacebook GitHub Bot bca232ad90 Fix misleading crash when view config is not found (#30970) (#46518)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46518

## Summary

When a view config can not be found, it currently errors with
`TypeError: Cannot read property 'bubblingEventTypes' of null`. Instead
invariant at the correct location and prevent further processing of the
null viewConfig to improve the error logged.

## How did you test this change?

Build and run RN playground app referencing an invalid native view
through `requireNativeComponent`.

Changelog: [General][Fixed] Improved error message when no view config is found.

DiffTrain build for commit https://github.com/facebook/react/commit/26855e4680dedb21f2c73a069ed691822a242db1.

Test Plan: Sandcastle tests

Reviewed By: jackpope

Differential Revision: D62760863

Pulled By: javache

fbshipit-source-id: c71dacc48fe8795b28840cfb3f53c1f9fc664a16
2024-09-17 14:13:38 -07:00
Eli WhiteandFacebook GitHub Bot 6666df9fb8 Add a union of all the types (#46528)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46528

This is needed for a script that needs to switch over all possible type annotations in the codegen schema.

Reviewed By: GijsWeterings

Differential Revision: D62805189

fbshipit-source-id: 8fd113f4ad0b695b38e92b8d0fc45a991f597fb8
2024-09-17 13:20:04 -07:00
Samuel SuslaandFacebook GitHub Bot 785123b9de fix isEventLoopScheduled_ getting stuck in true (#46538)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46538

changelog: [internal]

When we run synchronous task, it was able to get into a state where RuntimeScheduler stopped executing tasks in the queue and it wouldn't get unstuck. This appeared as non-responsive app.

The problem was that `isEventLoopScheduled_` was not being restarted in case `syncTaskRequests_` was bigger than 0. There is a unit test covering this scenario.

Reviewed By: rubennorte

Differential Revision: D62756582

fbshipit-source-id: 878b8445baea05e8b9eddae05ca0d11d5e93acb6
2024-09-17 13:15:54 -07:00
RexogamerandFacebook GitHub Bot de2f9c0f77 fix: clean up various ESLint issues (#46379)
Summary:
this PR fixes a few small ESLint issues that were showing up under PR diffs.

## Changelog:

[INTERNAL] [FIXED] - Fix various ESLint issues

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

Test Plan: ran JS tests + linter; all passing

Reviewed By: cipolleschi

Differential Revision: D62385788

Pulled By: NickGerleman

fbshipit-source-id: b33d7ade4696bbaed2ac1a3fc2e0b3dff9bb04b7
2024-09-17 13:07:20 -07:00
Alex HuntandFacebook GitHub Bot 188f99b17a Clarify behaviour of noop init command in 0.76 (#46547)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46547

While testing the 0.76 RCs, it was initially unclear to me that `npx react-native init` was both deprecated and **removed** (performs a noop). Update message for clarity.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D62881266

fbshipit-source-id: b9017e63360c7aee5483d437ce1510be9a14ef42
2024-09-17 10:40:35 -07:00
Yedidya FeldblumandFacebook GitHub Bot e9d48ae3c7 migrate from untagged array-range dynamic ctor (#46477)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46477

Reviewed By: NickGerleman

Differential Revision: D62582942

fbshipit-source-id: 24631924c4d2eb8001b7593594d0a3ed5d16e233
2024-09-17 10:19:12 -07:00
Alex HuntandFacebook GitHub Bot 8972d0998f Add missing babel-jest dependency to react-native package (#46539)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46539

Resubmission of D62583665, addressing internal CI errors from dep relocation.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D62867287

fbshipit-source-id: d28d35e2c0a82d7d2bfdaa26c4f9fe8c3a5ef41a
2024-09-17 09:42:36 -07:00
Rubén NorteandFacebook GitHub Bot 89f824b081 Pass default values for feature flags to overrides providers (#46533)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46533

Changelog: [internal]

When defining overrides for feature flags, it's common to have this pattern:

```javascript
myFeatureFlag: () => someCondition ? value : defaultValueForFlag
```

But it's not always obvious how to get the default value defined in the feature flag system. This modifies the API so we receive the default value as a parameter to simplify the logic:

```javascript
myFeatureFlag: (defaultValueForFlag) => someCondition ? value : defaultValueForFlag
```

Reviewed By: mdvacca, rshest

Differential Revision: D62853299

fbshipit-source-id: 9421e31d00662e2a23f1e3fb43bdc9f5cf03fdf3
2024-09-17 09:16:41 -07:00
Rubén NorteandFacebook GitHub Bot 958d35ffd4 Make RN feature flags Flow strict (#46530)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46530

Changelog: [internal]

There's nothing preventing these modules from being `flow strict` instead of `flow strict-local`, so we can just make the change.

Reviewed By: mdvacca

Differential Revision: D62763719

fbshipit-source-id: 1821ef9ad2e8dc67b754eccc77e35ef34400ca0a
2024-09-17 09:16:41 -07:00
MasGaNoandFacebook GitHub Bot 1e59f2e3f8 fix(ios): allow pods mixte type settings on post-install (#46536)
Summary:
Following the discussion on https://github.com/facebook/react-native/issues/46505, this PR aims to allow mixte type configuration (String and/or Array of String) during the post installation of pods.

## 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
-->
[IOS] [FIXED] - allow pods mixte type settings on post-install

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

Test Plan: `packages/react-native/scripts/cocoapods/__tests__/utils-test.rb` test suits was updated to support array and works as expected

Reviewed By: shwanton

Differential Revision: D62870582

Pulled By: cipolleschi

fbshipit-source-id: c0ace6d9d20e6609ceae5aafd236d97fc9e86ddf
2024-09-17 09:11:26 -07:00
anirudh.bhartiandFacebook GitHub Bot 7cdb87eb19 chore: replace mkdirp with mkdir fs (#46388)
Summary:
This pull request replaces the use of mkdirp with Node.js's built-in fs.mkdirSync({ recursive: true }) function, which is available in Node.js version 10.12.0 and above. This change reduces the number of external dependencies and simplifies the codebase by using the native capabilities of Node.js.

The motivation behind this change is to remove the unnecessary mkdirp dependency, as Node.js natively supports recursive directory creation since version 10.12.0. This streamlines the code and reduces the reliance on external libraries.

## Changelog:

[INTERNAL] [REMOVED] - Replaced mkdirp with fs.mkdirSync({ recursive: true }) in build scripts and codegen. Requires Node.js 10.12.0 and above.

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

Test Plan: I ran the build and codegen scripts locally with Node.js version 10.12.0 and above after replacing mkdirp, ensuring the scripts work as expected. No issues were encountered, and all processes, including directory creation and file handling, function correctly.

Reviewed By: cortinico

Differential Revision: D62852488

Pulled By: huntie

fbshipit-source-id: 76f44102a80b499521c156308d276a17d279ce38
2024-09-17 07:03:44 -07:00
Oskar KwaśniewskiandFacebook GitHub Bot 3c17beafe3 fix(iOS): move boost compiler flags and folly dep name to centralized config (#46513)
Summary:
This PR does some further cleanup on the flags passed to cocoapods.

I've moved `boost_compiler_flags` and `folly_dep_name` to `helpers.rb` file.

## Changelog:

[INTERNAL] [FIXED] -  move boost compiler flags and folly dep name to centralized config

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

Test Plan: CI Green

Reviewed By: cortinico

Differential Revision: D62846105

Pulled By: cipolleschi

fbshipit-source-id: dff07ddb49f1f4b559125f2ed8508b32f08d4975
2024-09-17 04:57:36 -07:00
Oskar KwaśniewskiandFacebook GitHub Bot e82743cf66 fix(internal): formatting of tsconfig.json (#46529)
Summary:
This PR is a small fix for the indentation of `tsconfig.json`

## Changelog:

[INTERNAL] [FIXED] -  fix for the indentation of `tsconfig.json`

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

Test Plan: N/A

Reviewed By: cortinico

Differential Revision: D62845892

Pulled By: cipolleschi

fbshipit-source-id: 52a0309027350cd9bba8c2c158887b23ea093876
2024-09-17 04:22:28 -07:00
legobtandFacebook GitHub Bot eacab6d420 chore(react-native): accept failing glog configure in setup script (#46358)
Summary:
Due to `set -e` shell option, missing `xcrun` may cause the setup script to fail on Linux.

Also makes the script continue even if the glog `./configure` call does not succeed.

### Related
- Follow-up to https://github.com/facebook/react-native/pull/44417

## Changelog:

- [Internal] [Fixed] - react-native: make missing xcrun not throw in `ios-configure-glog.sh`
- [Internal] [Fixed] - react-native: accept failing glog ./configure in `ios-configure-glog.sh`

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

Reviewed By: cortinico

Differential Revision: D62851737

Pulled By: cipolleschi

fbshipit-source-id: 3ed76a81b6f428a1697c364698a0dfdd3bbb74f2
2024-09-17 03:41:29 -07:00
Vin XiandFacebook GitHub Bot cf42288181 fix(react-native-xcode): Add back BUNDLE_COMMAND (#46495)
Summary:
In this PR https://github.com/facebook/react-native/issues/45560  the BUNDLE_COMMAND initialization was removed while it is still being used. Without it, building from Xcode throws unknown options error for Physical iOS devices.

I have just brought back the initialization from the PR before that, so the bundle phase is successful.

## Changelog:
[IOS][Fixed] - Add back the BUNDLE_COMMAND

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

Test Plan: I have bundled release builds in Xcode. Everything seems to be fine.

Reviewed By: cortinico

Differential Revision: D62846877

Pulled By: cipolleschi

fbshipit-source-id: 3f07e8c0bc5acf98177582f1fee9a55ae77b31a1
2024-09-17 02:34:06 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 53980d918e Add changelog for 0.76.0-rc.1 (#46521)
Summary:
Add changelog for 0.76.0-rc.1

## Changelog:
[Internal] - add changelog

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

Test Plan: N/A

Reviewed By: cortinico

Differential Revision: D62765002

Pulled By: cipolleschi

fbshipit-source-id: 22e0b60c61276bae919445d811db8e26b2eeb877
2024-09-17 02:15:47 -07:00
Shawn DempseyandFacebook GitHub Bot 9a6354fbbf Annotate DefaultTurboModuleManagerDelegate to avoid redex stripping dep in prod (#46527)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46527

Changelog: [Internal]

**Context**
- `DefaultTurboModuleManagerDelegate.kt` was being stripped by redex since there was no direct dependency.
- This was causing a crash in prod builds
```
Trace: java.lang.RuntimeException: Unable to create application com.facebook.mobilehome.MobileHomeAppShell: java.lang.ClassNotFoundException: Didn't find class "com.facebook.react.defaults.DefaultTurboModuleManagerDelegate" on path: DexPathList
```

**Change**
- Annotate `DefaultTurboModuleManagerDelegate.kt` with `DoNotStripAny`
- Don't strip `DoNotStripAny` annotated classes

Reviewed By: mdvacca

Differential Revision: D62766339

fbshipit-source-id: 7d9bfa04e252c392b94f739443bacf34f593e481
2024-09-16 20:03:07 -07:00
Nick GerlemanandFacebook GitHub Bot 51673e41ae Breaking: Remove ReactViewBackgroundManager and ReactViewBackgroundDrawable (#46166)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46166

## This Diff

This removes some of the legacy utilties used for background manipulation, no longer used anywhere (and very rarely used externally from some previous tests). These conflict with BackgroundStyleApplicator, which should be used instead.

## This Stack

This removes the non-Style-applicator background management paths of the different native components. There have been multiple conflicting changes, and bugs added bc harder to reason about, which motivates making this change as soon as possible. This also lets us formalize guarantees that BaseViewManager may safely manipulate background styling of all built in native components.

There is one still known issue, where BackgroundStyleApplicator does not propagate I18nManager derived layout direction to borders (compared to Android derived root direction). This is mostly an issue for apps that with LTR and RTL context, or force a layout direction, which I would guess is relatively rare, so my plan is to forward fix this later this by enabling set_android_layout_direction which will solve that problem mopre generically.

Changelog:
[Android][Breaking] - Remove ReactViewBackgroundManager and ReactViewBackgroundDrawable

Reviewed By: sammy-SC

Differential Revision: D61658084

fbshipit-source-id: 611f6d78fa4859574c063e9f0395c3dadc1588cc
2024-09-16 19:14:53 -07:00
Nick GerlemanandFacebook GitHub Bot 0fa7e01c5f Remove ReactScrollView Legacy Background Path (#46168)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46168

## This Diff

This removes the legacy path from ReactScrollView and its view manager.

## This Stack

This removes the non-Style-applicator background management paths of the different native components. There have been multiple conflicting changes, and bugs added bc harder to reason about, which motivates making this change as soon as possible. This also lets us formalize guarantees that BaseViewManager may safely manipulate background styling of all built in native components.

There is one still known issue, where BackgroundStyleApplicator does not propagate I18nManager derived layout direction to borders (compared to Android derived root direction). This is mostly an issue for apps that with LTR and RTL context, or force a layout direction, which I would guess is relatively rare, so my plan is to forward fix this later this by enabling set_android_layout_direction which will solve that problem mopre generically.

Changelog: [Internal]

Reviewed By: tdn120

Differential Revision: D61658081

fbshipit-source-id: d6db43e25faf8e1ebd42d2816c7a915b3ed9404e
2024-09-16 19:14:53 -07:00
Nick GerlemanandFacebook GitHub Bot e58d300514 Remove ReactHorizontalScrollView Legacy Background Path (#46161)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46161

## This Diff

This removes the legacy path from ReactHorizontalScrollView and its view manager.

## This Stack

This removes the non-Style-applicator background management paths of the different native components. There have been multiple conflicting changes, and bugs added bc harder to reason about, which motivates making this change as soon as possible. This also lets us formalize guarantees that BaseViewManager may safely manipulate background styling of all built in native components.

There is one still known issue, where BackgroundStyleApplicator does not propagate I18nManager derived layout direction to borders (compared to Android derived root direction). This is mostly an issue for apps that with LTR and RTL context, or force a layout direction, which I would guess is relatively rare, so my plan is to forward fix this later this by enabling set_android_layout_direction which will solve that problem mopre generically.

Changelog: [Internal]

Reviewed By: tdn120

Differential Revision: D61658082

fbshipit-source-id: 98cab5dfcad8beee6d131fcfe122313730a6f665
2024-09-16 19:14:53 -07:00
Nick GerlemanandFacebook GitHub Bot 426b3004ac Remove ReactEditText Legacy Background Path (#46162)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46162

## This Diff

This removes the legacy path from ReactEditText and its view manager.

## This Stack

This removes the non-Style-applicator background management paths of the different native components. There have been multiple conflicting changes, and bugs added bc harder to reason about, which motivates making this change as soon as possible. This also lets us formalize guarantees that BaseViewManager may safely manipulate background styling of all built in native components.

There is one still known issue, where BackgroundStyleApplicator does not propagate I18nManager derived layout direction to borders (compared to Android derived root direction). This is mostly an issue for apps that with LTR and RTL context, or force a layout direction, which I would guess is relatively rare, so my plan is to forward fix this later this by enabling set_android_layout_direction which will solve that problem mopre generically.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D61658080

fbshipit-source-id: 6ac7c5ed230e44fe307640a730e076b903e0674a
2024-09-16 19:14:53 -07:00
Nick GerlemanandFacebook GitHub Bot b4d28293a6 Remove ReactTextView Legacy Background Path (#46171)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46171

## This Diff

This removes the legacy path from ReactTextView and its view manager.

## This Stack

This removes the non-Style-applicator background management paths of the different native components. There have been multiple conflicting changes, and bugs added bc harder to reason about, which motivates making this change as soon as possible. This also lets us formalize guarantees that BaseViewManager may safely manipulate background styling of all built in native components.

There is one still known issue, where BackgroundStyleApplicator does not propagate I18nManager derived layout direction to borders (compared to Android derived root direction). This is mostly an issue for apps that with LTR and RTL context, or force a layout direction, which I would guess is relatively rare, so my plan is to forward fix this later this by enabling set_android_layout_direction which will solve that problem mopre generically.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D61658083

fbshipit-source-id: b753d4eb45091aa31ea870a684c35b71c1ee5036
2024-09-16 19:14:53 -07:00
Nick GerlemanandFacebook GitHub Bot 6291ff0281 Remove ReactViewGroup Legacy Background Path (#46159)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46159

## This Diff

This removes the legacy path from ReactViewGroup and its view manager.

## This Stack

This removes the non-Style-applicator background management paths of the different native components. There have been multiple conflicting changes, and bugs added bc harder to reason about, which motivates making this change as soon as possible. This also lets us formalize guarantees that BaseViewManager may safely manipulate background styling of all built in native components.

There is one still known issue, where BackgroundStyleApplicator does not propagate I18nManager derived layout direction to borders (compared to Android derived root direction). This is mostly an issue for apps that with LTR and RTL context, or force a layout direction, which I would guess is relatively rare, so my plan is to forward fix this later this by enabling set_android_layout_direction which will solve that problem mopre generically.

Changelog: [Internal]

Reviewed By: tdn120

Differential Revision: D61657251

fbshipit-source-id: 6d00a1cac79450d306cf28446e6397d31ceffb19
2024-09-16 19:14:53 -07:00
Nick GerlemanandFacebook GitHub Bot 890970a61f Remove ReactImageView Legacy Background Path (#46167)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46167

## This Diff

This removes the legacy path from ReactImageView and its view manager.

## This Stack

This removes the non-Style-applicator background management paths of the different native components. There have been multiple conflicting changes, and bugs added bc harder to reason about, which motivates making this change as soon as possible. This also lets us formalize guarantees that BaseViewManager may safely manipulate background styling of all built in native components.

There is one still known issue, where BackgroundStyleApplicator does not propagate I18nManager derived layout direction to borders (compared to Android derived root direction). This is mostly an issue for apps that with LTR and RTL context, or force a layout direction, which I would guess is relatively rare, so my plan is to forward fix this later this by enabling set_android_layout_direction which will solve that problem mopre generically.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D61657253

fbshipit-source-id: 96cf1160e466de78c2f133f0e4fb2d9b2e7cf478
2024-09-16 19:14:53 -07:00
Eric RozellandFacebook GitHub Bot a64183b0c6 Call __makeNative on children before __getNativeTag (#46524)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46524

There's an interesting behavior in Animated where we effectively perform an O(N + M) traversal of the Animated graph, calling `__makeNative` on each "input", which in turn tends to call `__makeNative` on each "output" (so we revisit the current node M times when calling `__makeNative` on the M inputs). In practice, the behavior is still O(N), because M is small and finite (most Animated nodes have 1 or 2 inputs).

All that said, some platforms (e.g., react-native-windows) rely on this revisiting behavior, where on the first visit, we recurse the node to its inputs, and on the subsequent visit, we update the `_platformConfig` value without recursion (see https://github.com/facebook/react-native/pull/32736 for the original change adding platformConfig).

A recent change to AnimatedWithChildren (https://github.com/facebook/react-native/pull/46286) eagerly invokes `__getNativeTag` on AnimatedWithChildren in the initial recursion step, which forces materialization of the NativeAnimated node *before* it's `_platformConfig` is set.

There is certainly some refactoring that needs to be done to improve all this, but for now, this change reverts to delay the call to `__getNativeTag` until after at least one `__makeNative` occurs on an input.

## Changelog

[General][Fixed]: Order of operations related to platformConfig propagation in NativeAnimated

Reviewed By: yungsters

Differential Revision: D62768179

fbshipit-source-id: ca9d911503e0630bc3a1309b21f9686aa77ac8b9
2024-09-16 16:24:31 -07:00
Alan LeeandFacebook GitHub Bot 7aeff18970 rename overlayColor to backdropColor in Modal (#46523)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46523

the name change [commit](https://github.com/facebook/react-native/pull/46322/commits/64ee5712f7aa9a3df84589146d00f81bac6d945c) was not properly imported from last diff for https://github.com/facebook/react-native/pull/46322/

redoing the name change: overlayColor -> backdropColor

Changelog:
[general][Fixed] - rename overlayColor prop in Modal to backdropColor

Reviewed By: christophpurrer

Differential Revision: D62760028

fbshipit-source-id: 92d6e8f002c92f4e13136542dce946434516988e
2024-09-16 16:11:55 -07:00
Vincenzo VitaleandFacebook GitHub Bot 40c875deca Support ARG_DISABLE_HOST_LIFECYCLE_EVENTS to conditionally set mDisableHostLifecycleEvents (#46509)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46509

With ARG_DISABLE_HOST_LIFECYCLE_EVENTS it's possible to  conditionally set mDisableHostLifecycleEvents when the ReactFragment gets created.

## Changelog:

[Android][Fixed] ARG_DISABLE_HOST_LIFECYCLE_EVENTS in ReactFragment to allow unmounting a surface without destroying ReactHost.

Reviewed By: rozele

Differential Revision: D62714185

fbshipit-source-id: b6518ff67a9644421b8fe9c7cdc2aa6d62a23651
2024-09-16 12:18:26 -07:00
Oskar KwaśniewskiandFacebook GitHub Bot 40c5e6b64a fix: declare supportedInterfaceOrientations only on iOS (#46512)
Summary:
This PR adds an ifdef to declare `supportedInterfaceOrientations` only on iOS as this property does not affect other platforms causing a build issue.

## Changelog:

[IOS] [ADDED] - declare supportedInterfaceOrientations only on iOS

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

Test Plan: CI Green

Reviewed By: christophpurrer

Differential Revision: D62754746

Pulled By: javache

fbshipit-source-id: e2ca5d96cba87e611c48a87f10bf7831e9051646
2024-09-16 12:10:23 -07:00
Rubén NorteandFacebook GitHub Bot e8dd036c8d Clean up "fixMissedFabricStateUpdatesOnAndroid" feature flag (#46508)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46508

Changelog: [internal]

This cleans up the "fixMissedFabricStateUpdatesOnAndroid" feature flag and enables the fix permanently.

This fixes some state updates in the Fabric shadow tree being missed in some edge cases.

See https://github.com/facebook/react-native/pull/45236 for context.

Reviewed By: rshest

Differential Revision: D62743019

fbshipit-source-id: c24ab8a49a97ca26e60efa2fa4bc6a21ccac52d4
2024-09-16 12:07:35 -07:00
Rubén NorteandFacebook GitHub Bot 16337f1885 Remove redundant systrace block from ShadowTree (#46515)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46515

Changelog: [internal]

This reduces the depth of the Systrace/Perfetto blocks by 1 removing this unnecessary nesting. If for some reason `ShadowTree::tryCommit` runs more than once, it will still show up.

Reviewed By: bgirard, sammy-SC

Differential Revision: D62499855

fbshipit-source-id: 48cce7532a308221c22d04de874870be509fe315
2024-09-16 11:25:07 -07:00
Rubén NorteandFacebook GitHub Bot f8a003b9b2 Rename DOMRectLike as DOMRectInit to align with spec (#46516)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46516

Changelog: [internal]

Minor naming change

Reviewed By: NickGerleman

Differential Revision: D62755993

fbshipit-source-id: ad79002970500d31643fc555c9582e712d264175
2024-09-16 11:18:55 -07:00
Stephanie NicholsonandFacebook GitHub Bot 259f61ac6b Revert D62583665: Add missing babel-jest dependency to react-native package
Differential Revision:
D62583665

Original commit changeset: 8bbcc8736e27

Original Phabricator Diff: D62583665

fbshipit-source-id: e2d56d549fe6720000d81153215dfb2960be1d42
2024-09-16 10:21:29 -07:00
Oskar KwaśniewskiandFacebook GitHub Bot e98c221e5e fix: remove @available for RCTKeyWindow check (#46510)
Summary:
This PR removes `available` for `RCTKeyWindow` after minimum version bump to iOS 15 this check is not needed anymore.

## Changelog:

[IOS] [REMOVED] - remove available for RCTKeyWindow check

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

Test Plan: CI Green

Reviewed By: rshest

Differential Revision: D62752434

Pulled By: javache

fbshipit-source-id: 7b7745d4f27128cdb66053f7fa1cc234435eac31
2024-09-16 09:38:30 -07:00
shubhamguptadream11andFacebook GitHub Bot 4e1d7015c1 feat: add overlayColor prop to modal component for customisable background overlay (#46322)
Summary:
Solves these issues:
- https://github.com/facebook/react-native/issues/18398
- https://github.com/facebook/react-native/issues/12478

Solves this proposal: https://github.com/react-native-community/discussions-and-proposals/discussions/774

## 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] [ADDED] - added overlayColor prop to modal component for customisable background overlay

**Motivation:**
Currently, the React Native Modal component only allows the background to be set to either `transparent` or `white`. This limits the ability to dim the background or apply custom colors, which is essential for creating a more polished and user-friendly interface.

**Change Log:**

Modal Component Enhancements:

- Introduced a new optional prop `overlayColor` to the Modal component.
- Updated the background color logic to prioritize `overlayColor` when transparent is `false`.
- Ensured backward compatibility by defaulting to `white` when `overlayColor` is not provided.

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

Test Plan:
- Test the changes on both iOS and Android devices/emulators to ensure consistent behavior.
- Added example in **rn-tester** app

**Sample screenshot with custom overlayColor passed as 'red'.**

![simulator_screenshot_4F112217-7AD5-4030-8A18-6260AD32988A](https://github.com/user-attachments/assets/52f16ef2-874b-487c-908b-1aa2a1b8fafb)

Reviewed By: cipolleschi

Differential Revision: D62201559

Pulled By: alanleedev

fbshipit-source-id: e990d7f18f5edf61f0107026ea899c5f22d47bfd
2024-09-16 09:29:00 -07:00
Rubén NorteandFacebook GitHub Bot b4c41ec768 Clean up "fixIncorrectScrollViewStateUpdateOnAndroid" feature flag (#46506)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46506

Changelog: [Android][Fixed] Fixed incorrect scroll event/position for scroll views when doing a smooth scroll animation.

We tested this in production and the fix is safe to land.

Reviewed By: rshest

Differential Revision: D62738925

fbshipit-source-id: e1198dac76cf850dfa76a5cee1ef205d5b367d19
2024-09-16 09:22:41 -07:00
Samuel SuslaandFacebook GitHub Bot 8da5924b57 add std::move when adding task to taskQueue (#46511)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46511

changelog: [internal]

task is not used after this line of code. Let's avoid copy shared_ptr's copy constructor.

Reviewed By: rubennorte

Differential Revision: D62751612

fbshipit-source-id: 92b0da44972b200870ef66f3a8482fbde55052ac
2024-09-16 09:16:56 -07:00
Saad NajmiandFacebook GitHub Bot 8ac80e39ea Revert "feat: build codegen on postinstall (#46227)" (#46420)
Summary:
This reverts commit 0cb97f0261.

Revert this commit that adds a `post install` script for a couple of reasons:

1. (EDIT: This turns out to be unrelated) The `postinstall` script causes `yarn install` to fail on React Native macOS, where we use Yarn 4. I'm not entirely sure why, but I probably won't debug it for the rest of the reasons.
2. `postinstall` scripts (at least inside Microsoft) are viewed as a security risk. Any package in your dependency tree can get compromised, add the phase, and run arbitrary code. This has happened in the past with React Native past if I recall correctly. As such, we disable `postinstall` scripts in many of our repos (including `rnx-kit` and `react-native-test-app`).
3. The issue this is trying to solve is to help newcomers avoid a stale cache when they switch branches in the React Native monorepo and only run `yarn install`. I think it would be sufficient to add some documentation somewhere that it is expected one runs `yarn && yarn build` to use this repo locally? That's a fairly common practice in monorepos, at least ones inside Microsoft.

## Changelog:

[INTERNAL] [SECURITY] - Remove post install script phase in the React Native monorepo

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

Test Plan: CI should pass

Reviewed By: christophpurrer, robhogan, cortinico, rshest

Differential Revision: D62755022

Pulled By: huntie

fbshipit-source-id: bf94ed33e3e451ea337ef7a6984f7ba964d0b212
2024-09-16 09:14:54 -07:00
Alex HuntandFacebook GitHub Bot 8f1c227721 Add missing babel-jest dependency to react-native package (#46462)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46462

While adding D62583337, I noticed that `react-native` doesn't specify `babel-jest` as a dependency, despite referencing it in the included `jest-preset.js` — instead this would need to be installed by the template/project.

If we want to change this in future, we should consider a separate `react-native/jest-preset` package. However, I strongly believe this is the right location for this dependency: installing `react-native` = all parts of it work.

(Note that in the React Native monorepo, we are using `dependencies` for both dev and runtime deps in packages.)

Changelog: [Internal]

allow-executable-binary

## allow-executable-binary: Bypassed as this is a managed JavaScript dependency that is pre-existing in other parts of the codebase

Reviewed By: robhogan

Differential Revision: D62583665

fbshipit-source-id: 8bbcc8736e2740e45793d7b7e225ccfd1ca7f898
2024-09-16 08:25:12 -07:00
Alex HuntandFacebook GitHub Bot 38a490574c Switch to Hermes parser in Jest preset (#46465)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46465

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

Changelog: [Internal]

bypass-github-export-checks

Reviewed By: robhogan

Differential Revision: D62583337

fbshipit-source-id: 64813d84c2a6395be8ef4f138398834ddae6e54b
2024-09-16 08:25:12 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 74d9a4c38c Add changelog for 0.76.0-rc.0 (#46419)
Summary:
This PR adds the Changelg for 0.76.0-rc.0

## Changelog:
[Internal] - Add changelog for 0.76.0-rc.0

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

Test Plan: N/A

Reviewed By: christophpurrer

Differential Revision: D62443133

Pulled By: cipolleschi

fbshipit-source-id: 814d1de8b90de819c60e3962430132544539bdd7
2024-09-16 07:58:00 -07:00
Pascoal JúniorandFacebook GitHub Bot 14e0d0dffb Add support for new iOS text content type cellular EID and cellular IMEI (#46378)
Summary:
Support for new iOS text content type to autofill cellular EID or cellular IMEI:
- https://developer.apple.com/documentation/uikit/uitextcontenttypecellulareid?language=objc
- https://developer.apple.com/documentation/uikit/uitextcontenttypecellularimei?language=objc

## 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
-->
[IOS] [ADDED] - new text content type cellular EID and cellular IMEI

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

Test Plan:
JavaScript Tests - yarn test [PASSED]
- No errors related with the changes

Flow - yarn flow && yarn lint [PASSED]
- No errors related with the changes

iOS Tests - ./scripts/objc-test.sh test [PASSED]
- No errors related with the changes

Build RNTester [PASSED]
- No errors related with the changes
- Proof:
<img width="838" alt="Screenshot 2024-09-07 at 12 06 48" src="https://github.com/user-attachments/assets/836a71f2-8adb-428f-b98d-8b84f71e93d6">
<img width="806" alt="Screenshot 2024-09-07 at 12 07 29" src="https://github.com/user-attachments/assets/7b33b919-3b29-4846-b6a2-3427dbbc2869">
<img width="1221" alt="Screenshot 2024-09-07 at 12 13 02" src="https://github.com/user-attachments/assets/58b369e9-5281-4a6b-9663-1cbd77439510">

![Simulator Screenshot - iPhone 15 Pro - 2024-09-07 at 12 06 36](https://github.com/user-attachments/assets/9411c9d9-0b93-4f47-b21c-cbd95810f4c7)
Note: Since the test was done using an iOS simulator the autofill suggestion won't appear for the cellularEID or cellularIMEI

Reviewed By: cortinico

Differential Revision: D62386126

Pulled By: cipolleschi

fbshipit-source-id: 50da572650b796d0426a15f0c06fd0c52a8247f5
2024-09-16 07:27:01 -07:00
Samuel SuslaandFacebook GitHub Bot 1ac3b890d8 add support for multiple calls to Linking.getInitialURL (#46502)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46502

changelog: [internal]

At the moment, Linking module has undocumented restriction that if you call it twice when Android Activity is not available, it will return with an error.

This is unnecessary and can be handled more sensibly.

Reviewed By: javache, yungsters

Differential Revision: D62708123

fbshipit-source-id: 79a6beb70e834e631f7bedaf6a64076b050a7daa
2024-09-16 06:45:53 -07:00
Samuel SuslaandFacebook GitHub Bot b63ec30614 fix race condition in IntentModule.mInitialURLListener (#46499)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46499

changelog: [internal]

IntentModule.mInitialURLListener is accessed and mutated on three different threads and is missing synchronisation.

1. In [waitForActivityAndGetInitialURL](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java#L83) it is accessed and mutated from thread mqt_v_native.
2.  In [LifecycleEventListener](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java#L97) it is mutated from the main thread.

3. In [invalidate](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java#L44) it is read and mutated on a another thread.

Reviewed By: javache

Differential Revision: D62698183

fbshipit-source-id: b437928c4d5d9b9d20bcad601805b2f7f402b33c
2024-09-16 06:45:53 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 20b141508b Add TS types for Codegen (#46484)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46484

We recently realized that we don't have TS types for Codegen.
These are needed to let our users use these types when writing Specs in TS

## Changelog
[General][Added] - Add CodegenTypes for TS

Reviewed By: christophpurrer

Differential Revision: D62644516

fbshipit-source-id: 92bb7e8998d31806f6eb63319fb6d406fcd65ad8
2024-09-16 06:28:33 -07:00
Oskar KwaśniewskiandFacebook GitHub Bot 52718b530e feat: stub RCTStatusBarManager for non iOS Apple platforms (#45896)
Summary:
Following one of my previous PRs: https://github.com/facebook/react-native/pull/45176 I'm adding same conditionals to another module.

StatusBar API is supported on this platforms:

| Platform  | Support |
| ------------- | ------------- |
| macOS |    |
| tvOS |    |
| visionOS |    |
| iOS/iPadOS |    |

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

[INTERNAL] [ADDED] - Conditionals for iOS only code in RCTStatusBarManager.mm

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

Test Plan: CI Green / Make sure everything works as before

Reviewed By: cortinico

Differential Revision: D62579943

Pulled By: cipolleschi

fbshipit-source-id: 0c198c7732d253993638d825ca83be076bb09b90
2024-09-16 05:56:40 -07:00
Vitali ZaidmanandFacebook GitHub Bot 8fba154b66 Fix source mapping for codegenNativeCommands (#46452)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46452

`babel-plugin-codegen` transforms `codegenNativeComponent`s by expending it with a whole set of many commands (~40 lines) that don't have a good equivalent on the source file.

Currently these lines are pointing to random parts of the due to a bug that causes the source maps to be incorrect and confusing.

Instead, I point all these generated lines of code to the default export as the only line that can represent them.

This way, if an error is thrown from that generated code it would point to that export.

If the users are confused by how it works, there's a comment in the function that is used in the default export in these that explains it:
```
// If this function runs then that means the view configs were not
// generated at build time using `GenerateViewConfigJs.js`. Thus
// we need to `requireNativeComponent` to get the view configs from view managers.
// `requireNativeComponent` is not available in Bridgeless mode.
// e.g. This function runs at runtime if `codegenNativeComponent` was not called
// from a file suffixed with NativeComponent.js.
function codegenNativeComponent<Props>(
  componentName: string,
  options?: Options,
): NativeComponentType<Props> {
```

The transformation is from all the types and exports after the imports:
[`MyNativeViewNativeComponent` for example](https://github.com/facebook/react-native/blob/773a02ad5d3cc38e0f5837b42ba9a5e05a206bf9/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js#L4)
Which is roughly (ignoring all typing):
```
// types and exports
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
  supportedCommands: [
    'callNativeMethodToChangeBackgroundColor',
    'callNativeMethodToAddOverlays',
    'callNativeMethodToRemoveOverlays',
    'fireLagacyStyleEvent',
  ],
});

export default (codegenNativeComponent<NativeProps>(
  'RNTMyNativeView',
): MyNativeViewType);

```
to roughly:
```
  var React = require('react');
  var nativeComponentName = 'RNTMyNativeView';
  var __INTERNAL_VIEW_CONFIG = {
    uiViewClassName: 'RNTMyNativeView',
    bubblingEventTypes: {
      topIntArrayChanged: { /* */ },
      topAlternativeLegacyName: { /* */ },
    },
    validAttributes: {
      opacity: true,
      values: true,
      ...require('ViewConfigIgnore').ConditionallyIgnoredEventHandlers({
        onIntArrayChanged: true,
        onLegacyStyleEvent: true
      })
    }
  };
  var _default = require('NativeComponentRegistry').get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);
  var Commands = {
    callNativeMethodToChangeBackgroundColor(ref, color) {
      require('RendererProxy').dispatchCommand(ref, "callNativeMethodToChangeBackgroundColor", [color]);
    },
    callNativeMethodToAddOverlays(ref, overlayColors) {
     require('RendererProxy').dispatchCommand(ref, "callNativeMethodToAddOverlays", [overlayColors]);
    },
    callNativeMethodToRemoveOverlays(ref) {
      require('RendererProxy').dispatchCommand(ref, "callNativeMethodToRemoveOverlays", []);
    },
    fireLagacyStyleEvent(ref) {
     require('RendererProxy').dispatchCommand(ref, "fireLagacyStyleEvent", []);
    }
  };
  exports.default = _default;
  exports.__INTERNAL_VIEW_CONFIG = __INTERNAL_VIEW_CONFIG;
  exports.Commands = Commands;
```

Changelog: [Fix] Fixed source maps in Native Components JS files that use codegenNativeComponent

Reviewed By: robhogan, huntie

Differential Revision: D62443699

fbshipit-source-id: 522b4382736a8fed93a1bc687a78d6885fe7c9d5
2024-09-16 05:22:38 -07:00
Rodolfo Gomez SirimarcoandFacebook GitHub Bot b4532adad4 Fix Headless Crash Tried to finish non-existent task with id (#46497)
Summary:
Sometimes a headless task tries to finish, but it doesn’t exist, which causes an exception.
No one knows how to reliably reproduce it, as it could be a race condition. However, if you attempt to remove a task that has already been removed, it shouldn’t cause an issue since you're trying to remove something that’s already gone (which is exactly what you want).

Fixes:
 - https://github.com/facebook/react-native/issues/46496
 - https://github.com/facebook/react-native/issues/33883
 - https://github.com/facebook/react-native/issues/27597
 - https://github.com/transistorsoft/react-native-background-fetch/issues/202
 - https://github.com/transistorsoft/react-native-background-fetch/issues/369
 - https://github.com/transistorsoft/react-native-background-geolocation/issues/2096
 - https://github.com/jpush/jpush-react-native/issues/78

## Stacktrace:
```
Fatal Exception: java.lang.AssertionError: Tried to finish non-existent task with id 28.
  at com.facebook.infer.annotation.Assertions.assertCondition(Assertions.java:88)
  at com.facebook.react.jstasks.HeadlessJsTaskContext.finishTask(HeadlessJsTaskContext.java:179)
  at com.facebook.react.jstasks.HeadlessJsTaskContext$3.run(HeadlessJsTaskContext.java:217)
  at android.os.Handler.handleCallback(Handler.java:958)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loopOnce(Looper.java:257)
  at android.os.Looper.loop(Looper.java:368)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:233)
  at java.lang.Thread.run(Thread.java:1012)
```

## Screenshot

https://github.com/user-attachments/assets/101f0f53-95c9-40ec-a59d-22d6d474b457

## Changelog:

[ANDROID] [FIXED] - Fix Headless Crash `Tried to finish non-existent task with id`

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

Test Plan:
I created an example where I attempt to remove a task that doesn’t exist.

Example: https://github.com/RodolfoGS/react-native-fix-non-existent-task

### How to reproduce using the example above:
1. `git clone git@github.com:RodolfoGS/react-native-fix-non-existent-task.git`
2. `cd react-native-fix-non-existent-task`
3. `npm install`
4. `npm run android`
5. Notice the crash

### Steps to create the example from scratch and reproduce the crash:
1. `npx react-native-community/cli@latest init AwesomeProject`
2. `cd AwesomeProject`
3. Add call to finishTask to reproduce the crash (https://github.com/RodolfoGS/react-native-fix-non-existent-task/commit/6fe3c1388a58b9ffdcca5f9c6f00a4f2fea725ea)
4. `npm run android`
5. Notice the crash

Reviewed By: javache

Differential Revision: D62738059

Pulled By: rshest

fbshipit-source-id: 3232dc76ba8a069279c2b741d62372537a3f9140
2024-09-16 04:29:47 -07:00
David VaccaandFacebook GitHub Bot 6dbbbe33fd Delete pre-allocated views that were never mounted on the screen (#46473)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46473

This diff extends the renderer of react native to ensure that pre-allocated views that were never mounted on the screen are deleted as soon as the shadow node is deleted from JS

This feature is controlled by the ReactNativeFeatureFlag: enableDeletionOfUnmountedViews

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D62559190

fbshipit-source-id: 1af6785fc57256d12750db64489c9ecc6cf98c9d
2024-09-16 04:16:36 -07:00
Sam ZhouandFacebook GitHub Bot 68a92aa312 Replace React.Ref with React.RefSetter in react-native (#46488)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46488

React.Ref includes string | number to support legacy string ref, which will be killed in React 19. Therefore, the type is deprecated in Flow. This diff changes the type to use React.RefSetter instead.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D62649800

fbshipit-source-id: 81bcfbb052e2039b23829dac8de242bfb0fdca3a
2024-09-15 20:22:44 -07:00
Tim YungandFacebook GitHub Bot 7bd4a54968 Animated: Restore AnimatedNode.prototype.toJSON (#46498)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46498

Looks like this is still necessary because we still run into this error when using the Components tab when using React DevTools:

> TypeError: cyclical structure in JSON object

This effectively reverts https://github.com/facebook/react-native/pull/46382.

Changelog:
[General][Changed] - AnimatedNode (and its subclasses) once again implement `toJSON()`.

Reviewed By: javache

Differential Revision: D62690380

fbshipit-source-id: d5b7c1d156b49838abefe48a7d7b61471cc3488a
2024-09-14 22:21:27 -07:00
Kevin GozaliandFacebook GitHub Bot 7d621f5eb7 Android: check SafeAreaView component existence before exporting (#46500)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46500

We're in the process of adding the required native component to all apps we maintain.
Until that is fully completed, fall back to using View if the native component
doesn't exist.

Changelog: [Internal]

Reviewed By: shwanton

Differential Revision: D62701331

fbshipit-source-id: d26c946af3a68231d0714e89d5e41be311399036
2024-09-14 20:20:34 -07:00
Tim YungandFacebook GitHub Bot afb40e9f2a Animated: Alias onUpdateRef Type Argument (#46469)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46469

This causes VS Code to syntax highlight incorrectly, so let's use a type alias to workaround that limitation.

Changelog:
[Internal]

Reviewed By: tyao1

Differential Revision: D62595120

fbshipit-source-id: 97fc3caded51190a7840de91025eeb71c6290be8
2024-09-13 20:10:18 -07:00
Melissa LiuandFacebook GitHub Bot 6bcaa09749 evenly distribute adjustment between top and bottom
Summary:
Before we were dividing proportionally and were noticing some truncation at the bottom. It seems that the truncation was disproportionately because of the way the metrics are calculated. Through guess and check, dividing equally between top and bottom seems to yield better results... 🤡

Changelog: [internal]

Reviewed By: NickGerleman, xunrongl

Differential Revision: D62665295

fbshipit-source-id: b1589c75251d68eaf75e32598ee84fbac457ae4a
2024-09-13 17:50:10 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot 17faac4170 Implement outline properties on Android (#46284)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46284

This diff adds:

`outline-width`: https://developer.mozilla.org/en-US/docs/Web/CSS/outline-width
`outline-color`: https://developer.mozilla.org/en-US/docs/Web/CSS/outline-color
`outline-style`: https://developer.mozilla.org/en-US/docs/Web/CSS/outline-style
`outline-offset`: https://developer.mozilla.org/en-US/docs/Web/CSS/outline-offset

Using `BackgroundStyleApplicator`

Changelog: [Android] [Added] - Outline properties `outline-width`, `outline-color`, `outline-style` & `outline-offset`

Reviewed By: NickGerleman

Differential Revision: D61293868

fbshipit-source-id: d8787bbf1560cf46b92ad039afde9c1e7ab669da
2024-09-13 17:26:37 -07:00
Rubén NorteandFacebook GitHub Bot 40aaeb7181 Improve FlatList estimates for items not yet laid out (#46487)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46487

Changelog: [General][Fixed] Fixed accuracy of FlatList estimations to determine what elements are visible in the rendering window.

This fixes a bug in FlatList where it thinks that some elements are visible in the rendering window, when they're not. Specifically, if a cell hasn't been laid out yet, it ignores all the information it already has on the ones that had, and estimates its position and offset based on the estimated size of the cells. In this case, if the first element has a larger offset because the list has a header, that offset is ignored in this case.

One observed result of this is that in a list where there's a header and a single cell that occupy the whole rendering window, FlatList thinks it needs to pre-render an additional element because the header is ignored.

Reviewed By: NickGerleman

Differential Revision: D62649060

fbshipit-source-id: 437bae79916707ca1d08784190508a9f7e36688e
2024-09-13 16:18:33 -07:00
David VaccaandFacebook GitHub Bot 70188fe222 Introduce ReactNativeFeatureFlag enableDeletionOfUnmountedViews (#46467)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46467

This diff introduces a new feature flag called ReactNativeFeatureFlag.enableDeletionOfUnmountedViews, which will ensure that pre-allocated views that were never mounted on the screen are deleted as soon as the shadow node is deleted from JS

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D62559188

fbshipit-source-id: 61f19a6dd38536de9f70fecc2937793681036f68
2024-09-13 13:46:12 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot 6f84b63d64 Rename DropShadowPrimitive to DropShadowValue (#46476)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46476

Keep the type naming consistent with examples like `DimensionValue`, `ColorValue`, etc.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D62614579

fbshipit-source-id: 824ea9af17487a4459e8f39d9374e2e00452db43
2024-09-13 12:35:57 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot eaff327e0d Rename BoxShadowPrimitive to BoxShadowValue (#46485)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46485

Keep the type naming consistent with examples like `DimensionValue`, `ColorValue`, etc.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D62614444

fbshipit-source-id: 3ff66d3f52623b6fb7bd8d31d2910aa255ae8a31
2024-09-13 12:35:57 -07:00
Nick GerlemanandFacebook GitHub Bot 2d6c59e1d4 Unhide new arch layout props (#46478)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46478

These are all supported in the new arch (default as of 0.76), across all platforms. but were previously hidden from types, and undocumented.

I will make a pick request for this change, and we should then add these to documentation.

Changelog:
[General][Added] - Unhide new arch layout props

Reviewed By: cortinico

Differential Revision: D62616897

fbshipit-source-id: f6c2e71785284e667824a76918ccf2724adc4e98
2024-09-13 12:04:52 -07:00
Nicola CortiandFacebook GitHub Bot f3a969f38d Do not print Bridgeless Mode is enabled on console anymore. (#46486)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46486

We probably don't need this extra log anymore as this information is already avaialbe from the start application log.

Changelog:
[General] [Changed] - Do not print Bridgeless Mode is enabled on console anymore

Reviewed By: fkgozali

Differential Revision: D62639866

fbshipit-source-id: 720bb1446a1e1be71bf27830fe4156ae64a1586f
2024-09-13 11:50:32 -07:00
Nicola CortiandFacebook GitHub Bot 4d814f20af Back out "Remove some Tasks overhead" (#46483)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46483

Original commit changeset: 631d741bd2ec

This is breaking the RedBox on React Native 0.76 on Android when not connected to Metro.

Original Phabricator Diff: D62213722

Changelog:
[Internal] [Changed] - Back out "[react-native] Remove some Tasks overhead"

Reviewed By: cipolleschi

Differential Revision: D62644614

fbshipit-source-id: a092614da78bef65546c2539a3ebc9bff5e807b2
2024-09-13 11:35:24 -07:00
Nicola CortiandFacebook GitHub Bot d7884a6bb8 RNGP - Sanitize the output of the config command (#46482)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46482

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

I'm sanitizing the output of the `config` command + I've added some more logging in case of failure.

Changelog:
[Android] [Fixed] - RNGP - Sanitize the output of the config command

Reviewed By: cipolleschi

Differential Revision: D62641979

fbshipit-source-id: c13d27a42beeb7a973c1802e7204631d49d3d09b
2024-09-13 10:42:20 -07:00
Oskar KwaśniewskiandFacebook GitHub Bot 3cbaddbc16 fix(iOS): fallback to old path when dynamic resolve fails (#46432)
Summary:
This PR is a follow-up after https://github.com/facebook/react-native/issues/46181 this change makes sure that if the `require.resolve` fails we still fall back to the old behavior.

The `require.resolve` was failing for local builds of OOT platforms (because in OOT platforms mono repo `react-native` is renamed to `react-native-platform-name`)

## Changelog:

[IOS] [FIXED] - Fallback to old resolve mechanism when node require fails to resolve react native path

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

Test Plan: CI Green

Reviewed By: christophpurrer

Differential Revision: D62577183

Pulled By: cipolleschi

fbshipit-source-id: d62d9c2a5eee3546a81d2aad52b7f73763315b18
2024-09-13 09:44:19 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 11a2ab1cc5 Fix some basic warning while building (#46463)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46463

We had some basic warnings emitted by React Native components due to unused parameters or missing documentations.

This change fixes some of those

## Changelog:
[Internal] - Fix some build warnings

Reviewed By: NickGerleman

Differential Revision: D62583790

fbshipit-source-id: 329acc67ce64c00757a8568460ee68b85a62b6e9
2024-09-13 08:19:55 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 62d4768984 Inhibit warning in 3p libraries (#46464)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46464

React Native uses some 3P libraries that are emitting some warnings for which we can't do anything about.

This change suppress those warnings.

## Changelog:
[Internal] - Suppress 3p warnings

Reviewed By: cortinico

Differential Revision: D62582960

fbshipit-source-id: 79e8c28725177f5f47359da86f865e770dcf7c7b
2024-09-13 08:19:55 -07:00
Riccardo CipolleschiandFacebook GitHub Bot f529fe4876 Exclude dSYM from the archive (#46472)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46472

Currently, we are building the Debug symbols (dSYM) for hermes dSYM but we are not shipping them with the xcframework.
This is correct, because Debug symbols can increase the size of Hermes thus enalrging the iOS IPA and increasing the download time when installing pods.

We distribute the dSYM separatedly, in case users needs to symbolicate Hermes stack traces.

However the path to the dSYM still appears in the Info.plist of the universal XCFramework and this can cause issues when submitting an app to apple.

This change should remove those lines from the universal framework.

It fixes https://github.com/facebook/react-native/issues/35863

## Changelog
[Internal] - Remove dSYM path from Info.plist

Reviewed By: cortinico

Differential Revision: D62603425

fbshipit-source-id: 038ec3d6b056a3d6f5585c8125d0430f56f11bb9
2024-09-13 08:16:19 -07:00
Riccardo CipolleschiandFacebook GitHub Bot de39a204c3 Fix SVC Validator for Box Shadow and filter (#46454)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46454

The SVC Validator have no idea on how to process a simple NSArray *.

With this change, we are creating two named types for the NSArray:
* BoxShadowArray
* FilterArray
To create unique types that we can reference in JS.

We are then enhancing the `getProcessor` function to return the proper processor when those types are found in the NativeViewConfig

## Changelog:
[iOS][Fixed] - Fixed warnings when validating SVC

## Facebook:
This change is OTA safe: even when we ship the JS before the native code, the new cases in the switch will be never hit, similarly to the situation we have right now.

As soon as the native code is shipped, the new cases will start get hit and the wrning will disappear

Reviewed By: NickGerleman

Differential Revision: D62574612

fbshipit-source-id: d173bf5534ee5e436f23a4bc6e2fb25e72a4b06d
2024-09-13 08:10:10 -07:00
Riccardo CipolleschiandFacebook GitHub Bot fad4a0783b Fix Basic SVC for RNTester iOS (#46439)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46439

The SVC for some components on iOS got out of sync.
This was creating warnings in the React Native DevTools and it was affecting the release of 0.76.

With this change, I updated the manually written SVC so that we don't have warnings anymore.

We still have to fix the `boxShadow` and `filter`. This will happen in a later change.

## Changelog
[iOS][Fixed] - Solved SVC warnings for RNTester

Reviewed By: NickGerleman

Differential Revision: D62501704

fbshipit-source-id: 3c02f7615c3511a97eba73a2ddaa713d2e4e30f0
2024-09-13 08:10:10 -07:00
Robert PasińskiandFacebook GitHub Bot f3fee67c54 fix: AppRegistry not callable from Native in bridgeless (#46480)
Summary:
AppRegistry was not treated as a Callable Module in bridgeless mode. This is breaking headless tasks on Android.

Fixes:

 - https://github.com/facebook/react-native/issues/46050

## Changelog:

[ANDROID] [FIXED] - Made AppRegistry callable from Native code in Bridgeless (fixes headless tasks)

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

Test Plan: Used repro from linked issue

Reviewed By: javache

Differential Revision: D62637486

Pulled By: cortinico

fbshipit-source-id: 756527003ac6d712e76c02c188e280d15c010068
2024-09-13 07:58:19 -07:00
shubhamguptadream11andFacebook GitHub Bot b98b9f1fa7 fix(iOS): fire onMomentumScrollEnd when UIScrollView is removed from window (#46277)
Summary:
Solves this issue: https://github.com/facebook/react-native/issues/46276

## 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] [ADDED] - fire onMomentumScrollEnd when UIScrollView is removed from window

**Why the issue is happening?**
The `onMomentumScrollEnd` event is typically triggered by the `UIScrollView` delegate methods `scrollViewDidEndDecelerating` and `scrollViewDidEndScrollingAnimation`. However, if the scroll view is removed from the window while navigating away, these delegate methods are not called, resulting in the event not being dispatched.

This behaviour was particularly problematic in scenarios where a scroll view is in motion, and the user navigates away from the screen before the scrolling completes. In such cases, the `onMomentumScrollEnd` event would never fire, which further make scroll area un touchable or un responsive.

**What we changed?**
In the didMoveToWindow method, we added logic to handle the scenario where the UIScrollView is being removed from the window (i.e., when the component is unmounted or the user navigates away). Here’s a breakdown of the changes:

- **Added a Check for Scroll State:** We check if the UIScrollView was decelerating or had stopped tracking (_scrollView.isDecelerating || _scrollView.isTracking == NO).

- **Manually Triggered onMomentumScrollEnd:** If the scroll view was in motion and is being removed from the window, we manually trigger the `onMomentumScrollEnd` event to ensure that the final scroll state is captured.

**_I had fixed this issue on both Old and New arch._**

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

Test Plan:
Attaching a video with working solution:

https://github.com/user-attachments/assets/1a1f3765-3f11-46c3-af18-330c88478db8

Reviewed By: andrewdacenko

Differential Revision: D62374798

Pulled By: cipolleschi

fbshipit-source-id: 014be8d313bab0257459dc4e53f5b0386a39d5e0
2024-09-13 06:33:30 -07:00
Philip SuandFacebook GitHub Bot f8287e25e1 feat(scripts): Support multiple bundles in react-native-xcode.sh (#46339)
Summary:
This enables projects to have multiple bundles built during the Xcode bundling phase (e.g. for projects where you might have a PhoneScene and a CarPlayScene each with their own RootView and bundle, if you're using [react-native-carplay](https://github.com/birkir/react-native-carplay)).

## Changelog:
[IOS] [ADDED] - User-configurable BUNDLE_NAME when building bundles

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

Test Plan:
Built my project with the following Xcode "Bundle React Native code" build step:
```sh
set -e

export SOURCEMAP_FILE="$(pwd)/../main.jsbundle.map";
SOURCEMAP_FILE="$(pwd)/../main.jsbundle.map"

WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"

/bin/sh -c "BUNDLE_NAME=main $WITH_ENVIRONMENT $REACT_NATIVE_XCODE"
/bin/sh -c "BUNDLE_NAME=carplay $WITH_ENVIRONMENT $REACT_NATIVE_XCODE"
```

Then launched the app with a modified `AppDelegate.swift` which loaded main.jsbundle into one RootView and carplay.bundle into another RootView.

Reviewed By: cortinico

Differential Revision: D62577314

Pulled By: cipolleschi

fbshipit-source-id: 22312ca144146da6c71a8533a1883e720aff1e85
2024-09-13 05:09:51 -07:00
Nicola CortiandFacebook GitHub Bot 2136c19944 Bump SoLoader to 0.12.1 and remove unnecessary extra manifest metadata. (#46461)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46461

This bumps SoLoader to 0.12.1 inside React Native and cleans up the extra
`com.facebook.soloader.enabled` metadata which are not necessary anymore.

Changelog:
[Internal] [Changed] - Bump SoLoader to 0.12.1 and remove unnecessary extra manifest metadata

Reviewed By: cipolleschi

Differential Revision: D62581188

fbshipit-source-id: ff990c0af1f0f51070037fcb4c7c13fbe6bae234
2024-09-13 03:51:58 -07:00
Phillip PanandFacebook GitHub Bot a777a8937e delete partialBatchDidFlush (#46471)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46471

Changelog: [iOS][Breaking] Delete partialBatchDidFlush

this is an extremely old method on RCTBridgeModule similar to batchDidComplete that was special cased for UIManager. however, UIManager ended up deleting its implementation of partialBatchDidFlush. we had this janky logic that would iterate through all of the modules to call this partialBatchDidFlush when we really just wanted to do this for the UIManager. this logic is risky because the _moduleDataByID array is not thread safe.

i feel we can skip the deprecation cycle for this method, because i searched through GH and i did not find any callsites of this: https://github.com/search?q=partialBatchDidFlush&type=code&p=1.

Reviewed By: realsoelynn

Differential Revision: D62600722

fbshipit-source-id: d889bad54170a267e938b588e2fd6f558583a904
2024-09-12 22:57:11 -07:00
Phillip PanandFacebook GitHub Bot 731bd95c43 do not iterate through moduleData array to handle UIManager batch completion (#46470)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46470

Changelog: [iOS][Deprecated] - Deprecating RCTBridgeModule batchDidComplete and adding configuration to disable it

batchDidComplete is used for the UIManager to initiate a layout and mount after a callback has been initiated by the bridge. however, we iterate through the whole module array in order to get this single UIManager, which is unnecessary. this also increases risk of a crash because the module array is shared between threads.

Reviewed By: realsoelynn

Differential Revision: D62600034

fbshipit-source-id: 6c98df7d5ab282015181fb07764121693bcc141e
2024-09-12 22:57:11 -07:00
Tim YungandFacebook GitHub Bot 1c7fd8baa8 Animated: Switch to useInsertionEffect (#46474)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46474

Changes `useAnimatedPropsLifecycle_passiveEffects` (the experimental lifecycle management in `useAnimatedProps`) to `useInsertionEffect` instead of `useEffect`. This has a few benefits:

1. Prevents any Activity detach and attach events from triggering Animated lifecycle work (which adds to effect mounting and unmounting time).
2. Fixes batching of native Animated operations across components. (Since we flush the operation queue in a passive effect, enqueueing operations in a passive effect causes weird interleaving of enqueuing and flushing.)
3. Enables animations to be started in layout effects.

Changelog:
[Internal]

Reviewed By: bvanderhoof

Differential Revision: D62602336

fbshipit-source-id: 3f6412387d87d4ea4135a29893135b4a64638809
2024-09-12 22:05:02 -07:00
Melissa LiuandFacebook GitHub Bot 5e288d0cd4 fix for bottom adjustment (#46475)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46475

fm.top is negative, so we want to add in order to decrease the absolute value, but fm.bottom is positive, so we need to subtract instead here

Changelog: [internal]

Reviewed By: NickGerleman

Differential Revision: D62612192

fbshipit-source-id: fc942abcb5a1ddedd6547aca66a188736e4ec029
2024-09-12 19:17:23 -07:00
Eric RozellandFacebook GitHub Bot bb3ec4d6c3 Add protected constructor to decouple ReactFragment lifecycle events from ReactHost (#46425)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46425

It's entirely plausible that one would want to run a ReactFragment that does not tear down the ReactHost when it is destroyed. This adds a protected constructor that can be used to disable host lifecycle events in a ReactFragment. When disabled, the `onDestroy` method of the ReactFragment simply stops the surface attached to it using `ReactDelegate.unloadApp`.

## Changelog

[Android][Added] Flag in ReactFragment to allow unmounting a surface without destroying ReactHost.

Reviewed By: philIip

Differential Revision: D62449779

fbshipit-source-id: a443ed004ced45e0adc95bd43b36d1b80f9f392f
2024-09-12 18:13:51 -07:00
Phillip PanandFacebook GitHub Bot cf8d09b279 remove RCTRuntimeExecutor (#46466)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46466

We should use [BindingsInstaller](https://github.com/facebook/react-native/pull/44486?fbclid=IwZXh0bgNhZW0CMTEAAR0noV5FT4pi2z0saQhFy4q2bVLiu0bLUn0Aq0QPAWnycksVBuizmUYXdnc_aem_bS3_Q_CgUIljILgDtrHUhA) and [RCTCallInvoker](https://github.com/facebook/react-native/pull/44378?fbclid=IwZXh0bgNhZW0CMTEAAR3rjd8_Ak2CsQfs3k4o6k0F9uivwx-22llwl6TiCFl5c0FmcoW8PKaxNgs_aem_R3cJp9eKQsMte_03lfuBdQ) instead.

## Changelog:
[iOS][Breaking] - We deprecated RCTRuntimeExecutor in 0.76, so let's get rid of the code now.

Reviewed By: cipolleschi

Differential Revision: D62469005

fbshipit-source-id: 3ed033b08f52823bd42f8a57d5d6ab40e35d30f1
2024-09-12 14:57:58 -07:00
Eric RozellandFacebook GitHub Bot 38593c440e Add unloadApp method to ReactDelegate (#46424)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46424

It's not isomorphic for `ReactDelegate` to have a `loadApp` method to initialize a surface, but only allow unloading of a surface by calling `onHostDestroy`, which also destroys the ReactHost. This change adds an `unloadApp` method to `ReactDelegate` so it can be used in, e.g., `ReactFragment` to stop a surface without tearing down the host.

## Changelog

[Android][Added] ReactDelegate `unloadApp` methods for unmounting surfaces without destroying ReactHost

Reviewed By: mdvacca

Differential Revision: D62448543

fbshipit-source-id: e99b880f48e857935ee856c37b881bcc8bd22ad0
2024-09-12 14:34:46 -07:00
Eric RozellandFacebook GitHub Bot cbddcfc691 ReactRootView is Nullable in ReactDelegate (#46440)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46440

ReactDelegate does not properly annotate the ReactRootView field as Nullable. This fixes that.

## Changelog

[Android][Fixed] Use appropriate Nullable attribute for ReactRootView field in ReactDelegate

Reviewed By: philIip

Differential Revision: D62514424

fbshipit-source-id: e9f10899007dfe794aa081717f5a5aa7d0038181
2024-09-12 14:34:46 -07:00
Joe VilchesandFacebook GitHub Bot 93b608d130 Make it so that aspect ratio behaves like auto if it is 0 or inf (#46428)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46428

X-link: https://github.com/facebook/yoga/pull/1696

We do not validate the aspect ratio to ensure it is non zero and non inf in a lot of places. Per the spec, these values should act like auto. There is no auto keyword, but it is the default so I just set the style to a default FloatOptional in this case

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D62473161

fbshipit-source-id: 6857de819538a7a87ce0a652e99f5a49992921ae
2024-09-12 14:28:33 -07:00
Nicola CortiandFacebook GitHub Bot d7c1e5b989 Unblock RNTester instacrashing due to SoLoader not being enabled (#46459)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46459

After the SoLoader 0.12.0 bump I've noticed RNTester is instacrashing due to us not having enabled it
explicitely in the Manifest:

Changelog:
[Internal] [Changed] - Unblock RNTester instacrashing due to SoLoader not being enabled

Reviewed By: cipolleschi

Differential Revision: D62580751

fbshipit-source-id: 3b291e7f82daf1a6bd61bc9588c2d49a389801ef
2024-09-12 14:16:33 -07:00
Vladimir MakaevandFacebook GitHub Bot 3949d9b5ba Update ktfmt component on FBS:master
Reviewed By: zertosh

Differential Revision: D62584126

fbshipit-source-id: 46170730dd7cabfa5e366a3139a9119c319592cc
2024-09-12 14:06:06 -07:00
Tim YungandFacebook GitHub Bot d0121a6c2d Revert D62398039: Speed up animation on back button press + animated reattach on tab switch
Differential Revision:
D62398039

Original commit changeset: af286e428188

Original Phabricator Diff: D62398039

fbshipit-source-id: 9a69733d5a00c9081471096cca298579af468352
2024-09-12 13:34:32 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot 6b369a40d9 Remove experimental_ prefix from filter (#46406)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46406

As title

Second attempt at landing the new name. There were 2 issues previously which led us to revert.

1. **Error on workrooms tests.** This ended up not being caused by us but rather by D61896776. After renaming the error changed which might've caused the renaming to be blamed for the issue. It has since been resolved

2. **FB crash** FB was crashing when using drop-shadow after renaming. For some reason after renaming `filter` an invalid stylex property was making FB crash. We don't know why renaming uncovered the issue but the the code was using unsupported features on RN (`calc` & `stylex`) which then led to passing a raw unsupported value for `filter` and crashing on the `processFilter` function.

FB was fixed here D62407454 to prevent crashing after landing this diff

Changelog: [General] [Changed] - Add official `filter` CSSProperty.

Reviewed By: NickGerleman

Differential Revision: D62401985

fbshipit-source-id: 14422603c40b7ddf8300029165a85655354075c3
2024-09-12 11:46:43 -07:00
Shawn DempseyandFacebook GitHub Bot ec39b8ba96 ReactNativeNewArchitectureFeatureFlagsDefaults defaults to newArch (#46448)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46448

Changelog: [Internal]

**Context**

- D61621224 changed `ReactNativeNewArchitectureFeatureFlagsDefaults` to default `newArchitectureEnabled=true`

https://www.internalfb.com/code/fbsource/[dc23ff7ddd18]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeNewArchitectureFeatureFlagsDefaults.kt?lines=16-18

**Change**
- We no longer need to explicitly set `newArchitectureEnabled=true`

Reviewed By: cortinico

Differential Revision: D62537633

fbshipit-source-id: 64df997fe85e49d731a914bd5ca749085749a0ac
2024-09-12 10:08:54 -07:00
Oskar KwaśniewskiandFacebook GitHub Bot cadd41b1a2 fix(iOS): don't reference PrivacyInfo.xcprivacy twice for new projects (#46457)
Summary:
This PR fixes an issue with PrivacyInfo files.

When generating a new project for using the latest RC 0.76.0.rc0 I got two privacy manifests references in Xcode.

This is because `PrivacyManifestUtils` look for build phase reference:

```ruby
reference_exists = target.resources_build_phase.files_references.any? { |file_ref| file_ref&.path&.end_with? "xcprivacy" }
```

Which doesn't exist for the generated template.

Here is how Xcode file tree looks like after installing pods:

![CleanShot 2024-09-12 at 13 23 21@2x](https://github.com/user-attachments/assets/44e5bb55-a1ab-4b4b-bfe4-e4a6808afd15)

## Changelog:

[IOS] [FIXED] - don't reference PrivacyInfo.xcprivacy twice for new projects

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

Test Plan:
1. Generate a new project
2. Execute pod install
3. Check if only one PrivacyInfo file exists

Reviewed By: cortinico

Differential Revision: D62580116

Pulled By: cipolleschi

fbshipit-source-id: 1224a41307ae6c9b862832f145baf0edc92476d6
2024-09-12 09:31:25 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 120558c0cd Bump main to 0.77
Summary:
This change bumps the React Native version in main to 0.77

bypass-github-export-checks

## Changelog:
[General][Changed] - Bump main to 0.77-main

## Facebook:
generated by running `js1 publish react-native 0.77.0-main`

Reviewed By: cortinico

Differential Revision: D62575939

fbshipit-source-id: 6d239fca2eed6cfe51f8c37f78d8dc8730c18b8c
2024-09-12 09:23:23 -07:00
Samuel SuslaandFacebook GitHub Bot 6243a33978 do not pass state wrapper for text during view preallocation (#46418)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46418

changelog: [internal]

introduce a small performance optimisation on Android.

When Paragraph is preallocated, it does not have valid C++ state. But we still send it to Android layer because it is part of a more generic pipeline. This has a cost because Android will end up using the state to update internal state on ReactTextView. To avoid this, simply add a special case to view preallocation and prevent it from sending C++ state.

Reviewed By: javache

Differential Revision: D62435529

fbshipit-source-id: 36b5b00a7a390432721d28d53ff8d4af76169e08
2024-09-12 08:01:28 -07:00
Marlene CotaandFacebook GitHub Bot 13db1cb88b Fix double to float type conversion error (#46447)
Summary:
![image](https://github.com/user-attachments/assets/3808e1ec-7b56-4cc6-85fb-a48beceba519)

## Changelog:
[GENERAL] [FIXED] - Fix type conversion error in react native windows build.

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

Test Plan: RNW CI builds.

Reviewed By: cipolleschi

Differential Revision: D62570270

Pulled By: cortinico

fbshipit-source-id: da3da297ba10cdd41f49e754ce52053055d61644
2024-09-12 07:27:52 -07:00
Nicola CortiandFacebook GitHub Bot 81e8c39f0a Do not stub SoLoader and use version 0.12.0 (#46422)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46422

Stubbing SoLoader comes with a couple of breaking changes (e.g. users in OSS are using `com.facebook.common.logging.FLog` which is exposed by Fresco).

In order to reduce those breaking changes, here I'm moving React Native to use SoLoader 0.12.0.
This new version comes with a constructor that accepts a MergedSoMapping implementation which we provide only for OSS apps.

Please note that the CI on this Diff will be red till SoLoader 0.12.0 releases.

Changelog:
[Internal] [Changed] - Do not stub SoLoader and use version 0.12.0

Reviewed By: cipolleschi

Differential Revision: D62447566

fbshipit-source-id: 6ff38799ed0c9f40cf3ab84be8a05979def63dc2
2024-09-12 07:17:22 -07:00
Tommy NguyenandFacebook GitHub Bot aec6666bfa Re-add RCTHermesInstance constructor for compatibility (#46453)
Summary:
https://github.com/facebook/react-native/pull/46314 introduced a breaking change, making it hard to maintain backwards compatibility elsewhere. This change re-introduces the constructor that takes two arguments.

## Changelog:

[IOS] [FIXED] - Unbreak `RCTHermesInstance` constructor breaking change

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

Test Plan: n/a

Reviewed By: javache

Differential Revision: D62574496

Pulled By: cortinico

fbshipit-source-id: dcd15bf9694f4b14e37d61d7209193b3e448cd6b
2024-09-12 07:05:39 -07:00
Pieter De BaetsandFacebook GitHub Bot 533ef2ca37 Mark HoverEvents as handled when pointer event dispatching is enabled (#46445)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46445

Similarly to onTouchEvent, we should return true from onHoverEvent to signal to Android that the hover event is "handled" (because we've dispatched the event to JS). This is important to be able to distinguish multiple stacked React roots on top of each other.

Changelog: [Android][Fixed] Hover events were dispatched incorrectly when multiple ReactRoots were layered.

Reviewed By: mdvacca

Differential Revision: D62529586

fbshipit-source-id: d007c44b8ef56989888eb9a993e1428bd0b72a7b
2024-09-12 03:30:52 -07:00
Thomas NardoneandFacebook GitHub Bot c942469700 Re-enable ktfmt on RN (#46441)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46441

Changelog: [Internal]

Reviewed By: zertosh

Differential Revision: D62518893

fbshipit-source-id: ca2ff83018716a4dc1e2dcfb8596138d088ce9f4
2024-09-11 19:06:25 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot 2241c3146f Remove experimental_ prefix from boxShadow (#46404)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46404

As title

Second attempt to rename the prop. BoxShadow caused no issues after renaming but it was batched with `filter` which we reverted.

Changelog: [General] [Changed] - Add official `boxShadow` CSSProperty.

Reviewed By: NickGerleman, cyan33

Differential Revision: D62400814

fbshipit-source-id: ad721f6d11d614e987048e55556b05ff74a4747d
2024-09-11 16:01:06 -07:00
Tim YungandFacebook GitHub Bot dc84d00db6 Animated: Minimize AnimatedProps Invalidation (#46386)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46386

Currently, `useAnimatedProps` attempts (and fails) to memoize the `AnimatedProps` instance by using `props` in the dependency array:

https://www.internalfb.com/code/fbsource/[de6bf108ae11fad0e8516617cde6f0cf3152d129]/xplat/js/react-native-github/packages/react-native/Libraries/Animated/useAnimatedProps.js?lines=56-59

However, `props` is very easily invalidated whenever the component is updated by its parent. The only time when it will not be invalidated is if the component that directly uses this hook — `createAnimatedComponent`'s return value — updates state… which never happens.

This changes `useAnimatedProps` so that we memoize `AnimatedProps` using only the nested property values that actually require a new `AnimatedProps` object to be created, which are `AnimatedNode` subclasses.

A minor detail is that in order for `AnimatedProps.prototype.__getValue` to continue working, we must supply `props` when we're actualizing the `AnimatedNode` instances into real values. This is accomplished by introducing a new method to select `AnimatedNode` subclasses: `__getValueFromStatic{Props,Object,Style,Transforms}`

Changelog:
[General][Added] - Created an experimental optimization to improve memoization within `Animated` to improve product performance

Reviewed By: javache

Differential Revision: D61997128

fbshipit-source-id: 2ca3cfb1038ba9a0abd82904acbc5cb4eb41a45d
2024-09-11 15:34:22 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 401f735e35 Add changelog for 0.75.3 (#46442)
Summary:
Add changelog for version 0.75.3

## Changelog:
[Internal] - Add Changelog for 0.75.3

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

Test Plan: N/A

Reviewed By: kassens

Differential Revision: D62526856

Pulled By: cipolleschi

fbshipit-source-id: 50045ec5fbbbf282bcec3dd59787f860e5510846
2024-09-11 15:21:55 -07:00
Royi HagigiandFacebook GitHub Bot 46abda55b9 Speed up animation on back button press + animated reattach on tab switch (#46438)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46438

When hiding a view with React.Activity, React will "detach" all the views in teh subtree (call all their effect cleanups) and then upon showing it again will attach them (call all their effects again).

This was previously causing problems with useAnimatedProps and https://github.com/facebook/react-native/pull/46205 was intended to fix it (cc javache), but it's still a perf drain to have to detach all of this and then re-attach it upon show. Worse, it makes it so that we can't actually do any animations upon re-showing a view until all the passive effects have run to re-attach the views to the animations.

So instead, what this diff does is lean on the fact that useInsertionEffect *does not* clean up and rerun when Activity goes from hidden to visible and vice versa. Thus, we can rely on it to only detach the animated node when we're *actually* unmounting - rather than when we're simply hiding/showing.

Changelog:
[General][Changed] - Improved the performance of unmounting (and updating, when an enclosing Activity becomes hidden) Animated components

Reviewed By: yungsters, sammy-SC

Differential Revision: D62398039

fbshipit-source-id: af286e428188b5104f6cfd3fd4d8c9f791dedb8d
2024-09-11 15:00:01 -07:00
Melissa LiuandFacebook GitHub Bot 65d8f66b50 improve text line height calculation (#46362)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46362

Changelog:
[Android] [Fixed] - improve text line height calculation

## Context
There is a recurring issue in React Native where text containing accented characters, non-latin scripts, and special glyphs experiences truncation when line height is set too small, even when the line height equals or exceeds the font size. This problem has a significant impact, particularly when rendering complex text in multiple languages or special character sets.

See: https://docs.google.com/document/d/1W-A80gKAyhVbz_WKktSwwJP5qm6h6ZBjFNcsVbknXhI/edit?usp=sharing for more context

## Investigation
Previously, when font metrics (ascent, descent, top, bottom) exceeded the line height, the logic arbitrarily prioritized descent over ascent and bottom top. This led to vertical misalignment and text clipping at the top of the text.

## Proposed Implementation:

1. Descent Exceeds Line Height:
Descent is capped to fit within the line height, setting ascent and top to 0, similar to the current behavior.
2. Shrink ascent and descent equally:
When the combined ascent and descent exceed the line height, the vertical deficit is split proportionally between them, ensuring even distribution of the space.
3. Proportionally shrink top and bottom:
If the top and bottom together exceed the line height, reductions are now applied proportionally based on the delta between top and ascent and bottom and descent.

Reviewed By: NickGerleman

Differential Revision: D62295350

fbshipit-source-id: 81381e8ea18ba9059488468295778c21781e4e7a
2024-09-11 14:53:09 -07:00
Melissa LiuandFacebook GitHub Bot f338e7c0a1 add feature flag for line height gating (#46408)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46408

## Changelog:

[Android] [Added] - new feature flag for line height calculation

## Context
Adding feature flag for line height calculation centering.

There is a recurring issue in React Native where text containing accented characters, non-latin scripts, and special glyphs experiences truncation when line height is set too small, even when the line height equals or exceeds the font size. This causes issues in rendering complex text in multiple languages or special character sets.

See: https://docs.google.com/document/d/1W-A80gKAyhVbz_WKktSwwJP5qm6h6ZBjFNcsVbknXhI/edit?usp=sharing for more context

## Investigation
Previously, when font metrics (ascent, descent, top, bottom) exceeded the line height, the logic arbitrarily prioritized descent over ascent and bottom top. This led to vertical misalignment and text clipping at the top of the text.

## Implementation:

1. Descent Exceeds Line Height:
Descent is capped to fit within the line height, setting ascent and top to 0, similar to the current behavior.
2. Shrink ascent and descent equally:
When the combined ascent and descent exceed the line height, the vertical deficit is split proportionally between them, ensuring even distribution of the space.
3. Proportionally shrink top and bottom:
If the top and bottom together exceed the line height, reductions are now applied proportionally based on the delta between top and ascent and bottom and descent.

Reviewed By: NickGerleman

Differential Revision: D62421775

fbshipit-source-id: 6b0542426d7ee575f4986e60ddf92247542b65cb
2024-09-11 14:53:09 -07:00
Zeya PengandFacebook GitHub Bot 4014aa4528 correctly pass down isLooping in parallel animation (#46429)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46429

Right now if I create a `Animated.loop(Animated.parallel(...))`, `config.__isLooping` for nested animations are not `true`. The reason is Animated.parallel doesn't pass down `isLooping`. This change is fixing that.

Changelog: [General][Fixed] - correctly pass down isLooping in parallel animation

Reviewed By: cipolleschi

Differential Revision: D62473189

fbshipit-source-id: 405dd36aa008cc965599ff82333b5552df1eb41f
2024-09-11 09:58:04 -07:00
Pieter De BaetsandFacebook GitHub Bot 94489d563d Add trace markers for onScrollChanged / updateClippingRect (#46412)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46412

These are quite useful when investigating scroll performance.

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D62213724

fbshipit-source-id: 3293aaf82584eae8508c748638c47c8b010db58f
2024-09-11 08:22:08 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 274f5bfe6c Disable concurrency on main (#46435)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46435

On main, we want to run CI as fast as possible to catch failures as soon as possible.
Currently, if two commits arrives on main (say commit A and commi B) CI will run on commit B only when it is finished on commit A.
Instead, we would like for CI to run in parallel.

## Changelog
[Internal] - Run CI in parallel on main

Reviewed By: cortinico

Differential Revision: D62496842

fbshipit-source-id: 03dc910deab42af98d92ea8e8e5b90049940dba1
2024-09-11 07:08:40 -07:00
Mohamed AlsadekandFacebook GitHub Bot b3f4d54786 Back out "Enable Multiple Sheet Presentation in React Native" (#46433)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46433

Original commit changeset: 53667cf1a75e

Original Phabricator Diff: D62143463

Changelog: [Internal]  revert previous modal presentation improvement

Reviewed By: sammy-SC

Differential Revision: D62474039

fbshipit-source-id: b510c0460c06ab9d595d414d4ea32acd224871bc
2024-09-11 04:20:50 -07:00
Mohamed AlsadekandFacebook GitHub Bot 080c82e70f Back out "Enable Multiple Sheet Presentation in React Native" (#46434)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46434

Original commit changeset: daa0cf95edb2

Original Phabricator Diff: D62202475

Changelog: [Internal]  revert previous modal presentation improvement

Reviewed By: sammy-SC

Differential Revision: D62474041

fbshipit-source-id: a4af6b5361dcc482e9bb3c2f45d614f9494f022e
2024-09-11 04:20:50 -07:00
Nicola CortiandFacebook GitHub Bot 1e07ac1d32 Add an issue template for React Native DevTools bug reports
Summary:
This introduces a new issue template for Debugger related issues.

bypass-github-export-checks

Changelog:
[Internal] [Changed] - Add an issue template for React Native DevTools bug reports

Reviewed By: cipolleschi, hoxyq

Differential Revision: D62440315

fbshipit-source-id: c7437d9787a910a2886df50171c86c9ed2412dd6
2024-09-11 04:14:56 -07:00
Tomek ZawadzkiandFacebook GitHub Bot e91690d929 Expose jsctooling via prefab (#46430)
Summary:
This PR exposes `jsctooling` prefab that contains `facebook::jsc::makeJSCRuntime` used by Reanimated and other third-party libraries previously accessed via `libjscexecutor.so`.

Based on https://github.com/facebook/react-native/pull/46423.

## Changelog:

[Android] [Changed] - Expose jsctooling via prefab

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

Test Plan: Tested on Reanimated paper-example app built from source on RN 0.76.0-rc.0 with JSC enabled

Reviewed By: cipolleschi

Differential Revision: D62492763

Pulled By: cortinico

fbshipit-source-id: 53b6c0d9bb88559c40b5b8796bf6a1513bd388d9
2024-09-11 03:52:55 -07:00
Tomek ZawadzkiandFacebook GitHub Bot b1d42c8ef2 Expose react_timing headers in reactnative prefab (#46427)
Summary:
This PR fixes the following error when building third-party libraries that `#include <react/fabric/Binding.h>` which includes `react/timing/primitives.h` which is not included in `reactnative` prefab.

```
FAILED: CMakeFiles/rnscreens.dir/src/main/cpp/NativeProxy.cpp.o
/Users/tomekzaw/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android24 --sysroot=/Users/tomekzaw/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DFOLLY_NO_CONFIG=1 -Drnscreens_EXPORTS -I/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/react-native-screens/android/../cpp -isystem /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/jsi/include -isystem /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include -isystem /Users/tomekzaw/.gradle/caches/8.10.1/transforms/b0878eb14f826ac5f04db98523604de2/transformed/fbjni-0.6.0/prefab/modules/fbjni/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -fno-limit-debug-info  -fPIC -std=c++20 -MD -MT CMakeFiles/rnscreens.dir/src/main/cpp/NativeProxy.cpp.o -MF CMakeFiles/rnscreens.dir/src/main/cpp/NativeProxy.cpp.o.d -o CMakeFiles/rnscreens.dir/src/main/cpp/NativeProxy.cpp.o -c /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/react-native-screens/android/src/main/cpp/NativeProxy.cpp
In file included from /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/react-native-screens/android/src/main/cpp/NativeProxy.cpp:2:
In file included from /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include/react/fabric/Binding.h:17:
In file included from /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include/react/jni/JRuntimeScheduler.h:11:
In file included from /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include/react/renderer/runtimescheduler/RuntimeScheduler.h:11:
/Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include/react/performance/timeline/PerformanceEntryReporter.h:10:10: fatal error: 'react/timing/primitives.h' file not found
#include <react/timing/primitives.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```

## Changelog:

[ANDROID] [FIXED] - Expose `react_timing` headers in `reactnative` prefab

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

Test Plan: Tested on Reanimated fabric-example app with react-native-screens installed built from source on top of RN 0.76.0-rc.0 with new arch enabled

Reviewed By: cipolleschi

Differential Revision: D62492707

Pulled By: cortinico

fbshipit-source-id: 94ed7044457bea53660a6ca6d5342cf8ea20a8b4
2024-09-11 03:47:56 -07:00
Ruslan LesiutinandFacebook GitHub Bot 69325c11f2 Update debugger-frontend from 50a4d4f...e8c7943 (#46414)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46414

Changelog: [Internal] - Update `react-native/debugger-frontend` from 50a4d4f...e8c7943

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

Reviewed By: robhogan

Differential Revision: D62436953

fbshipit-source-id: 7a877142c5713c78cb6f1a3d839c4e90f93fa0c6
2024-09-11 03:42:57 -07:00
Douglas CheongandFacebook GitHub Bot a05f9c6771 Mark params as unused (#46426)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46426

## Changelog:
[Internal] -
Comment out unused params

Reviewed By: rshest

Differential Revision: D62448755

fbshipit-source-id: da647197994b982f924b2c1330a2b529e48d7ad8
2024-09-10 14:33:17 -07:00
Benoit GirardandFacebook GitHub Bot ef0ea4d834 Add FuseboxPerfettoDataSource to emit Fusebox traces using Perfetto (#46376)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46376

Ideally we would use Fusebox directly but it's not supported in release build. This is a clever work around that:
1) Allows us to use Perfetto to start/stop a trace, otherwise we'd need to build another way to do that which would be either hacky and/or complex.
2) Implements tacking Hermes JS samples and putting them inside of Fusebox traces.
3) Manually taking the trace and opening them in an instance of devtools.

Reviewed By: rubennorte

Differential Revision: D62263012

fbshipit-source-id: 49468914d2b7e5da4761329b176f140b917a404d
2024-09-10 12:54:02 -07:00
Nick LefeverandFacebook GitHub Bot 199d194c46 Use asset name as key for vector image check caching (#46421)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46421

Changelog: [Internal]

Avoid using the Context as a cache key, using only the asset name.

Reviewed By: Abbondanzo

Differential Revision: D62445718

fbshipit-source-id: 4161e6ef1bbc396c8ab815cdc0362159411f6a68
2024-09-10 12:44:22 -07:00
Nicola CortiandFacebook GitHub Bot f41af55958 Expose hermestooling via prefab (#46423)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46423

This is used by Reanimated as they were previously accessing `libhermes_executor.so`

Changelog:
[Android] [Changed] - Expose hermestooling via prefab

Reviewed By: cipolleschi

Differential Revision: D62447875

fbshipit-source-id: e863c56bc5a801ee7de8a4e5d45f95481d3497f8
2024-09-10 11:46:40 -07:00
Nick LefeverandFacebook GitHub Bot 65beadb00a Cache vector image detection for assets (#46415)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46415

Changelog: [Internal]

Cache the results checking for vector content. This check is decompressing the asset content and parsing XML to check for vector graphics. Caching the result per context/asset name removes the need to parse the content on each image assignment.

Reviewed By: Abbondanzo

Differential Revision: D62436412

fbshipit-source-id: 9e1fe9f0747c9a30ac0d89124b6909d4260a2a2f
2024-09-10 09:20:08 -07:00
Yunlong WuandFacebook GitHub Bot 4a22f2c816 Add TextInput.editable and BaseTextInputProps (#46356)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46356

# Changelog:
[Internal]-
Currently TextInput does not expose `editable` and `readOnly` (only `editable` is exposed as Android-specific prop).
This change is to add them to BaseTextInputProps so they can be supported cross-platform.

Reviewed By: rshest

Differential Revision: D62180722

fbshipit-source-id: 6cb82589f1d36b61167761f5a2e70e8d4b31b01b
2024-09-10 09:08:23 -07:00
Tim YungandFacebook GitHub Bot 5b5a8397aa Animated: Create enableAnimatedAllowlist Feature Flag (#46405)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46405

Creates a feature flag for enabling the `Animated` code paths utilizing the new allowlist features. This enables us to validate the impact on product performance and developer experience before fully rolling it out.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D62405286

fbshipit-source-id: be4a4786d4d2f44504f7788e473c12ed432ef1cd
2024-09-10 08:33:54 -07:00
Nicola CortiandFacebook GitHub Bot 773a02ad5d Fix wrong command for publishing of external-artifacts (#46417)
Summary:
This is a pick on main of a fix necessary to release 0.76.x

## Changelog:

[INTERNAL] - Fix wrong command for publishing of external-artifacts

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

Test Plan: CI

Reviewed By: cipolleschi

Differential Revision: D62440193

Pulled By: cortinico

fbshipit-source-id: 57ea0736c1b6e3e60b048a46770356901de74024
2024-09-10 07:11:42 -07:00
Riccardo CipolleschiandFacebook GitHub Bot d3d48cb357 feat(JS): Expose text content types to JS (#46170)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46170

This PR expose to JS a few missing text content types on iOS (available from iOS 15)

- dateTime
- flightNumber
- shipmentTrackingNumber

## Changelog
[General][Added] - Expose missing text content type to JS

Reviewed By: blakef

Differential Revision: D61657788

fbshipit-source-id: 1a0ea0e76efaf715d88bcbf249f7cb20b5f3607b
2024-09-10 05:00:00 -07:00
shubhamguptadream11andFacebook GitHub Bot ce2d34f194 feat(iOS): line break mode implement JS APIs for the new mode (#46128)
Summary:
Solves this issue: https://github.com/facebook/react-native/issues/44107

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

[IOS] [ADDED] - Line break mode for TextInput components. **This includes JS APIs for the new mode.**

This PR is a breakdown of [this](https://github.com/facebook/react-native/pull/45968) PR.

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

Test Plan:
- Added unit tests to cover the new JS APIs.
- Verified that the new mode functions as expected through manual testing.

Reviewed By: andrewdacenko

Differential Revision: D61657004

Pulled By: cipolleschi

fbshipit-source-id: 9fc5c40fc077bee8e1abc51b6eae2e0f0fcd9b8f
2024-09-10 04:52:22 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 27bd6c9227 Use Debug APK for release testing (#46413)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46413

When testing RNTester for Android during a release, we downloads the APKs from CI to save time.

Sadly, we were downloading the Release APKs instead of the Debug ones, so we could not test te integration with Metro.

This change fixes the testing scripts to download the debug APK

## Changelog
[Internal] - Download the debug APK instead of the Release one

Reviewed By: cortinico

Differential Revision: D62436023

fbshipit-source-id: 08a568caf3e5c85b9da933bc01623587bd36affe
2024-09-10 04:41:07 -07:00
Tim YungandFacebook GitHub Bot 8dabed60f4 Animated: Create Default NativeAnimatedAllowlist (#46385)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46385

Changes `NativeAnimatedAllowlist` to export a "default allowlist" for use with "native animated components" (i.e. components that are only used with `Animated` values with `useNativeDriver`).

This required some minor internal implementation changes in order to make the allowlist conform to `{[string]: true}`, so I also added some unit tests to ensure the functionality remains the same.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D62351434

fbshipit-source-id: e92b7245c0d61da87a0d149ffeb967f1ebb888a2
2024-09-09 20:34:57 -07:00
Tim YungandFacebook GitHub Bot f3f652daab Animated: Create Experimental Props Allowlist (#46374)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46374

Creates an experimental `allowlist` parameter that can be supplied to a new `unstable_createAnimatedComponentWithAllowlist` method for use in new experiments to evaluate the impact on product performance and developer experience.

When it is provided, only the props and styles in `allowlist` will be inspected for `AnimatedNode` values. The hypothesis for this change is that restricting the search space for `AnimatedProps` to an allowlist will significantly reduce the runtime overhead of using `Animated` components.

Changelog:
[General][Added] - Created an experimental (unstable) method for allowlisting props when using `Animated`

Reviewed By: javache

Differential Revision: D62117424

fbshipit-source-id: bdd656be1fdc7454360035627644606cb00d33c0
2024-09-09 20:34:57 -07:00
Tim YungandFacebook GitHub Bot 5dbd9fc159 Animated: Reduce Duplication in Animated{Props,Style} (#46384)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46384

Minor refactor to reduce duplicated logic when traversing props and styles in `AnimatedProps` and `AnimatedStyle`, respectively.

This refactor also makes a future optimization (in which we want to skip processing certain props) more straightforward to implement.

Changelog
[Internal]

Reviewed By: javache

Differential Revision: D62351078

fbshipit-source-id: 63c06462c99ef83f3b511456a3281b940b7a3ac0
2024-09-09 20:34:57 -07:00
Tim YungandFacebook GitHub Bot 734c1505f4 Animated: Improve Types in Animated{Props,Style} (#46383)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46383

Minor refactors to the internal types of `AnimatedProps` and `AnimatedStyle` to avoid using `Object` and `any`.

This also migrates private properties prefixed with `_` to instead use `#` (ECMAScript private properties). This has the desired benefit of minimizing thrash in the `public-api-test.js` snapshot, too.

There are no behavior changes associated with this commit.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D62351005

fbshipit-source-id: bb69d4db50aef5e0b3193971dac581686e359a95
2024-09-09 20:34:57 -07:00
Tim YungandFacebook GitHub Bot fe6228512e Animated: Delete AnimatedNode.prototype.toJSON (#46382)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46382

Deletes the `AnimatedNode.prototype.toJSON` method.

It was originally introduced by [facebook/react-native#7442](https://github.com/facebook/react-native/pull/7442) as a means to resolve [facebook/react-native#7441](https://github.com/facebook/react-native/issues/7441), where an error occurs attempting to serialize `AnimatedNode` instances.

However, this is no longer needed for that purpose because our inspector implementation is now more resilient. (It correctly reports the current style value instead of the `AnimatedNode` instance.)

The impetus for this change is that this `toJSON` method prevents a future performance optimization for all `Animated` components.

Changelog:
[General][Changed] - AnimatedNode (and its subclasses) no longer implement `toJSON()`.

Reviewed By: javache

Differential Revision: D62350726

fbshipit-source-id: c68edc98878e58d48bc677c4f1299bb1bd15c9c4
2024-09-09 20:34:57 -07:00
Tim YungandFacebook GitHub Bot ca234ba10e Animated: Lazily Allocate AnimatedNode Instances (#46317)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46317

Changes `AnimatedProps` to avoid allocating `AnimatedStyle` (and `AnimatedTransform`, `AnimatedObject`) unless necessary.

This not only reduces memory and traversal overhead, but it enables us to implement allowlist strategies to prune unnecessary traversals.

Changelog:
[General][Changed] - Animated now omits `style` if the supplied value is null, undefined, or not an object. Previously, it would emit an empty `style` object.
[General][Changed] - Animated now resolves `style` to the original prop value if it contains no `AnimatedNode` instances. Previously, it would resolve to a flattened style object.

Reviewed By: javache

Differential Revision: D62117423

fbshipit-source-id: 34b0c9940be5b6f5d94467993a5344406cc56f93
2024-09-09 20:34:57 -07:00
Tim YungandFacebook GitHub Bot 9e6c4fd342 Animated: Codify Update Subscription Invariants (#46373)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46373

Currently, the logic for managing the native subscription in `AnimatedNode` is scattered and difficult to follow. This refactors the code to make the subscription's state easier to understand and harder to break in future refactors.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D62268695

fbshipit-source-id: 098cc6413db2abffa80983116dd0a5f440ba6fce
2024-09-09 20:34:57 -07:00
Tim YungandFacebook GitHub Bot 7377929e15 RN: Reintroduce forwardRef to ScrollView (#46400)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46400

Since React 19 is not yet stable, we cannot publish a release of React Native depending on it, yet. As such, we have to revert our dependency on React 19 and bring back patterns such as `forwardRef`.

This is a spiritual revert of https://github.com/facebook/react-native/pull/45197.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D62384482

fbshipit-source-id: 880ad1166e0b449ad5be6f914907661adb5f458d
2024-09-09 20:32:19 -07:00
SamChou19815 (Meta Employee)andFacebook GitHub Bot 1f65bf9545 Upgrade Flow to 0.245.2 (#30919)
Summary:
## Summary

This PR bumps Flow all the way to the latest 0.245.2.

Most of the suppressions comes from Flow v0.239.0's change to include
undefined in the return of `Array.pop`.

I also enabled `react.custom_jsx_typing=true` and added custom jsx
typing to match the old behavior that `React.createElement` is
effectively any typed. This is necessary since various builtin
components like `React.Fragment` is actually symbol in the React repo
instead of `React.AbstractComponent<...>`. It can be made more accurate
by customizing the `React$CustomJSXFactory` type, but I will leave it to
the React team to decide.

## How did you test this change?

`yarn flow` for all the renderers

DiffTrain build for commit https://github.com/facebook/react/commit/e210d08180a63f42079b91acaa7f6af15eef6d32.

Reviewed By: yungsters

Differential Revision: D62384646

Pulled By: SamChou19815

fbshipit-source-id: 727794f2d4091f37d771854b8e8a52f070309213
2024-09-09 19:53:43 -07:00
Alan LeeandFacebook GitHub Bot af1b18e125 fix SafeAreaView mis-used import (#46402)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46402

JS code for importing SafeAreaView is causing error in windows due to import being used.
Fix it by using conditional require instead

Changelog:
[Internal] -  Fixed mis-used import of core only SafeAreaView in JS

Reviewed By: fkgozali

Differential Revision: D62392588

fbshipit-source-id: 65c4728ff73b43cc54543ec2d141a88fce1275ca
2024-09-09 19:43:27 -07:00
Kacper RozniataandFacebook GitHub Bot 84f2d25124 fix(iOS): fix animating Switch component value change (#46173)
Summary:
This PR fixes animating controlled `Switch` component when it's initial value is set to `false`

When initial value was set to `false`, `_isInitialValueSet` flag wasn't changed to `YES`, because `oldSwitchProps.value` &`newSwitchProps.value` were equal, which resulted in controlled `Switch` component being updated without animation on first value change

This PR fixes it by moving setting `_isInitialValueSet` flag to the end of `updateProps` method

## Changelog:

[IOS] [FIXED] - Fix animating Switch component value change in Fabric

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

Test Plan:
1. Open `Switch` example in `RNTester`
2. In `Change events can be detected` section press switch that is `off` by default
3. Switch under it should change with animation

Reviewed By: javache

Differential Revision: D62377771

Pulled By: cipolleschi

fbshipit-source-id: 0213287c935db79a199b086ebb36a6979df03913
2024-09-09 16:41:49 -07:00
Samuel SuslaandFacebook GitHub Bot 95af340aac ship granular state updates on iOS (#46403)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46403

changelog: [internal]

ship granular state updates on iOS.

Reviewed By: rubennorte

Differential Revision: D62374462

fbshipit-source-id: 7ed217011e1c65031d418f1807802c113628f542
2024-09-09 15:23:59 -07:00
Ruslan LesiutinandFacebook GitHub Bot af8b232741 Update debugger-frontend from a556d26...50a4d4f (#46401)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46401

Changelog: [Internal] - Update `react-native/debugger-frontend` from a556d26...50a4d4f

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

Reviewed By: huntie

Differential Revision: D62385355

fbshipit-source-id: 77056540c9d40cd7cfc8098332e86f9521633619
2024-09-09 10:31:31 -07:00
Peter AbbondanzoandFacebook GitHub Bot 2e80f5acf1 Load XML files on disk by default (#46371)
Summary:
X-link: https://github.com/facebook/metro/pull/1348

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

## Internal

Vector drawable image support was added in D59530172 but importing vector drawable asset types was not supported out of the box. It required custom source transformers like the one added in D60021474. This is because Android cannot load vector drawable XML over the network. Vector drawables are compiled by AAPT as part of the build process. Even though Metro can serve XML, it would never load.

## Summary

This adds some minor checks in the `AssetSourceResolver` to only attempt loading XML asset types from disk on the Android platform. XML assets like vector drawables are precompiled and cannot be served over the network by Metro.

## Changelog

[Android] [Added] - Adds support for importing XML assets as images

Reviewed By: javache

Differential Revision: D62302929

fbshipit-source-id: 01e49ac5b0429d291318984128dfca2dc058149d
2024-09-09 10:18:10 -07:00
Rob HoganandFacebook GitHub Bot 40f98b5eee Bump Metro to 0.81.0-alpha.0 (#46398)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46398

Bump Metro packages to the version stablising for RN 0.76

Changelog:
[General][Changed] - Bump Metro dependencies to 0.81.0-alpha.0

Reviewed By: cortinico

Differential Revision: D62377929

fbshipit-source-id: 0808b11ad534e6a649c28f32b19f95f691645be4
2024-09-09 08:20:52 -07:00
Nicola CortiandFacebook GitHub Bot 90f89a830a Gradle to 8.10.1 (#46399)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46399

This is a patch release for Gradle. Let's include it inside main/0.76.

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

Reviewed By: tdn120

Differential Revision: D62377887

fbshipit-source-id: e8a5acaa48c15c9a12a09504c33c2a0d2834d92c
2024-09-09 07:26:53 -07:00
Hampus SjöbergandFacebook GitHub Bot 833c3a2cf5 fix: RNGP autolink not properly filter out pure C++ TurboModules (#46381)
Summary:
Hey.

The react-native gradle plugin didn't properly filter out [Pure](https://github.com/react-native-community/cli/pull/2387) C++ TurboModules for autolinking, which caused build failures as a non-existing gradle dependency would be emitted.

This makes Pure C++ TurboModules work again for Android.

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

[ANDROID][FIXED] Fix autolinking issues for Pure C++ TurboModules

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

Test Plan:
https://github.com/hsjoberg/rn75autolinkregression

Try running this repro project to observe the error:

```
1: Task failed with an exception.
-----------
* Where:
Build file '/Users/coco/Projects/Blixt/rn75autolinkregression/example/android/app/build.gradle' line: 54

* What went wrong:
A problem occurred evaluating project ':app'.
> Project with path ':react-native-cxx-turbomodule' could not be found in project ':app'.
```

Simply add the 1-line code from this PR to make the build succeed.

Cheers.

Reviewed By: cipolleschi

Differential Revision: D62377757

Pulled By: cortinico

fbshipit-source-id: 9e3fa3777b4e6e4d3f2eb0f996ac0ac7676eedbe
2024-09-09 07:22:28 -07:00
1061 changed files with 29825 additions and 17012 deletions
+1
View File
@@ -30,6 +30,7 @@ module.exports = {
// These rules are not required with hermes-eslint
'ft-flow/define-flow-type': 0,
'ft-flow/use-flow-type': 0,
'lint/sort-imports': 1,
// flow handles this check for us, so it's not required
'no-undef': 0,
},
+1 -1
View File
@@ -90,4 +90,4 @@ untyped-import
untyped-type-import
[version]
^0.245.2
^0.250.0
+1 -1
View File
@@ -1,4 +1,4 @@
name: 🐛 Bug Report
name: 🐛 React Native - Bug Report
description: Report a reproducible bug or regression in React Native.
labels: ["Needs: Triage :mag:"]
body:
@@ -0,0 +1,76 @@
name: 🔍 Debugger - Bug Report
description: Report a bug with React Native DevTools and the New Debugger
labels: ["Needs: Triage :mag:", "Debugger"]
body:
- type: markdown
attributes:
value: "## Reporting a bug for React Native DevTools"
- type: markdown
attributes:
value: |
Thank you for taking the time to report an issue for React Native DevTools, our new Debugger for React Native.
Before you continue:
* If you're using **Expo** and you're noticing a bug, [report it here](https://github.com/expo/expo/issues).
* If you've found a problem with our **documentation**, [report it here](https://github.com/facebook/react-native-website/issues/).
* If you're having an issue with **Metro** (the bundler), [report it here](https://github.com/facebook/metro/issues/).
* If you're using an external library, report the issue to the **library first**.
* Please [search for similar issues](https://github.com/facebook/react-native/issues) in our issue tracker.
Make sure that your issue is tested against the [**latest stable**](https://github.com/facebook/react-native/releases/) of React Native.
- type: textarea
id: description
attributes:
label: Description
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Steps to reproduce
description: The list of steps that reproduces the issue.
placeholder: |
1. Install the application with `yarn android`
2. Press `j` to open the debugger
3. Do something...
validations:
required: true
- type: input
id: version
attributes:
label: React Native Version
description: The version of react-native that this issue reproduces on. Bear in mind that only issues on [supported versions](https://github.com/reactwg/react-native-releases#which-versions-are-currently-supported) will be looked into.
placeholder: "0.76.0"
validations:
required: true
- type: textarea
id: react-native-info
attributes:
label: Output of `npx react-native info`
description: Run `npx react-native info` in your terminal, copy and paste the results here.
placeholder: |
Paste the output of `npx react-native info` here. The output looks like:
...
System:
OS: macOS 14.1.1
CPU: (10) arm64 Apple M1 Max
Memory: 417.81 MB / 64.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node: ...
version: 18.14.0
...
render: text
validations:
required: true
- type: textarea
id: extra
attributes:
label: Screenshots and Videos
description: |
Please provide screenshot or a video of your bug if relevant.
Issues with videos and screenshots are more likely to **get prioritized**.
@@ -9,7 +9,7 @@ inputs:
description: The version of Hermes
slice:
required: true
description: The slice of hermes you want to build. It could be iphone, iphonesimulator, macos, catalyst, xros, or xrossimulator
description: The slice of hermes you want to build. It could be iphone, iphonesimulator, macos, catalyst, appletvos, appletvsimulator, xros, or xrossimulator
flavor:
required: true
description: The flavor we want to build. It can be Debug or Release
+22 -2
View File
@@ -22,7 +22,7 @@ runs:
- name: Restore Cached Artifacts
uses: actions/cache/restore@v4
with:
key: v4-hermes-artifacts-${{ inputs.flavor }}-${{ inputs.hermes-version }}-${{ inputs.react-native-version }}
key: v4-hermes-artifacts-${{ inputs.flavor }}-${{ inputs.hermes-version }}-${{ inputs.react-native-version }}-${{ hashFiles('./packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}
path: |
/tmp/hermes/osx-bin/${{ inputs.flavor }}
/tmp/hermes/dSYM/${{ inputs.flavor }}
@@ -66,6 +66,18 @@ runs:
with:
path: ./packages/react-native/sdks/hermes/
name: slice-iphonesimulator-${{ inputs.flavor }}
- name: Slice cache appletvos
if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
uses: actions/download-artifact@v4
with:
path: ./packages/react-native/sdks/hermes/
name: slice-appletvos-${{ inputs.flavor }}
- name: Slice cache appletvsimulator
if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
uses: actions/download-artifact@v4
with:
path: ./packages/react-native/sdks/hermes/
name: slice-appletvsimulator-${{ inputs.flavor }}
- name: Slice cache catalyst
if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
uses: actions/download-artifact@v4
@@ -93,6 +105,8 @@ runs:
tar -xzv -f build_catalyst_${{ matrix.flavor }}.tar.gz
tar -xzv -f build_iphoneos_${{ matrix.flavor }}.tar.gz
tar -xzv -f build_iphonesimulator_${{ matrix.flavor }}.tar.gz
tar -xzv -f build_appletvos_${{ matrix.flavor }}.tar.gz
tar -xzv -f build_appletvsimulator_${{ matrix.flavor }}.tar.gz
tar -xzv -f build_macosx_${{ matrix.flavor }}.tar.gz
tar -xzv -f build_xros_${{ matrix.flavor }}.tar.gz
tar -xzv -f build_xrsimulator_${{ matrix.flavor }}.tar.gz
@@ -105,6 +119,8 @@ runs:
mv build_macosx_${{ inputs.flavor }} build_macosx
mv build_iphoneos_${{ inputs.flavor }} build_iphoneos
mv build_iphonesimulator_${{ inputs.flavor }} build_iphonesimulator
mv build_appletvos_${{ inputs.flavor }} build_appletvos
mv build_appletvsimulator_${{ inputs.flavor }} build_appletvsimulator
mv build_catalyst_${{ inputs.flavor }} build_catalyst
mv build_xros_${{ inputs.flavor }} build_xros
mv build_xrsimulator_${{ inputs.flavor }} build_xrsimulator
@@ -163,6 +179,8 @@ runs:
mkdir -p "$WORKING_DIR/catalyst"
mkdir -p "$WORKING_DIR/iphoneos"
mkdir -p "$WORKING_DIR/iphonesimulator"
mkdir -p "$WORKING_DIR/appletvos"
mkdir -p "$WORKING_DIR/appletvsimulator"
mkdir -p "$WORKING_DIR/xros"
mkdir -p "$WORKING_DIR/xrsimulator"
@@ -173,6 +191,8 @@ runs:
cp -r build_catalyst/$DSYM_FILE_PATH "$WORKING_DIR/catalyst/"
cp -r build_iphoneos/$DSYM_FILE_PATH "$WORKING_DIR/iphoneos/"
cp -r build_iphonesimulator/$DSYM_FILE_PATH "$WORKING_DIR/iphonesimulator/"
cp -r build_appletvos/$DSYM_FILE_PATH "$WORKING_DIR/appletvos/"
cp -r build_appletvsimulator/$DSYM_FILE_PATH "$WORKING_DIR/appletvsimulator/"
cp -r build_xros/$DSYM_FILE_PATH "$WORKING_DIR/xros/"
cp -r build_xrsimulator/$DSYM_FILE_PATH "$WORKING_DIR/xrsimulator/"
@@ -200,7 +220,7 @@ runs:
uses: actions/cache/save@v4
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode.
with:
key: v4-hermes-artifacts-${{ inputs.flavor }}-${{ inputs.hermes-version }}-${{ inputs.react-native-version }}
key: v4-hermes-artifacts-${{ inputs.flavor }}-${{ inputs.hermes-version }}-${{ inputs.react-native-version }}-${{ hashFiles('./packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}
path: |
/tmp/hermes/osx-bin/${{ inputs.flavor }}
/tmp/hermes/dSYM/${{ inputs.flavor }}
+1
View File
@@ -23,6 +23,7 @@ runs:
run: yarn lint-ci
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
GITHUB_PR_NUMBER: ${{ github.event.number }}
- name: Lint code
shell: bash
run: ./scripts/circleci/exec_swallow_error.sh yarn lint --format junit -o ./reports/junit/eslint/results.xml
+29 -15
View File
@@ -17,6 +17,15 @@ inputs:
required: false
default: 'true'
description: whether this action has to install java 17 or not
flavor:
required: true
description: the flavor we want to run - either debug or release
default: release
working-directory:
required: false
default: "."
description: The directory from which metro should be started
runs:
using: composite
steps:
@@ -25,7 +34,7 @@ runs:
run: export MAESTRO_VERSION=1.36.0; curl -Ls "https://get.maestro.mobile.dev" | bash
- name: Set up JDK 17
if: ${{ inputs.install-java == 'true' }}
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
@@ -38,27 +47,32 @@ runs:
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Build Codegen
shell: bash
if: ${{ inputs.flavor == 'debug' }}
run: ./packages/react-native-codegen/scripts/oss/build.sh
- name: Run e2e tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 24
arch: x86
script: |
echo "Install APK from ${{ inputs.app-path }}"
adb install "${{ inputs.app-path }}"
echo "Start recording to /sdcard/screen.mp4"
adb shell screenrecord /sdcard/screen.mp4
echo "Start testing ${{ inputs.maestro-flow }}"
$HOME/.maestro/bin/maestro test ${{ inputs.maestro-flow }} --format junit -e APP_ID=${{ inputs.app-id }} --debug-output /tmp/MaestroLogs
echo "Stop recording. Saving to screen.mp4"
adb pull /sdcard/screen.mp4
ram-size: '4096M'
disk-size: '10G'
disable-animations: false
avd-name: e2e_emulator
script: node .github/workflow-scripts/maestro-android.js ${{ inputs.app-path }} ${{ inputs.app-id }} ${{ inputs.maestro-flow }} ${{ inputs.flavor }} ${{ inputs.working-directory }}
- name: Normalize APP_ID
id: normalize-app-id
shell: bash
if: always()
run: |
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
if: always()
with:
name: e2e_android_${{ inputs.app-id }}_report_${{ inputs.jsengine }}
name: e2e_android_${{ steps.normalize-app-id.outputs.app-id }}_report_${{ inputs.jsengine }}_${{ inputs.flavor }}
path: |
report.xml
screen.mp4
@@ -66,5 +80,5 @@ runs:
if: failure() && steps.run-tests.outcome == 'failure'
uses: actions/upload-artifact@v4.3.4
with:
name: maestro-logs-android-${{ inputs.app-id }}-${{ inputs.jsengine }}
name: maestro-logs-android-${{ steps.normalize-app-id.outputs.app-id }}-${{ inputs.jsengine }}-${{ inputs.flavor }}
path: /tmp/MaestroLogs
+28 -3
View File
@@ -13,6 +13,15 @@ inputs:
maestro-flow:
required: true
description: the folder that contains the maestro tests
flavor:
required: true
description: Whether we are building for Debug or Release
default: Release
working-directory:
required: false
default: "."
description: The directory from which metro should be started
runs:
using: composite
steps:
@@ -29,6 +38,13 @@ runs:
with:
java-version: '17'
distribution: 'zulu'
- name: Start Metro in Debug
shell: bash
if: ${{ inputs.flavor == 'Debug' }}
run: |
cd ${{ inputs.working-directory }}
yarn start &
sleep 5 # to give metro time to load
- name: Run tests
id: run-tests
shell: bash
@@ -53,11 +69,16 @@ runs:
echo "Launch the app"
xcrun simctl launch $UDID ${{ inputs.app-id }}
if [[ ${{ inputs.flavor }} == 'Debug' ]]; then
# To give the app time to warm the metro's cache
sleep 20
fi
echo "Running tests with Maestro"
export MAESTRO_DRIVER_STARTUP_TIMEOUT=1500000 # 25 min. CI is extremely slow
# Add retries for flakyness
MAX_ATTEMPTS=3
MAX_ATTEMPTS=5
CURR_ATTEMPT=0
RESULT=1
@@ -65,6 +86,8 @@ 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
@@ -82,15 +105,17 @@ runs:
if: always()
uses: actions/upload-artifact@v4.3.4
with:
name: e2e_ios_${{ inputs.app-id }}_report_${{ inputs.jsengine }}
name: e2e_ios_${{ inputs.app-id }}_report_${{ inputs.jsengine }}_${{ inputs.flavor }}
path: |
video_record_1.mov
video_record_2.mov
video_record_3.mov
video_record_4.mov
video_record_5.mov
report.xml
- name: Store Logs
if: failure() && steps.run-tests.outcome == 'failure'
uses: actions/upload-artifact@v4.3.4
with:
name: maestro-logs-${{ inputs.app-id }}-${{ inputs.jsengine }}
name: maestro-logs-${{ inputs.app-id }}-${{ inputs.jsengine }}-${{ inputs.flavor }}
path: /tmp/MaestroLogs
+1 -1
View File
@@ -132,7 +132,7 @@ runs:
set -o pipefail && xcodebuild \
-scheme "RNTester" \
-workspace packages/rn-tester/RNTesterPods.xcworkspace \
-configuration "Release" \
-configuration "${{ inputs.flavor }}" \
-sdk "iphonesimulator" \
-destination "generic/platform=iOS Simulator" \
-derivedDataPath "/tmp/RNTesterBuild" | xcbeautify
@@ -0,0 +1,158 @@
/**
* 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.
*
* @format
*/
const {
publishTemplate,
verifyPublishedTemplate,
} = require('../publishTemplate');
const mockRun = jest.fn();
const mockSleep = jest.fn();
const mockGetNpmPackageInfo = jest.fn();
const silence = () => {};
jest.mock('../utils.js', () => ({
log: silence,
run: mockRun,
sleep: mockSleep,
getNpmPackageInfo: mockGetNpmPackageInfo,
}));
const getMockGithub = () => ({
rest: {
actions: {
createWorkflowDispatch: jest.fn(),
},
},
});
describe('#publishTemplate', () => {
beforeEach(jest.clearAllMocks);
it('checks commits for magic #publish-package-to-npm&latest string and sets latest', async () => {
mockRun.mockReturnValueOnce(`
The commit message
#publish-packages-to-npm&latest`);
const github = getMockGithub();
await publishTemplate(github, '0.76.0', true);
expect(github.rest.actions.createWorkflowDispatch).toHaveBeenCalledWith({
owner: 'react-native-community',
repo: 'template',
workflow_id: 'release.yml',
ref: '0.76-stable',
inputs: {
dry_run: true,
is_latest_on_npm: true,
version: '0.76.0',
},
});
});
it('pubished as is_latest_on_npm = false if missing magic string', async () => {
mockRun.mockReturnValueOnce(`
The commit message without magic
`);
const github = getMockGithub();
await publishTemplate(github, '0.76.0', false);
expect(github.rest.actions.createWorkflowDispatch).toHaveBeenCalledWith({
owner: 'react-native-community',
repo: 'template',
workflow_id: 'release.yml',
ref: '0.76-stable',
inputs: {
dry_run: false,
is_latest_on_npm: false,
version: '0.76.0',
},
});
});
});
describe('#verifyPublishedTemplate', () => {
beforeEach(jest.clearAllMocks);
it("waits on npm updating for version and not 'latest'", async () => {
const NOT_LATEST = false;
mockGetNpmPackageInfo
// template@<version>
.mockReturnValueOnce(Promise.reject('mock http/404'))
.mockReturnValueOnce(Promise.resolve());
mockSleep.mockReturnValueOnce(Promise.resolve()).mockImplementation(() => {
throw new Error('Should not be called again!');
});
const version = '0.77.0';
await verifyPublishedTemplate(version, NOT_LATEST);
expect(mockGetNpmPackageInfo).toHaveBeenLastCalledWith(
'@react-native-community/template',
version,
);
});
it('waits on npm updating version and latest tag', async () => {
const IS_LATEST = true;
const version = '0.77.0';
mockGetNpmPackageInfo
// template@latest → unknown tag
.mockReturnValueOnce(Promise.reject('mock http/404'))
// template@latest != version → old tag
.mockReturnValueOnce(Promise.resolve({version: '0.76.5'}))
// template@latest == version → correct tag
.mockReturnValueOnce(Promise.resolve({version}));
mockSleep
.mockReturnValueOnce(Promise.resolve())
.mockReturnValueOnce(Promise.resolve())
.mockImplementation(() => {
throw new Error('Should not be called again!');
});
await verifyPublishedTemplate(version, IS_LATEST);
expect(mockGetNpmPackageInfo).toHaveBeenCalledWith(
'@react-native-community/template',
'latest',
);
});
describe('timeouts', () => {
let mockProcess;
beforeEach(() => {
mockProcess = jest.spyOn(process, 'exit').mockImplementation(code => {
throw new Error(`process.exit(${code}) called!`);
});
});
afterEach(() => mockProcess.mockRestore());
it('will timeout if npm does not update package version after a set number of retries', async () => {
const RETRIES = 2;
mockGetNpmPackageInfo.mockReturnValue(Promise.reject('mock http/404'));
mockSleep.mockReturnValue(Promise.resolve());
await expect(() =>
verifyPublishedTemplate('0.77.0', true, RETRIES),
).rejects.toThrowError('process.exit(1) called!');
expect(mockGetNpmPackageInfo).toHaveBeenCalledTimes(RETRIES);
});
it('will timeout if npm does not update latest tag after a set number of retries', async () => {
const RETRIES = 7;
const IS_LATEST = true;
mockGetNpmPackageInfo.mockReturnValue(
Promise.resolve({version: '0.76.5'}),
);
mockSleep.mockReturnValue(Promise.resolve());
await expect(async () => {
await verifyPublishedTemplate('0.77.0', IS_LATEST, RETRIES);
}).rejects.toThrowError('process.exit(1) called!');
expect(mockGetNpmPackageInfo).toHaveBeenCalledTimes(RETRIES);
});
});
});
+108
View File
@@ -0,0 +1,108 @@
/**
* 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.
*
* @format
*/
const childProcess = require('child_process');
const usage = `
=== Usage ===
node maestro-android.js <path to app> <app_id> <maestro_flow> <flavor> <working_directory>
@param {string} appPath - Path to the app APK
@param {string} appId - App ID that needs to be launched
@param {string} maestroFlow - Path to the maestro flow to be executed
@param {string} flavor - Flavor of the app to be launched. Can be 'release' or 'debug'
@param {string} workingDirectory - Working directory from where to run Metro
==============
`;
const args = process.argv.slice(2);
if (args.length !== 5) {
throw new Error(`Invalid number of arguments.\n${usage}`);
}
const APP_PATH = args[0];
const APP_ID = args[1];
const MAESTRO_FLOW = args[2];
const IS_DEBUG = args[3] === 'debug';
const WORKING_DIRECTORY = args[4];
async function main() {
console.info('\n==============================');
console.info('Running tests for Android with the following parameters:');
console.info(`APP_PATH: ${APP_PATH}`);
console.info(`APP_ID: ${APP_ID}`);
console.info(`MAESTRO_FLOW: ${MAESTRO_FLOW}`);
console.info(`IS_DEBUG: ${IS_DEBUG}`);
console.info(`WORKING_DIRECTORY: ${WORKING_DIRECTORY}`);
console.info('==============================\n');
console.info('Install app');
childProcess.execSync(`adb install ${APP_PATH}`, {stdio: 'ignore'});
let metroProcess = null;
if (IS_DEBUG) {
console.info('Start Metro');
childProcess.execSync(`cd ${WORKING_DIRECTORY}`, {stdio: 'ignore'});
metroProcess = childProcess.spawn('yarn', ['start', '&'], {
cwd: WORKING_DIRECTORY,
stdio: 'ignore',
detached: true,
});
console.info(`- Metro PID: ${metroProcess.pid}`);
}
console.info('Wait For Metro to Start');
await sleep(5000);
console.info('Start the app');
childProcess.execSync(`adb shell monkey -p ${APP_ID} 1`, {stdio: 'ignore'});
console.info('Start recording to /sdcard/screen.mp4');
childProcess
.exec('adb shell screenrecord /sdcard/screen.mp4', {
stdio: 'ignore',
detached: true,
})
.unref();
console.info(`Start testing ${MAESTRO_FLOW}`);
let error = null;
try {
childProcess.execSync(
`MAESTRO_DRIVER_STARTUP_TIMEOUT=120000 $HOME/.maestro/bin/maestro test ${MAESTRO_FLOW} --format junit -e APP_ID=${APP_ID} --debug-output /tmp/MaestroLogs`,
{stdio: 'inherit'},
);
} catch (err) {
error = err;
} finally {
console.info('Stop recording');
childProcess.execSync('adb pull /sdcard/screen.mp4', {stdio: 'ignore'});
if (IS_DEBUG && metroProcess != null) {
const pid = metroProcess.pid;
console.info(`Kill Metro. PID: ${pid}`);
process.kill(-pid);
console.info(`Metro Killed`);
process.exit();
}
}
if (error) {
throw error;
}
}
function sleep(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
}
main();
+103
View File
@@ -0,0 +1,103 @@
/**
* 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.
*
* @format
*/
const {run, sleep, getNpmPackageInfo, log} = require('./utils.js');
const TAG_AS_LATEST_REGEX = /#publish-packages-to-npm&latest/;
/**
* Should this commit be `latest` on npm?
*/
function isLatest() {
const commitMessage = run('git log -n1 --pretty=%B');
return TAG_AS_LATEST_REGEX.test(commitMessage);
}
module.exports.isLatest = isLatest;
/**
* Create a Github Action to publish the community template matching the released version
* of React Native.
*/
module.exports.publishTemplate = async (github, version, dryRun = true) => {
log(`📤 Get the ${TEMPLATE_NPM_PKG} repo to publish ${version}`);
const is_latest_on_npm = isLatest();
const majorMinor = /^v?(\d+\.\d+)/.exec(version);
if (!majorMinor) {
log(`🔥 can't capture MAJOR.MINOR from '${version}', giving up.`);
process.exit(1);
}
// MAJOR.MINOR-stable
const ref = `${majorMinor[1]}-stable`;
await github.rest.actions.createWorkflowDispatch({
owner: 'react-native-community',
repo: 'template',
workflow_id: 'release.yml',
ref,
inputs: {
dry_run: dryRun,
is_latest_on_npm,
// 0.75.0-rc.0, note no 'v' prefix
version: version.replace(/^v/, ''),
},
});
};
const SLEEP_S = 10;
const MAX_RETRIES = 3 * 6; // 3 minutes
const TEMPLATE_NPM_PKG = '@react-native-community/template';
/**
* Will verify that @latest and the @<version> have been published.
*
* NOTE: This will infinitely query each step until successful, make sure the
* calling job has a timeout.
*/
module.exports.verifyPublishedTemplate = async (
version,
latest = false,
retries = MAX_RETRIES,
) => {
log(`🔍 Is ${TEMPLATE_NPM_PKG}@${version} on npm?`);
let count = retries;
while (count-- > 0) {
try {
const json = await getNpmPackageInfo(
TEMPLATE_NPM_PKG,
latest ? 'latest' : version,
);
log(`🎉 Found ${TEMPLATE_NPM_PKG}@${version} on npm`);
if (!latest) {
return;
}
if (json.version === version) {
log(`🎉 ${TEMPLATE_NPM_PKG}@latest → ${version} on npm`);
return;
}
log(
`🐌 ${TEMPLATE_NPM_PKG}@latest → ${pkg.version} on npm and not ${version} as expected, retrying...`,
);
} catch (e) {
log(`Nope, fetch failed: ${e.message}`);
}
await sleep(SLEEP_S);
}
let msg = `🚨 Timed out when trying to verify ${TEMPLATE_NPM_PKG}@${version} on npm`;
if (latest) {
msg += ' and latest tag points to this version.';
}
log(msg);
process.exit(1);
};
+29
View File
@@ -0,0 +1,29 @@
/**
* 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.
*
* @format
*/
const {execSync} = require('child_process');
function run(...cmd) {
return execSync(cmd, 'utf8').toString().trim();
}
module.exports.run = run;
async function sleep(seconds) {
return new Promise(resolve => setTimeout(resolve, seconds * 1000));
}
module.exports.sleep = sleep;
async function getNpmPackageInfo(pkg, versionOrTag) {
return fetch(`https://registry.npmjs.org/${pkg}/${versionOrTag}`).then(resp =>
res.json(),
);
}
module.exports.getNpmPackageInfo = getNpmPackageInfo;
module.exports.log = (...args) => console.log(...args);
+5 -12
View File
@@ -1,26 +1,19 @@
name: Run Danger on PR
on:
pull_request_target:
pull_request:
types: [opened, edited, reopened, synchronize]
permissions:
actions: write
checks: write
contents: write
issues: write
pull-requests: write
statuses: write
jobs:
danger:
runs-on: ubuntu-latest
if: github.repository == 'facebook/react-native'
steps:
- uses: actions/checkout@v4
- name: Run Yarn Install on Root
run: yarn install
working-directory: .
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Run yarn
uses: ./.github/actions/yarn-install-with-cache
- name: Danger
run: yarn danger ci --use-github-checks --failOnErrors
working-directory: packages/react-native-bots
+1 -1
View File
@@ -67,7 +67,7 @@ jobs:
fail-fast: false
matrix:
flavor: [Debug, Release]
slice: [macosx, iphoneos, iphonesimulator, catalyst, xros, xrsimulator]
slice: [macosx, iphoneos, iphonesimulator, appletvos, appletvsimulator, catalyst, xros, xrsimulator]
steps:
- name: Checkout
uses: actions/checkout@v4
+16 -39
View File
@@ -64,7 +64,7 @@ jobs:
fail-fast: false
matrix:
flavor: [Debug, Release]
slice: [macosx, iphoneos, iphonesimulator, catalyst, xros, xrsimulator]
slice: [macosx, iphoneos, iphonesimulator, appletvos, appletvsimulator, catalyst, xros, xrsimulator]
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -191,46 +191,23 @@ jobs:
gha-npm-token: ${{ env.GHA_NPM_TOKEN }}
- name: Publish @react-native-community/template
id: publish-template-to-npm
shell: bash
run: |
COMMIT_MSG=$(git log -n1 --pretty=%B);
if grep -q '#publish-packages-to-npm&latest' <<< "$COMMIT_MSG"; then
echo "TAG=latest" >> $GITHUB_OUTPUT
IS_LATEST=true
else
IS_LATEST=false
fi
# Go from v0.75.0-rc.4 -> 0.75-stable, which is the template's branching scheme
VERSION=$(grep -oE '\d+\.\d+' <<< "${{ github.ref_name }}" | { read version; echo "$version-stable"; })
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
curl -L https://api.github.com/repos/react-native-community/template/actions/workflows/release.yaml/dispatches
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer $REACT_NATIVE_BOT_GITHUB_TOKEN" \
-d "{\"ref\":\"$VERSION\",\"inputs\":{\"version\":\"${{ github.ref_name }}\",\"is_latest_on_npm\":\"$IS_LATEST\"}}"
uses: actions/github-script@v6
with:
github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
script: |
const {publishTemplate} = require('./.github/workflow-scripts/publishTemplate.js')
const version = "${{ github.ref_name }}"
const isDryRun = false
await publishTemplate(github, version, isDryRun);
- name: Wait for template to be published
timeout-minutes: 3
env:
VERSION: ${{ steps.publish-template-to-npm.outputs.VERSION }}
TAG: ${{ steps.publish-template-to-npm.outputs.TAG }}
shell: bash
run: |
echo "Waiting until @react-native-community/template is published to npm"
while true; do
if curl -o /dev/null -s -f "https://registry.npmjs.org/@react-native-community/template/$VERSION"; then
echo "Confirm that @react-native-community/template@$VERSION is published on npm"
break
fi
sleep 10
done
while [ "$TAG" == "latest" ]; do
CURRENT=$(curl -s "https://registry.npmjs.org/react-native/latest" | jq -r '.version');
if [ "$CURRENT" == "$VERSION" ]; then
echo "Confirm that @react-native-community/template@latest == $VERSION on npm"
break
fi
sleep 10
done
uses: actions/github-script@v6
with:
github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
script: |
const {verifyPublished, isLatest} = require('./.github/workflow-scripts/publishTemplate.js')
const version = "${{ github.ref_name }}"
await verifyPublished(version, isLatest());
- name: Update rn-diff-purge to generate upgrade-support diff
run: |
curl -X POST https://api.github.com/repos/react-native-community/rn-diff-purge/dispatches \
+57 -27
View File
@@ -2,16 +2,17 @@ name: Test All
on:
workflow_dispatch:
inputs:
run-e2e-tests:
description: Whether to run E2E tests or not
type: boolean
default: false
pull_request:
push:
branches:
- main
- "*-stable"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !contains(github.ref, 'stable')}}
jobs:
set_release_type:
runs-on: ubuntu-latest
@@ -34,6 +35,8 @@ jobs:
echo "RELEASE_TYPE=dry-run" >> $GITHUB_OUTPUT
fi
echo "Should I run E2E tests? ${{ inputs.run-e2e-tests }}"
prepare_hermes_workspace:
runs-on: ubuntu-latest
env:
@@ -80,7 +83,7 @@ jobs:
fail-fast: false
matrix:
flavor: [Debug, Release]
slice: [macosx, iphoneos, iphonesimulator, catalyst, xros, xrsimulator]
slice: [macosx, iphoneos, iphonesimulator, appletvos, appletvsimulator, catalyst, xros, xrsimulator]
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -180,8 +183,8 @@ jobs:
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
test_e2e_ios_rntester:
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') }}
runs-on: macos-13
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }}
runs-on: macos-13-large
needs:
[build_apple_slices_hermes, prepare_hermes_workspace, build_hermes_macos]
env:
@@ -193,6 +196,7 @@ jobs:
matrix:
jsengine: [Hermes, JSC]
architecture: [NewArch]
flavor: [Debug, Release]
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -206,17 +210,19 @@ jobs:
hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }}
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
run-e2e-tests: "true"
flavor: ${{ matrix.flavor }}
- name: Run E2E Tests
uses: ./.github/actions/maestro-ios
with:
app-path: "/tmp/RNTesterBuild/Build/Products/Release-iphonesimulator/RNTester.app"
app-path: "/tmp/RNTesterBuild/Build/Products/${{ matrix.flavor }}-iphonesimulator/RNTester.app"
app-id: com.meta.RNTester.localDevelopment
jsengine: ${{ matrix.jsengine }}
maestro-flow: ./packages/rn-tester/.maestro/
flavor: ${{ matrix.flavor }}
test_e2e_ios_templateapp:
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') }}
runs-on: macos-13
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }}
runs-on: macos-13-large
needs: build_npm_package
env:
HERMES_WS_DIR: /tmp/hermes
@@ -226,6 +232,7 @@ jobs:
fail-fast: false
matrix:
jsengine: [Hermes, JSC]
flavor: [Debug, Release]
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -242,7 +249,7 @@ jobs:
- name: Download Hermes
uses: actions/download-artifact@v4
with:
name: hermes-darwin-bin-Release
name: hermes-darwin-bin-${{matrix.flavor}}
path: /tmp/react-native-tmp
- name: Download React Native Package
uses: actions/download-artifact@v4
@@ -259,29 +266,38 @@ jobs:
HERMES_PATH=$(find /tmp/react-native-tmp -type f -name "*.tar.gz")
echo "Hermes path is $HERMES_PATH"
node ./scripts/e2e/init-project-e2e.js --projectName RNTestProject --currentBranch ${{ github.ref_name }} --directory /tmp/RNTestProject --pathToLocalReactNative $REACT_NATIVE_PKG
# For stable branches, we want to use the stable branch of the template
# In all the other cases, we want to use "main"
BRANCH=${{ github.ref_name }}
if ! [[ $BRANCH == *-stable* ]]; then
BRANCH=main
fi
node ./scripts/e2e/init-project-e2e.js --projectName RNTestProject --currentBranch $BRANCH --directory /tmp/RNTestProject --pathToLocalReactNative $REACT_NATIVE_PKG
cd /tmp/RNTestProject/ios
bundle install
HERMES_ENGINE_TARBALL_PATH=$HERMES_PATH bundle exec pod install
set -o pipefail && xcodebuild \
xcodebuild \
-scheme "RNTestProject" \
-workspace RNTestProject.xcworkspace \
-configuration "Release" \
-configuration "${{ matrix.flavor }}" \
-sdk "iphonesimulator" \
-destination "generic/platform=iOS Simulator" \
-derivedDataPath "/tmp/RNTestProject" | xcbeautify
-derivedDataPath "/tmp/RNTestProject"
- name: Run E2E Tests
uses: ./.github/actions/maestro-ios
with:
app-path: "/tmp/RNTestProject/Build/Products/Release-iphonesimulator/RNTestProject.app"
app-path: "/tmp/RNTestProject/Build/Products/${{ matrix.flavor }}-iphonesimulator/RNTestProject.app"
app-id: org.reactjs.native.example.RNTestProject
jsengine: ${{ matrix.jsengine }}
maestro-flow: ./scripts/e2e/.maestro/
flavor: ${{ matrix.flavor }}
working-directory: /tmp/RNTestProject
test_e2e_android_templateapp:
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') }}
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }}
runs-on: 4-core-ubuntu
needs: build_npm_package
continue-on-error: true
@@ -289,6 +305,7 @@ jobs:
fail-fast: false
matrix:
jsengine: [Hermes, JSC]
flavor: [debug, release]
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -314,6 +331,7 @@ jobs:
- name: Print /tmp folder
run: ls -lR /tmp/react-native-tmp
- name: Prepare artifacts
id: prepare-artifacts
run: |
REACT_NATIVE_PKG=$(find /tmp/react-native-tmp -type f -name "*.tgz")
echo "React Native tgs is $REACT_NATIVE_PKG"
@@ -321,7 +339,13 @@ jobs:
MAVEN_LOCAL=/tmp/react-native-tmp/maven-local
echo "Maven local path is $MAVEN_LOCAL"
node ./scripts/e2e/init-project-e2e.js --projectName RNTestProject --currentBranch ${{ github.ref_name }} --directory /tmp/RNTestProject --pathToLocalReactNative $REACT_NATIVE_PKG
# For stable branches, we want to use the stable branch of the template
# In all the other cases, we want to use "main"
BRANCH=${{ github.ref_name }}
if ! [[ $BRANCH == *-stable* ]]; then
BRANCH=main
fi
node ./scripts/e2e/init-project-e2e.js --projectName RNTestProject --currentBranch $BRANCH --directory /tmp/RNTestProject --pathToLocalReactNative $REACT_NATIVE_PKG
echo "Feed maven local to gradle.properties"
cd /tmp/RNTestProject
@@ -329,15 +353,19 @@ jobs:
# Build
cd android
./gradlew assembleRelease --no-daemon -PreactNativeArchitectures=x86
CAPITALIZED_FLAVOR=$(echo "${{ matrix.flavor }}" | awk '{print toupper(substr($0, 1, 1)) substr($0, 2)}')
./gradlew assemble$CAPITALIZED_FLAVOR --no-daemon -PreactNativeArchitectures=x86
- name: Run E2E Tests
uses: ./.github/actions/maestro-android
with:
app-path: /tmp/RNTestProject/android/app/build/outputs/apk/release/app-release.apk
app-path: /tmp/RNTestProject/android/app/build/outputs/apk/${{ matrix.flavor }}/app-${{ matrix.flavor }}.apk
app-id: com.rntestproject
jsengine: ${{ matrix.jsengine }}
maestro-flow: ./scripts/e2e/.maestro/
install-java: 'false'
flavor: ${{ matrix.flavor }}
working-directory: /tmp/RNTestProject
build_hermesc_linux:
runs-on: ubuntu-latest
@@ -390,16 +418,17 @@ jobs:
uses: ./.github/actions/build-android
with:
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
run-e2e-tests: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') }}
run-e2e-tests: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }}
test_e2e_android_rntester:
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') }}
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }}
runs-on: ubuntu-latest
needs: [build_android]
strategy:
fail-fast: false
matrix:
jsengine: [hermes, jsc]
flavor: [debug, release]
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -410,17 +439,18 @@ jobs:
- name: Download APK
uses: actions/download-artifact@v4
with:
name: rntester-${{ matrix.jsengine }}-release
path: ./packages/rn-tester/android/app/build/outputs/apk/${{ matrix.jsengine }}/release/
name: rntester-${{ matrix.jsengine }}-${{ matrix.flavor }}
path: ./packages/rn-tester/android/app/build/outputs/apk/${{ matrix.jsengine }}/${{ matrix.flavor }}/
- name: Print folder structure
run: ls -lR ./packages/rn-tester/android/app/build/outputs/apk/${{ matrix.jsengine }}/release/
run: ls -lR ./packages/rn-tester/android/app/build/outputs/apk/${{ matrix.jsengine }}/${{ matrix.flavor }}/
- name: Run E2E Tests
uses: ./.github/actions/maestro-android
with:
app-path: ./packages/rn-tester/android/app/build/outputs/apk/${{ matrix.jsengine }}/release/app-${{ matrix.jsengine }}-x86-release.apk
app-path: ./packages/rn-tester/android/app/build/outputs/apk/${{ matrix.jsengine }}/${{ matrix.flavor }}/app-${{ matrix.jsengine }}-x86-${{ matrix.flavor }}.apk
app-id: com.facebook.react.uiapp
jsengine: ${{ matrix.jsengine }}
maestro-flow: ./packages/rn-tester/.maestro/
maestro-flow: ./packages/rn-tester/.maestro
flavor: ${{ matrix.flavor }}
build_npm_package:
runs-on: 8-core-ubuntu
@@ -0,0 +1,45 @@
name: Trigger E2E Tests on Comment
# This workflow is used to automatically trigger E2E tests when a comment is made
# containing the text "/run-e2e-tests".
on:
issue_comment:
types: [created]
permissions:
contents: read
jobs:
trigger-e2e-tests:
name: Trigger E2E Tests
runs-on: ubuntu-latest
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/test-e2e')
steps:
# This is needed because of https://github.com/actions/runner-images/issues/6283
# TL;DR: brew is not in the PATH anymore.
- name: Setup Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Install jq
run: brew install jq
- name: Run E2E Tests
run: |
# Github does not provide the branch of a PR when a comment on a PR is made
# So, given the issue number, which is the PR number, we can retrieve the branch with
# a quick API call
echo "Retrieving branch"
BRANCH=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/facebook/react-native/pulls/$PR_NUMBER | jq -r '.head.ref')
echo "Trigger Test All workflow for branch $BRANCH"
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/facebook/react-native/actions/workflows/test-all.yml/dispatches \
-d "{\"ref\": \"$BRANCH\", \"inputs\": {\"run-e2e-tests\": \"true\"}}"
env:
GITHUB_TOKEN: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number }}
+597
View File
@@ -1,5 +1,563 @@
# Changelog
## v0.76.0-rc.6
### Fixed
#### Android Specific
- Undo breaking change on ViewManagerDelegate.kt String params ([ce1620616c](https://github.com/facebook/react-native/commit/ce1620616c5e5d83bfbcd1ce297d95e1c1c66e8c) by [@cortinico](https://github.com/cortinico))
- Undo breaking change on UIManager eventDispatcher accessor ([55671c00e5](https://github.com/facebook/react-native/commit/55671c00e5567845ffe467e50a4b9dfa562e48db) by [@cortinico](https://github.com/cortinico))
- Revert "Fix Android AlertFragment Title Accessibility" as it was breaking the layout of Alerts ([c967deaa2d](https://github.com/facebook/react-native/commit/c967deaa2d52abf2ffcf101f3ee0f23c593b6959) by [@cipolleschi](https://github.com/cipolleschi))
## v0.76.0-rc.5
### Changed
- Fix server.end() usage following Metro bump ([02b879b1e2](https://github.com/facebook/react-native/commit/02b879b1e22dd03f52ff77d82cac3fe167aaea84) by [@huntie](https://github.com/huntie))
- Update Metro to "^0.81.0" ([3f8d1fa286](https://github.com/facebook/react-native/commit/3f8d1fa2862814cc8e2b091786e80231670bb876) by [@robhogan](https://github.com/robhogan))
#### Android specific
- Make PackagerConnectionSettings class open again ([4dd47eeb9e](https://github.com/facebook/react-native/commit/4dd47eeb9ea91455efcd0db23a02162ab338a53f) by [@gabrieldonadel](https://github.com/gabrieldonadel))
- Fix crash for Modal not attached to window manager ([73ce1984e8](https://github.com/facebook/react-native/commit/73ce1984e8411a6b4aec440a5e7aa9d2b7474984) by [@alanleedev](https://github.com/alanleedev))
- Gradle to 8.10.2 ([60a2706e97](https://github.com/facebook/react-native/commit/60a2706e9716d955fc0d7e15b02ad0d6efe58fc2) by [@cortinico](https://github.com/cortinico))
#### iOS specific
- Enforce we use the correct C++ version for all, even if dependency tries to set it ([d7a8aae9ac](https://github.com/facebook/react-native/commit/d7a8aae9acc441d9b6c52484e35ba158e90b4b60) by [@Titozzz](https://github.com/Titozzz))
## Fixed
#### iOS specific
- Exclude dSYM from the archive ([7e14ec5177f](https://github.com/facebook/react-native/commit/7e14ec5177fd17ca9f1db384026b26ae90ab0b00) by [@cipolleschi](https://github.com/cipolleschi))
## v0.76.0-rc.4
### Breaking
#### Android specific
- Update ReactNativeFlipper deprecation to ERROR ([531657b394](https://github.com/facebook/react-native/commit/531657b394aa0fac70f26d9facdb32d23a1b05d6) by [@cortinico](https://github.com/cortinico))
#### iOS specific
- Add ability to control bundle loading on the new architecture similar to `loadSourceForBridge`. Removed some properties from the `RCTRootViewFactory`. ([7487a2c277](https://github.com/facebook/react-native/commit/7487a2c27713a0129ef2db70efc2fa543a8c185e) by [@alanjhughes](https://github.com/alanjhughes))
### Added
- Expose `MetroConfig` type directly from `react-native/metro-config`. ([cc6d1eb844](https://github.com/facebook/react-native/commit/cc6d1eb8449c25fe3c76aaf4da5cd38b3ac0783d) by [@tjzel](https://github.com/tjzel))
#### iOS specific
- Improve RCTAppDelegate usage for brownfield, add `automaticallyLoadReactNativeWindow` flag ([391680fe84](https://github.com/facebook/react-native/commit/391680fe844aad887e497912378c699aed13464b) by [@okwasniewski](https://github.com/okwasniewski))
### Changed
- Update debugger-frontend from e8c7943...ce5d32a ([7a601f428e](https://github.com/facebook/react-native/commit/7a601f428e171827ecb79cb0829d018835229d92) by [@huntie](https://github.com/huntie))
- Use Metro terminal reporter for dev-middleware logs ([2f04dfe795](https://github.com/facebook/react-native/commit/2f04dfe7951e5f4c63f94c74d7ad10cd53969da0) by [@huntie](https://github.com/huntie))
- Simplify key handling in start command ([5a0df6d0bf](https://github.com/facebook/react-native/commit/5a0df6d0bf5e84d3f7d2a6f000e617e00b8bef02) by [@huntie](https://github.com/huntie))
- Add CLI selection of multiple debug targets ([6a24df7eaa](https://github.com/facebook/react-native/commit/6a24df7eaab2420e91b9a4fc9202c175c0802441) by [@huntie](https://github.com/huntie))
- Update Metro to 0.81.0-alpha.2 ([2a344a9580](https://github.com/facebook/react-native/commit/2a344a95806c62bbc708b5466760b009eae0c579) by [@huntie](https://github.com/huntie))
#### iOS specific
- Rename `RCTUIGraphicsImageRenderer` to `RCTMakeUIGraphicsImageRenderer` ([6a09fc09af](https://github.com/facebook/react-native/commit/6a09fc09af8eedbf409ab870d5714e44892b2a16) by [@Saadnajmi](https://github.com/Saadnajmi))
- Passed correct title and titleColor prop to updateTitle function ([5c7a166dca](https://github.com/facebook/react-native/commit/5c7a166dcaf5400fbc4c12d4c8b451228157c036) by [@shubhamguptadream11](https://github.com/shubhamguptadream11))
### Fixed
- Fix ReactFragment on New Architecture ([52322fbd0e](https://github.com/facebook/react-native/commit/52322fbd0e641726b224b2b9b89d99d93dbc6e33) by [@cortinico](https://github.com/cortinico))
- Fix logbox reporting React errors as Warnings ([cbb313253f](https://github.com/facebook/react-native/commit/cbb313253fdf96c4fca06a24ed4cbd3f3df9db80) by [@rickhanlonii](https://github.com/rickhanlonii))
- Respond with status code `200` when successfully launching RNDT ([eeb6122f39](https://github.com/facebook/react-native/commit/eeb6122f390d355191182eaee6cf126468e7b4d4) by [@byCedric](https://github.com/byCedric))
- Fix parsing of modern Flow syntax when `transformer.hermesParser = false` is configured in Metro config ([1387f521fd](https://github.com/facebook/react-native/commit/1387f521fdd8f187eab7a4a6a05d4d75a96b4f88) by [@huntie](https://github.com/huntie))
- Restore Metro log forwarding, change notice to signal future removal ([6047f9cc09](https://github.com/facebook/react-native/commit/6047f9cc09a7a86b79084a3ff1b4303c4583d2ce) by [@huntie](https://github.com/huntie))
#### Android specific
- Add missing Android implementation for DevMenu Module ([1bdae07d89](https://github.com/facebook/react-native/commit/1bdae07d89fdda486d3f9dbcc4aa5cbb026fc8b6) by [@cortinico](https://github.com/cortinico))
- Fix measuring text with incorrect hyphenationFrequency ([fc8224036b](https://github.com/facebook/react-native/commit/fc8224036b4b5880c881f471e432ee5b47113b0b) by [@NickGerleman](https://github.com/NickGerleman))
- Properly set `REACTNATIVE_MERGED_SO` for autolinked libraries ([c005609b01](https://github.com/facebook/react-native/commit/c005609b0155223f3ae778c5cd96bc78c4dfe399) by [@cortinico](https://github.com/cortinico))
#### iOS specific
- Properly retain/release backgroundColor in RCTBorderDrawing ([47748c7935](https://github.com/facebook/react-native/commit/47748c7935540014abed03b4d2ff809b471c4fe3) by [@Saadnajmi](https://github.com/Saadnajmi))
- Fix applying of tintColor and progressViewOffset props for RefreshControl component with New Architecture enabled ([19d468fed9](https://github.com/facebook/react-native/commit/19d468fed966f2adb973ad3f19a97a5ec0372e3a) by [@TuTejsy](https://github.com/TuTejsy))
## v0.76.0-rc.3
### Added
- Add CLI selection of multiple debug targets ([6a24df7eaa](https://github.com/facebook/react-native/commit/6a24df7eaab2420e91b9a4fc9202c175c0802441) by [@huntie](https://github.com/huntie))
#### iOS specific
- Improve RCTAppDelegate usage for brownfield, add `automaticallyLoadReactNativeWindow` flag ([391680fe84](https://github.com/facebook/react-native/commit/391680fe844aad887e497912378c699aed13464b) by [@okwasniewski](https://github.com/okwasniewski))
### Changed
- Use Metro terminal reporter for dev-middleware logs ([2f04dfe795](https://github.com/facebook/react-native/commit/2f04dfe7951e5f4c63f94c74d7ad10cd53969da0) by [@huntie](https://github.com/huntie))
- Simplify key handling in start command ([5a0df6d0bf](https://github.com/facebook/react-native/commit/5a0df6d0bf5e84d3f7d2a6f000e617e00b8bef02) by [@huntie](https://github.com/huntie))
- Update Metro to 0.81.0-alpha.2 ([2a344a9580](https://github.com/facebook/react-native/commit/2a344a95806c62bbc708b5466760b009eae0c579) by [@huntie](https://github.com/huntie))
### Fixed
- Fix parsing of modern Flow syntax when `transformer.hermesParser = false` is configured in Metro config ([1387f521fd](https://github.com/facebook/react-native/commit/1387f521fdd8f187eab7a4a6a05d4d75a96b4f88) by [@huntie](https://github.com/huntie))
- Fix ReactFragment on New Architecture ([52322fbd0e](https://github.com/facebook/react-native/commit/52322fbd0e641726b224b2b9b89d99d93dbc6e33) by [@cortinico](https://github.com/cortinico))
#### Android specific
- Add missing Android implementation for DevMenu Module ([1bdae07d89](https://github.com/facebook/react-native/commit/1bdae07d89fdda486d3f9dbcc4aa5cbb026fc8b6) by [@cortinico](https://github.com/cortinico))
- Fix measuring text with incorrect hyphenationFrequency ([fc8224036b](https://github.com/facebook/react-native/commit/fc8224036b4b5880c881f471e432ee5b47113b0b) by [@NickGerleman](https://github.com/NickGerleman))
- Properly set `REACTNATIVE_MERGED_SO` for autolinked libraries ([c005609b01](https://github.com/facebook/react-native/commit/c005609b0155223f3ae778c5cd96bc78c4dfe399) by [@cortinico](https://github.com/cortinico))
#### iOS specific
- Fix applying of tintColor and progressViewOffset props for RefreshControl component with New Architecture enabled ([19d468fed9](https://github.com/facebook/react-native/commit/19d468fed966f2adb973ad3f19a97a5ec0372e3a) by [@TuTejsy](https://github.com/TuTejsy))
- Convert `NSNull` to `nil` before checking `type` in `readAsDataURL` ([99ab845a5c](https://github.com/facebook/react-native/commit/99ab845a5cf0fe3463ff39b03373b95d4f5c0fac) by [@haileyok](https://github.com/haileyok))
- Fix `<KeyboardAvoidingView>` with floating keyboard on iPadOS ([3c54e1ee45](https://github.com/facebook/react-native/commit/3c54e1ee4522b26698bb3f99262a2a621b26fb64) by [@renchap](https://github.com/renchap))
## v0.76.0-rc.2
### Added
#### iOS specific
- Fire onMomentumScrollEnd when UIScrollView is removed from window ([b98b9f1fa7](https://github.com/facebook/react-native/commit/b98b9f1fa7717283f368eb182a51d971b8776c80) by [@shubhamguptadream11](https://github.com/shubhamguptadream11))
### Fixed
- Throttle reload command ([42bad68220](https://github.com/facebook/react-native/commit/42bad68220d288ef2436609ee50ad993c239b362) by [@coado](https://github.com/coado))
#### iOS specific
- Fixed a crash when navigating away from a screen that contains a scrollView ([c6f32828b9](https://github.com/facebook/react-native/commit/c6f32828b9487381dab27f645aedcdbae9dcbc7e) by [@cipolleschi](https://github.com/cipolleschi))
- Allow pods mixte type settings on post-install ([1e59f2e3f8](https://github.com/facebook/react-native/commit/1e59f2e3f8f0ab3ee4173bddaa089bbecf61d1eb) by [@MasGaNo](https://github.com/MasGaNo))
- Add back the BUNDLE_COMMAND ([cf42288181](https://github.com/facebook/react-native/commit/cf422881819decccdd2b486fbb73f2192b9ec522) by [@Vin-Xi](https://github.com/Vin-Xi))
- Fix SVC for lineBreakModeIOS ([1099c0ccf7](https://github.com/facebook/react-native/commit/1099c0ccf7ea4f5d2e5caafd56b4e92faa367dc6) by [@cipolleschi](https://github.com/cipolleschi))
## v0.76.0-rc.1
### Breaking
#### iOS specific
- Unbreak `RCTHermesInstance` constructor breaking change ([aec6666bfa](https://github.com/facebook/react-native/commit/aec6666bfabf93cde70fa869b3eea68590998dee) by [@tido64](https://github.com/tido64))
### Added
- Unhide new arch layout props ([2d6c59e1d4](https://github.com/facebook/react-native/commit/2d6c59e1d4f6ddb46373ed10c915aed4ce0c030c) by [@NickGerleman](https://github.com/NickGerleman))
### Changed
- AnimatedNode (and its subclasses) once again implement `toJSON()`. ([7bd4a54968](https://github.com/facebook/react-native/commit/7bd4a5496815943b031b68ca46792560d8d798d8) by [@yungsters](https://github.com/yungsters))
- Add official `filter` CSSProperty. ([6b369a40d9](https://github.com/facebook/react-native/commit/6b369a40d98c2bb7f933415f62b1e2b8f4da86ed) by [@jorge-cab](https://github.com/jorge-cab))
- Add official `boxShadow` CSSProperty. ([2241c3146f](https://github.com/facebook/react-native/commit/2241c3146ffbfb8b77f54599b7cebb717537c15a) by [@jorge-cab](https://github.com/jorge-cab))
- [0.76] Bump Metro to 0.81.0-alpha ([4126ce844d](https://github.com/facebook/react-native/commit/4126ce844d91612d83a1b2118a4859cac5bb480f) by [@robhogan](https://github.com/robhogan))
#### Android specific
- Expose jsctooling via prefab ([e91690d929](https://github.com/facebook/react-native/commit/e91690d929d7c8b251964cae282ad8e1d95aa39a) by [@tomekzaw](https://github.com/tomekzaw))
- Expose hermestooling via prefab ([f41af55958](https://github.com/facebook/react-native/commit/f41af55958dfbc39c536d433c3a27db329dd05f1) by [@cortinico](https://github.com/cortinico))
### Fixed
#### Android specific
- Fix Headless Crash `Tried to finish non-existent task with id` ([b4532adad4](https://github.com/facebook/react-native/commit/b4532adad4e38e1237631778f7b8c917a9ccf746) by [@RodolfoGS](https://github.com/RodolfoGS))
- Expose `react_timing` headers in `reactnative` prefab ([b1d42c8ef2](https://github.com/facebook/react-native/commit/b1d42c8ef2eb54af48ad27d3dc121e15c07d3dba) by [@tomekzaw](https://github.com/tomekzaw))
- RNGP - Sanitize the output of the config command ([d7884a6bb8](https://github.com/facebook/react-native/commit/d7884a6bb8f2d8fd08dfd7d2817a4fc25f61a57c) by [@cortinico](https://github.com/cortinico))
#### iOS specific
- Don't reference PrivacyInfo.xcprivacy twice for new projects ([cadd41b1a2](https://github.com/facebook/react-native/commit/cadd41b1a2e16b1c77a8d3022f4ccbdbd5ea295f) by [@okwasniewski](https://github.com/okwasniewski))
- Fixed warnings when validating SVC ([de39a204c3](https://github.com/facebook/react-native/commit/de39a204c3588a3c02dc2e72464174c75b3a6749) by [@cipolleschi](https://github.com/cipolleschi))
- Solved SVC warnings for RNTester ([fad4a0783b](https://github.com/facebook/react-native/commit/fad4a0783b0a0478c147d9bde2ef9ab082a08297) by [@cipolleschi](https://github.com/cipolleschi))
## v0.76.0-rc.0
### Breaking
- Remove Inspector Panel perf + network tabs under New Arch (see https://github.com/react-native-community/discussions-and-proposals/pull/777) ([f220bde4d7](https://github.com/facebook/react-native/commit/f220bde4d7d556b3be83cccff0eec5da22921aba) by [@huntie](https://github.com/huntie))
- Always use AttributedStringBox instead of AttributedString in TextLayoutManager ([ee597bfe2b](https://github.com/facebook/react-native/commit/ee597bfe2bf7f11ac60dab87f47dbcb6e840749c) by [@NickGerleman](https://github.com/NickGerleman))
- Projects that intend to use the community CLI will now have to declare that dependency instead of transitively having the react-native package handle this. ([bd3a3e3de0](https://github.com/facebook/react-native/commit/bd3a3e3de08e334db6f1f248241df8ea4680724c) by [@blakef](https://github.com/blakef))
- - [iOS] RCTTurboModuleWithJSIBindings: https://github.com/facebook/react-native/pull/44486 ([184646e491](https://github.com/facebook/react-native/commit/184646e49169110842bafa6c02e52f6eec1e0ffa) by [@philIip](https://github.com/philIip))
- Remove several libs from default App CMake setup ([52de8c70f2](https://github.com/facebook/react-native/commit/52de8c70f2d8826789e4118b0c81aa4397e833fc) by [@cortinico](https://github.com/cortinico))
- Looping animations will not send React state updates. ([8af5e893c8](https://github.com/facebook/react-native/commit/8af5e893c89b24dca972afe36ef442fd509d5804) by [@dmytrorykun](https://github.com/dmytrorykun))
- React-native isn't dependend on react-native-community/* ([9269429bb9](https://github.com/facebook/react-native/commit/9269429bb955d47088793a2e32454fddb712152b) by [@blakef](https://github.com/blakef))
#### Android specific
- ([e881a1184c](https://github.com/facebook/react-native/commit/e881a1184cadd45321b781d07c6154a14332c5f6) by [@philIip](https://github.com/philIip))
- Merge all the remaining .so libraries into libreactnative.so ([db80d78d7a](https://github.com/facebook/react-native/commit/db80d78d7a3d61d5bd6871258513f778851059f5) by [@cortinico](https://github.com/cortinico))
- Remove several unnecessary android prefab targets. Use ReactAndroid::reactnative instead ([6e5227bd83](https://github.com/facebook/react-native/commit/6e5227bd8357dcbe12038b21066cf414e3f97e03) by [@cortinico](https://github.com/cortinico))
- Do not depend on OSS SoLoader anymore and do not expose Fresco `api` dependency. ([6dc01dad09](https://github.com/facebook/react-native/commit/6dc01dad09c6ee2ac6793db1b11cb98faada9c3b) by [@cortinico](https://github.com/cortinico))
- Do not implicitly convert parsed LengthPercentage to pixels ([9e48976bc2](https://github.com/facebook/react-native/commit/9e48976bc2864c6ef6995179a7dc8d1c453dcf39) by [@NickGerleman](https://github.com/NickGerleman))
- Deleted LongArray ([471445eb17](https://github.com/facebook/react-native/commit/471445eb1770dcb773eb463af99c9556cb070abc) by Thomas Nardone)
- Updating `minSdkVersion` to API 24 (Android 7) ([270951a212](https://github.com/facebook/react-native/commit/270951a2123b5c51567b72a8f1a8a1608cba43d7) by [@alanleedev](https://github.com/alanleedev))
- Set "enableBackgroundStyleApplicator" by default ([5f14963da0](https://github.com/facebook/react-native/commit/5f14963da081deeac2fb540d58c8667c2d2c5d08) by [@NickGerleman](https://github.com/NickGerleman))
- Undo a breaking change with ResourceDrawableIdHelper.instance ([3f8340975b](https://github.com/facebook/react-native/commit/3f8340975b35767b192e3118f05d2b039676052e) by [@cortinico](https://github.com/cortinico))
- Undo a breaking change with I18nUtil.instance ([221755c495](https://github.com/facebook/react-native/commit/221755c495ba1e8b27400ae4178c6b0085a2ace5) by [@cortinico](https://github.com/cortinico))
- Undo breaking change for ReadableMap.entryIterator for Kotlin consumers ([b24d47a9a7](https://github.com/facebook/react-native/commit/b24d47a9a759954915629e6fa320a379cc29193d) by [@cortinico](https://github.com/cortinico))
- Undo breaking change on Dynamic.type and Dynamic.isNull ([5e31b45fc7](https://github.com/facebook/react-native/commit/5e31b45fc7bea37ecb3703fac6b2abaccae2cbae) by [@cortinico](https://github.com/cortinico))
- Undo breaking change on `CatalystInstance.getJsCallInvokerHolder` ([2ea9c360dc](https://github.com/facebook/react-native/commit/2ea9c360dc42a75f224e5d161163d65ef197ac24) by [@cortinico](https://github.com/cortinico))
- `ReactNativeHost` invalidates the instance manager on `clear()` ([986cf18dd2](https://github.com/facebook/react-native/commit/986cf18dd2f0d6ea491d521549c0bf9a323e189b) by [@motiz88](https://github.com/motiz88))
#### iOS specific
### Added
- Update babel and fix tests accordingly ([b37101486b](https://github.com/facebook/react-native/commit/b37101486bd4dc26f6ec4e646e12d1484ec9479f) by [@vzaidman](https://github.com/vzaidman))
- Add C++ Turbo Module enum Event Emitter example ([6340662d4f](https://github.com/facebook/react-native/commit/6340662d4f0d44d1f34ad407faa550f7f35e216c) by [@christophpurrer](https://github.com/christophpurrer))
- : support for rendering Error object previews in Chrome DevTools console ([cae9ae5b48](https://github.com/facebook/react-native/commit/cae9ae5b486d04b889af9d1685bcbbb33557c791) by [@EdmondChuiHW](https://github.com/EdmondChuiHW))
- : support for rendering Error objects in Chrome DevTools console ([1740a56a46](https://github.com/facebook/react-native/commit/1740a56a46ef4a364c88cebe373b4b3a5679248a) by [@EdmondChuiHW](https://github.com/EdmondChuiHW))
- Use PackagerAsset resolver instead of Platform.OS when its provided. ([baa366654e](https://github.com/facebook/react-native/commit/baa366654e9ee98e0400b493e7fc9578851d60d1) by [@andrewdacenko](https://github.com/andrewdacenko))
- Add optional `PackagerAsset.resolver` prop so AssetSourceResolver can use it instead of `Platform.OS` to identify where asset is stored on device. ([3f3a85b3c5](https://github.com/facebook/react-native/commit/3f3a85b3c5be3f9fdbd63a3acfe8456b6adeb100) by [@andrewdacenko](https://github.com/andrewdacenko))
- Add upper case keys to the debug key handler ([6390cf67d0](https://github.com/facebook/react-native/commit/6390cf67d065727c810fcf4ef32b0cac7efac8e2) by [@wh201906](https://github.com/wh201906))
- Debugger: Support text responses to CDP `IO.read` requests ([c085180264](https://github.com/facebook/react-native/commit/c085180264ea68f71b050cbb6b9a8274e36c3fbf) by [@robhogan](https://github.com/robhogan))
- Add example in RNTester to show that pressability works properly with NativeDrivers ([050006a7a7](https://github.com/facebook/react-native/commit/050006a7a78fee0d54950e7ef672c73f8d680053) by [@cipolleschi](https://github.com/cipolleschi))
- Trigger template publish ([4e14c5eeab](https://github.com/facebook/react-native/commit/4e14c5eeab86a188663c2eddf301f753c317235b) by [@blakef](https://github.com/blakef))
- Debugging: implement common C++ layer of CDP `Network.loadNetworkResource` ([193cdc36f7](https://github.com/facebook/react-native/commit/193cdc36f7de5524b509e38da8feb209d214634c) by [@robhogan](https://github.com/robhogan))
- Add experimental api to JSRuntimeFactory to initialize runtime on js thread ([c9fbc05bbc](https://github.com/facebook/react-native/commit/c9fbc05bbca803032914be4b38ac4c9608852963) by Benoit Girard)
- Added support for importing `react-native` in a `react-server` environment for React Server Components support. ([8989c9b71d](https://github.com/facebook/react-native/commit/8989c9b71dcca3f39b37a32945364025732eb2c3) by [@EvanBacon](https://github.com/EvanBacon))
- Add changelog lines for RC2 ([e6dd44d6e5](https://github.com/facebook/react-native/commit/e6dd44d6e5dca07d2fcd37eba7625fec75de7fd6) by [@cipolleschi](https://github.com/cipolleschi))
- : Inspector: Support `/open-debugger` specifying `target` param ([88ba9a6042](https://github.com/facebook/react-native/commit/88ba9a60428697f5957f269e85fbef3d0afc5046) by [@robhogan](https://github.com/robhogan))
- Add support for `texAlignment: 'start'` ([a2cb34371e](https://github.com/facebook/react-native/commit/a2cb34371e6e52305ee58f23d3b2fefc1e8c7157) by [@javache](https://github.com/javache))
#### Android specific
- Enable React Native DevTools in OSS debug builds ([143f1ad298](https://github.com/facebook/react-native/commit/143f1ad29874c1e8e9561abae263cb08f4859407) by [@robhogan](https://github.com/robhogan))
- Support simple opacity in nested text ([a2d53d5ea0](https://github.com/facebook/react-native/commit/a2d53d5ea08959da0bbce3c494e06634e3d52d2a) by [@NickGerleman](https://github.com/NickGerleman))
- Update compileSdk to 35 ([1333e0ee6a](https://github.com/facebook/react-native/commit/1333e0ee6ac78ad856b7f86234ec2606fcc48a7e) by [@alanleedev](https://github.com/alanleedev))
- Added a conditional check in the `resolveThemeAttribute` function to reattempt resource resolution with the "android" package name if the resource ID is 0. ([6365df54db](https://github.com/facebook/react-native/commit/6365df54dbd0a7e185cfe113a9cf0026b2bb12ef) by [@shubhamguptadream11](https://github.com/shubhamguptadream11))
- Add support for handling `com.facebook.react.bridge.Dynamic` as parameter type in TurboModules ([d01f1b3214](https://github.com/facebook/react-native/commit/d01f1b3214b435d436fd6cf145d8e450a188301c) by [@cortinico](https://github.com/cortinico))
- Linear gradient ([bd0aedc8c3](https://github.com/facebook/react-native/commit/bd0aedc8c3dbebf96e123fd1bd33f515d09e2579) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway))
- Provide default implementation for ReactHostDelegate.handleInstanceException() ([34e3a6cc88](https://github.com/facebook/react-native/commit/34e3a6cc885a68148b1d2209adc70c8109a56a66) by [@alanleedev](https://github.com/alanleedev))
- Add BackgroundStyleApplicator for managing view backgrounds ([1a78477ce5](https://github.com/facebook/react-native/commit/1a78477ce528b36a97602d0210bd4ea8446804dc) by [@NickGerleman](https://github.com/NickGerleman))
- Added support for rendering XML assets provided to `Image` ([aad9240fd4](https://github.com/facebook/react-native/commit/aad9240fd435d549812b5075767c5ea39a8fbb4f) by Peter Abbondanzo)
- Introduce Systrace.beginSection with arguments ([384983025a](https://github.com/facebook/react-native/commit/384983025a5afcc1e470817a1ccfa3bb8df6a936) by [@mdvacca](https://github.com/mdvacca))
- Added `onUserLeaveHint` support into `ReactActivityDelegate` ([27ba369f23](https://github.com/facebook/react-native/commit/27ba369f2325db5678aaf6a18927c127921840e0) by [@behenate](https://github.com/behenate))
- Add Java Turbo Module Event Emitter example ([84a9f5e6c8](https://github.com/facebook/react-native/commit/84a9f5e6c8e3af97e7d084ccb8ffdef44dcc87fb) by [@christophpurrer](https://github.com/christophpurrer))
- Allow js bundle file urls ([7522336412](https://github.com/facebook/react-native/commit/752233641210a0b2e6bc1438f82d0aa193c2ef0d) by [@RSNara](https://github.com/RSNara))
- Make ReactInstanceEventListener available on ReactHost ([80e1dd70b0](https://github.com/facebook/react-native/commit/80e1dd70b0b27195b9b71ea531728eef9799caa9) by [@RSNara](https://github.com/RSNara))
- Add `invalidate()` method to ReactHost and ReactInstanceManager ([a3db352e25](https://github.com/facebook/react-native/commit/a3db352e25c01614ade3e42637e3d5726e582308) by [@motiz88](https://github.com/motiz88))
#### iOS specific
- Line break mode for TextInput components. **This includes iOS updates to consume new cpp functions.** ([fe941a8f4c](https://github.com/facebook/react-native/commit/fe941a8f4c92fa9b1f07d2dd94050c81d63c77e8) by [@shubhamguptadream11](https://github.com/shubhamguptadream11))
- Line break mode for TextInput components. **This includes cpp changes and new functions.** ([6cab6c2a13](https://github.com/facebook/react-native/commit/6cab6c2a13b89cbee1a2c1957ea561f82cb6700a) by [@shubhamguptadream11](https://github.com/shubhamguptadream11))
- Add support for missing text content types ([d7a3e48032](https://github.com/facebook/react-native/commit/d7a3e48032fe76d118c2b5c14032d7a73319adf8) by [@krozniata](https://github.com/krozniata))
- Support LargeContentViewer on iOS for better accessibility ([6cc44d765a](https://github.com/facebook/react-native/commit/6cc44d765a1127aa4998a490e3ff90b741ef9441) by [@bacarybruno](https://github.com/bacarybruno))
- Enable third-party podspec sources to be fetched from mirrored git repositories ([53969cb8d0](https://github.com/facebook/react-native/commit/53969cb8d0460ccb2e899ec290135f447ed5dc65) by [@RailByteOEBB](https://github.com/RailByteOEBB))
- Declare the `onUserDrivenAnimationEnded` in the old Architecture ([4faafb0aa4](https://github.com/facebook/react-native/commit/4faafb0aa42dbe51a84b5c59e82d753bef0d5fc2) by [@cipolleschi](https://github.com/cipolleschi))
- Debugger: Implement CDP methods for loading network resources through the debug target. ([c720583f6c](https://github.com/facebook/react-native/commit/c720583f6c071959e7898befb62cd36f84c581dc) by [@robhogan](https://github.com/robhogan))
- Linear gradient ([b99675d78a](https://github.com/facebook/react-native/commit/b99675d78a8269403b68d7eae8dc67ec85aea3e6) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway))
- Declare the `onUserDrivenAnimationEnded` in the old Architecture ([f8c13f601d](https://github.com/facebook/react-native/commit/f8c13f601d5f7f159dd7a0e42b9fcc877d48d69b) by [@cipolleschi](https://github.com/cipolleschi))
- Retrieve the tags of the nodes connected by the animation and send them to JS ([fd748ae84c](https://github.com/facebook/react-native/commit/fd748ae84cf18c1c204a936af45bb4883d476cd7) by [@cipolleschi](https://github.com/cipolleschi))
- Send onScrollEnded event to NativeTurboAnimatedModule ([7af743236f](https://github.com/facebook/react-native/commit/7af743236f25ee03b674baf46f6506dbbc2e4fc0) by [@cipolleschi](https://github.com/cipolleschi))
- Added handling of `showSoftInputOnFocus` props for new arch. ([ead50d6b11](https://github.com/facebook/react-native/commit/ead50d6b1180dbe9f8b49d646cc34f83aae41c74) by [@shubhamguptadream11](https://github.com/shubhamguptadream11))
- Add EventEmitter Code-gen support for Java and ObjC Turbo Modules ([ad3df84668](https://github.com/facebook/react-native/commit/ad3df84668f1624e830396364c331783c6f99948) by [@christophpurrer](https://github.com/christophpurrer))
- Add ObjC Turbo Module Event Emitter example ([f473a2f8f4](https://github.com/facebook/react-native/commit/f473a2f8f48ed8ce94a1f8a3181a5dabb4c6ad8d) by [@christophpurrer](https://github.com/christophpurrer))
- Code-generate an optional base class to use for every NativeModule ([ed5f558a6c](https://github.com/facebook/react-native/commit/ed5f558a6cb5ff597870e7013150113b9460c0dc) by [@christophpurrer](https://github.com/christophpurrer))
- Added RCTUIInterfaceOrientation helper method ([cf015f93ef](https://github.com/facebook/react-native/commit/cf015f93efa888be61150915b18ae8cd12d11232) by [@Biki-das](https://github.com/Biki-das))
### Changed
- Bump cli dependencies to 15.0.0-alpha.2 ([148066e8f9](https://github.com/facebook/react-native/commit/148066e8f9e74fb0b5423fd31c02e1ad02c74d6d) by [@cipolleschi](https://github.com/cipolleschi))
- Bring back CxxTurboModule autolinking function, but remove `RCT_EXPORT_CXX_MODULE_EXPERIMENTAL` macro ([e629a8552d](https://github.com/facebook/react-native/commit/e629a8552d5562115cd0d1eea7ab45e6fc4a5b07) by [@mrousavy](https://github.com/mrousavy))
- Improved runtime performance of `Animated` ([d1ebe02c19](https://github.com/facebook/react-native/commit/d1ebe02c19a4ae78f54e2647d5b18e6bf93079c1) by [@yungsters](https://github.com/yungsters))
- Changed Metro default config to use Hermes parser, enabling the use of advanced Flow syntax in React Native. ([320963c7cb](https://github.com/facebook/react-native/commit/320963c7cb394ccd8768003ad40c9767fdb7f4e3) by [@yungsters](https://github.com/yungsters))
- Changed `Animated` props validation to soft errors instead of thrown errors ([0a1ba02273](https://github.com/facebook/react-native/commit/0a1ba02273693ffd605ca2aebce90746c1745a9c) by [@yungsters](https://github.com/yungsters))
- Improved error message for invalid filter values ([4094ce0718](https://github.com/facebook/react-native/commit/4094ce0718c54a2c9a326cc2962ea00e30b7bdf6) by [@yungsters](https://github.com/yungsters))
- Add official `boxShadow` and `filter` CSS properties ([6fa54f9b5d](https://github.com/facebook/react-native/commit/6fa54f9b5d73f0f347754921898e75b56ae12cb6) by [@jorge-cab](https://github.com/jorge-cab))
- Upgrade pretty-format to 29.7.0 ([7bc9244d0c](https://github.com/facebook/react-native/commit/7bc9244d0cbebc310116b6b2a2baf0781073d0f5) by [@dprevost-LMI](https://github.com/dprevost-LMI))
- Remove `--experimental-debugger` option from start command ([94e7a87f23](https://github.com/facebook/react-native/commit/94e7a87f2344c2024817ea7e928ab81e7f57aa76) by [@huntie](https://github.com/huntie))
- Improve `Appearance` performance overhead by lazily initializing the NativeModule ([b86e8ef95f](https://github.com/facebook/react-native/commit/b86e8ef95fc6d7e35b2e20529a52bb74780dcf1a) by [@yungsters](https://github.com/yungsters))
- Improved `Appearance.getColorScheme` performance ([8f0f50f7a1](https://github.com/facebook/react-native/commit/8f0f50f7a1729019b1b0957076edfee58a146c56) by [@yungsters](https://github.com/yungsters))
- Move init deprecation notice 30 Sept → 31 Dec ([014370d825](https://github.com/facebook/react-native/commit/014370d825b273bc96464e84ba2d57ae5cf37eda) by [@blakef](https://github.com/blakef))
- Upgrade `react-native-community/cli` to `13.6.9` ([353d88d54e](https://github.com/facebook/react-native/commit/353d88d54ef2f78f9112c4e56e4d00405cc501b9) by [@szymonrybczak](https://github.com/szymonrybczak))
- TurboModules will be looked up as TurboModules first, and fallback to legacy modules after. ([5a62606ab3](https://github.com/facebook/react-native/commit/5a62606ab36edaffb0a5c760d2b0ed0c8e3808a8) by [@javache](https://github.com/javache))
- Drop `node-fetch` in favor of Node's built-in fetch from `undici` in `react-native/dev-middleware` ([30a3e6e8df](https://github.com/facebook/react-native/commit/30a3e6e8dfcfc9597873578b8332ec027ccf1b84) by [@byCedric](https://github.com/byCedric))
- Fixed native component mocking in Jest unit tests to support functional components ([fb58494283](https://github.com/facebook/react-native/commit/fb58494283102a67bcecda3265f70f010764a126) by [@yungsters](https://github.com/yungsters))
- Bumps the CLI to alpha 11 ([c0b5e2e031](https://github.com/facebook/react-native/commit/c0b5e2e031f0e471b57640be13fe086d36c48a99) by [@cipolleschi](https://github.com/cipolleschi))
- Improve LogBox safe area insets styling ([18302831c4](https://github.com/facebook/react-native/commit/18302831c49299d326935f875655c439cc4fbe0d) by [@yungsters](https://github.com/yungsters))
- : Inspector: Enforce device and appId filters if both are given to /open-debugger ([c7970379a1](https://github.com/facebook/react-native/commit/c7970379a1e9be87be22ddcdec38752257059450) by [@robhogan](https://github.com/robhogan))
- Timer functions `timeout` argument is now coerced to a number ([af04eb773c](https://github.com/facebook/react-native/commit/af04eb773cf7531323c6a34a276098e84c6041a9) by [@robik](https://github.com/robik))
- RN CLI to 14.0.0-alpha.7 ([3dcf86b802](https://github.com/facebook/react-native/commit/3dcf86b8022090e766c93aed062e4d1d849299a1) by [@blakef](https://github.com/blakef))
- Debugger: `j` opens most recent (not first) target. ([2a6a895b17](https://github.com/facebook/react-native/commit/2a6a895b17fdd4112349853e08a50c4c90886cb8) by [@robhogan](https://github.com/robhogan))
- Debugger: Make `/json/list` return connection-addition-ordered targets. ([53951d7fec](https://github.com/facebook/react-native/commit/53951d7fec2997487d1ee948304ab904c21338aa) by [@robhogan](https://github.com/robhogan))
#### Android specific
- Bump AGP to 8.6.0 ([aca31eb610](https://github.com/facebook/react-native/commit/aca31eb610c2c4d433311b1cdaf20af94fd54622) by [@cortinico](https://github.com/cortinico))
- Gradle to 8.10 ([d0a5f8ff51](https://github.com/facebook/react-native/commit/d0a5f8ff5167d1deac85f2b9a0595abc9dd4a554) by [@cortinico](https://github.com/cortinico))
- Modify LogBox to be usable on Android 15 ([5fe7660439](https://github.com/facebook/react-native/commit/5fe76604393a7e931559a3ef82564619885dbe43) by [@alanleedev](https://github.com/alanleedev))
- Adding padding for RNTester on Android 15 forced edge-to-edge ([f7479e6a1c](https://github.com/facebook/react-native/commit/f7479e6a1ca5b6bc07a50a59a7d9fcd43bddcdef) by [@alanleedev](https://github.com/alanleedev))
- Move `experimental_boxShadow` and `experimental_backgroundImage` to BaseViewConfig ([03801f275e](https://github.com/facebook/react-native/commit/03801f275e81c27a09f717bf48322f9ab1a54fc1) by [@NickGerleman](https://github.com/NickGerleman))
- Revamp InsetBoxShadowDrawable ([d9f684b1cf](https://github.com/facebook/react-native/commit/d9f684b1cf7fb6824e25e1e948bfb30dec450464) by [@NickGerleman](https://github.com/NickGerleman))
- Support OutsetBoxShadowDrawable on Android 9+ ([f905f90468](https://github.com/facebook/react-native/commit/f905f904685cc67a948349e0d58dce8b7f524069) by [@NickGerleman](https://github.com/NickGerleman))
- Merge libuimanagerjni.so inside libreactnative.so ([7916f7e120](https://github.com/facebook/react-native/commit/7916f7e12014c42b2bc9bfcfe053e37358fc39a4) by [@cortinico](https://github.com/cortinico))
- Move libyoga.so and libturbomodulejsijni.so inside libreactnative.so ([80c3aea48d](https://github.com/facebook/react-native/commit/80c3aea48d584b49fab8df3a417558cf5c5c3b12) by [@cortinico](https://github.com/cortinico))
- Move more libraries to so-merging: rninstance, react_featureflagsjni, hermesinstancejni, fabricjni ([e864910a4d](https://github.com/facebook/react-native/commit/e864910a4d805a23244365b96e1f5e207a45a4a9) by [@cortinico](https://github.com/cortinico))
- Move libmapbufferjni.so inside libreactnative.so ([5b761ff15c](https://github.com/facebook/react-native/commit/5b761ff15cdb2501862f07650912cbd26eaafdef) by [@cortinico](https://github.com/cortinico))
- Move libreact_newarchdefaults.so inside libreactnative.so ([0caf3e824d](https://github.com/facebook/react-native/commit/0caf3e824d81689034ddf96d86d2362c9911d389) by [@cortinico](https://github.com/cortinico))
- Make `setPointerEvents` public ([010e0010a3](https://github.com/facebook/react-native/commit/010e0010a38e111df110584ebacaabe210c3f137) by [@jakex7](https://github.com/jakex7))
- Avoid image ofscreen render ([620b1221fa](https://github.com/facebook/react-native/commit/620b1221fa7d4e0e8e070031f65fdf786e3342d0) by [@NickGerleman](https://github.com/NickGerleman))
- Migrated ReactSwitch to Kotlin ([03c0e5e2af](https://github.com/facebook/react-native/commit/03c0e5e2af288e96f39fa044cbbe8ebef91bdb1e) by [@blakef](https://github.com/blakef))
- Summary: Changelog: [Android][Changed] AdditionalAnimatedNode.java → Kotlin ([8689aa48bb](https://github.com/facebook/react-native/commit/8689aa48bb5fac6b96144c08d49b15359ef141a1) by [@blakef](https://github.com/blakef))
- Migrated `packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareJSCTaskTest.kt` to assertj. ([2b39e6307e](https://github.com/facebook/react-native/commit/2b39e6307ea8abafe0c84a4a2e838b40e82e32e0) by [@BogiKay](https://github.com/BogiKay))
- #### [Android] [Changed] - Migrated ```ReactActivityDelegateTest``` ([3b76c8441d](https://github.com/facebook/react-native/commit/3b76c8441d2161ce13d411dd0b3cac068396054b) by [@gustavoabel](https://github.com/gustavoabel))
- Migrated `ShareModuleTest` from junit.Assert to assertj.core.api.Assertions. ([e2d9ff8538](https://github.com/facebook/react-native/commit/e2d9ff8538c2bb39db498a6f39bcedeb3f983ea9) by [@migueldaipre](https://github.com/migueldaipre))
- #### [Android] [Changed] - Migrated ```HeaderUtilTest``` ([d32444600c](https://github.com/facebook/react-native/commit/d32444600cac983551af78fc4770c270c794aaa6) by [@gustavoabel](https://github.com/gustavoabel))
- Migrated `BuildCodegenCLITaskTest`, `PrepareGlogTaskTest` from junit.Assert to assertj.core.api.Assertions. ([053865bd80](https://github.com/facebook/react-native/commit/053865bd80d1a3433f3fe9f2a9795b55096a0339) by [@migueldaipre](https://github.com/migueldaipre))
- Migrated `DefaultNewArchitectureEntryPointTest`, `InteropEventEmitterTest`, `InteropModuleRegistryTest` from junit.Assert to assertj.core.api.Assertions. ([7aff1b9bd8](https://github.com/facebook/react-native/commit/7aff1b9bd8bcdad942f107eb9a1af5baa4222be6) by [@migueldaipre](https://github.com/migueldaipre))
- Deprecate DeveloperSettings.isStartSamplingProfilerOnInit ([52237838dc](https://github.com/facebook/react-native/commit/52237838dc65fd97ec5498e2eac268808bd7fa9a) by [@cortinico](https://github.com/cortinico))
- Gradle to 8.9 ([b82d7e100c](https://github.com/facebook/react-native/commit/b82d7e100c7a6b03295ed87915f54c477b00c983) by [@cortinico](https://github.com/cortinico))
- Modules marked with needsEagerInit = true will now be created on the mqt_native thread. ([c4a6bbc8fd](https://github.com/facebook/react-native/commit/c4a6bbc8fd8992059abdcfae2bc483bd29f31e79) by [@javache](https://github.com/javache))
- Log a SoftException on SurfaceMountingManager.addRootView ([3429dc1ccf](https://github.com/facebook/react-native/commit/3429dc1ccf32b6b23f4f0ad3cfdf0d5697af665f) by [@psionic12](https://github.com/psionic12))
- Extracted common parts related to calculating text layout to a helper ([2eaf0b0848](https://github.com/facebook/react-native/commit/2eaf0b0848d660eb19fde2921570f9e8bd2bd1de) by [@j-piasecki](https://github.com/j-piasecki))
#### iOS specific
- Changed border display ([94407f56d1](https://github.com/facebook/react-native/commit/94407f56d133b2ba46dc5b31679e9500470e1770) by [@coado](https://github.com/coado))
- Don't include C++ bridging header in RCTTurboModule.h ([3fc7ebb311](https://github.com/facebook/react-native/commit/3fc7ebb311e86cf2e3e78efacb1860deadd54216) by [@christophpurrer](https://github.com/christophpurrer))
- Refactor supportedInterfaceOrientations method to use RCTKeyWindow() ([815c415fb9](https://github.com/facebook/react-native/commit/815c415fb90944db89552a503eb53059e9f0d20b) by [@okwasniewski](https://github.com/okwasniewski))
### Deprecated
#### Android specific
- Deprecate ReactFeatureFlags.enableBridgelessArchitecture ([10c91e9a38](https://github.com/facebook/react-native/commit/10c91e9a3862510a24a51bcb951b2230edd3529a) by [@mdvacca](https://github.com/mdvacca))
- Deprecate ReactFeatureFlags.useTurboModules ([0e91400857](https://github.com/facebook/react-native/commit/0e914008575bad2f8021cda2da6feb2d187e4224) by [@mdvacca](https://github.com/mdvacca))
- Deprecate ReactFeatureFlags.enableFabricRenderer ([3f35217856](https://github.com/facebook/react-native/commit/3f35217856002d25c415b69b672ff71dc29c157b) by [@mdvacca](https://github.com/mdvacca))
- Deprecate MapBuilder ([a696d2ed6b](https://github.com/facebook/react-native/commit/a696d2ed6b95c07229bc0fd00aca344951689bbd) by Thomas Nardone)
#### iOS specific
- Add newArchEnabled method to RCTAppDelegate ([3621606c44](https://github.com/facebook/react-native/commit/3621606c4486051de8b443c443cd87f6b822d1a0) by [@okwasniewski](https://github.com/okwasniewski))
- Deprecated StatusBar.setNetworkActivityIndicatorVisible ([8a390ba9b8](https://github.com/facebook/react-native/commit/8a390ba9b8c1b8889dd0933fe1477083a24ff71d) by Ingrid Wang)
### Removed
- Remove sampling profiler from dev menu ([f57740c0fb](https://github.com/facebook/react-native/commit/f57740c0fbd431991bf90f83dac5770fa74d13cf) by [@blakef](https://github.com/blakef))
- Removed enableArchitectureIndicator API which is only used internally. ([9b67547bec](https://github.com/facebook/react-native/commit/9b67547bec36cae2b4d9f99f66938fbe6b1466bf) by [@javache](https://github.com/javache))
#### Android specific
- Removed HasJavascriptExceptionMetadata as a marker interface. Use JavascriptExecption directly ([cb00ca954d](https://github.com/facebook/react-native/commit/cb00ca954d1a7647900c8ff6b5792eb342735140) by [@javache](https://github.com/javache))
- Unused jsEngineResolutionAlgorithm from ReactHost ([f1b6218608](https://github.com/facebook/react-native/commit/f1b6218608ea968f032f8344d4648651617482cf) by [@javache](https://github.com/javache))
- React_newarchdefaults is no longer a prefab, instead use fabricjni ([c68f35d444](https://github.com/facebook/react-native/commit/c68f35d4441c8a03541da17e3adc03f355e8c45e) by [@javache](https://github.com/javache))
- CoreComponentsRegistry is now fully replaced by DefaultComponentRegistry. ([de7976c69d](https://github.com/facebook/react-native/commit/de7976c69d9f837729e8822f2b89e6d08ea6883a) by [@javache](https://github.com/javache))
#### iOS specific
- Fix position of RCTPerfMonitor in landscape mode & expanded mode ([258f41a30f](https://github.com/facebook/react-native/commit/258f41a30f5a797c0cfdb256a6824b7284dcc8e2) by [@krozniata](https://github.com/krozniata))
- Remove `[RCTConvert UIBarStyle:]` ([a557a81f96](https://github.com/facebook/react-native/commit/a557a81f963041351e02f3b79489c6ee394ebe48) by [@Saadnajmi](https://github.com/Saadnajmi))
### Fixed
- Upstream fixes for build errors in React Native Windows ([c722ec7c37](https://github.com/facebook/react-native/commit/c722ec7c372c44ade8439f4765b1b6470c27f470) by [@chiaramooney](https://github.com/chiaramooney))
- Allow readonly array type for transform property ([c16defaff2](https://github.com/facebook/react-native/commit/c16defaff2964a2b30656def35eb3450cff9cd71) by [@tjzel](https://github.com/tjzel))
- Removed noisy ENOENT error message upon launching the debugger ([5bbf5a4878](https://github.com/facebook/react-native/commit/5bbf5a4878fd3bab7b70f91e049bb6b986fd183b) by [@EdmondChuiHW](https://github.com/EdmondChuiHW))
- Fixed undefined behavior in certain scenarios when `ReactElement` objects are supplied to Animated components ([56937d646c](https://github.com/facebook/react-native/commit/56937d646c741b32826a92a76193eadc8dc59031) by [@yungsters](https://github.com/yungsters))
- Ensure `--build-output` destination exists ([396bdd87d8](https://github.com/facebook/react-native/commit/396bdd87d8021902ad78b817314fdc5b6207c2ea) by [@szymonrybczak](https://github.com/szymonrybczak))
- Fix handling 'auto' checks in absolute layout ([3596019489](https://github.com/facebook/react-native/commit/359601948923baf7304d223260be3926c5b81db0) by [@coado](https://github.com/coado))
- Fixed fontWeight number value error for text optimized ([2a230694c4](https://github.com/facebook/react-native/commit/2a230694c421bf338699506a0044c26fd4c1eb55) by [@meetdhanani17](https://github.com/meetdhanani17))
- : [General] [Fixed] - Undefined behavior fix in MethodInvoker ([09e88448ce](https://github.com/facebook/react-native/commit/09e88448ce3a3047112b6f71218305d5bfe2e8bc) by Riley Berton)
- Limit HermesPerfetto tracing to the top 25 and bottom 25 frames, allowing you to see both sides ([5561457c98](https://github.com/facebook/react-native/commit/5561457c98df9c2d6adcc4c3d7836323304e4aba) by Benoit Girard)
- Linear gradient color stop spec. ([1a49892d57](https://github.com/facebook/react-native/commit/1a49892d574e3b77a75df8cfc77307a7d5daab35) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway))
- Fixes findNodeAtPoint when views were inverted ([1d1646afd1](https://github.com/facebook/react-native/commit/1d1646afd1ff4f068fc41d8b142b08d53e6cd91a) by [@zhongwuzw](https://github.com/zhongwuzw))
- Change RawPropsParser logs from ERROR level to WARNING ([68c0720e34](https://github.com/facebook/react-native/commit/68c0720e3438f9230f6dc28956c93b58ce1f2482) by Bowen Xie)
- Fix codegen failing in a pnpm monorepo because of missing `yargs` ([3e084bc159](https://github.com/facebook/react-native/commit/3e084bc15994cf5b549d1104e906e5dbb2df4417) by [@tido64](https://github.com/tido64))
- Fix "C4715 not all control paths return a value" warning in MSVC when building ReactCommon ([c30e35fb44](https://github.com/facebook/react-native/commit/c30e35fb44affb179c9a208cf0a3e4575347e76f) by [@jonthysell](https://github.com/jonthysell))
- Reallign the shadow tree and the native tree when the user finishes interacting with the app. ([a8786fc1df](https://github.com/facebook/react-native/commit/a8786fc1df60426000013bdcfb3a61bd201b6dac) by [@cipolleschi](https://github.com/cipolleschi))
- Update the react-native/jest-preset mock of AccessibilityInfo to better match its API ([8d6ec66b48](https://github.com/facebook/react-native/commit/8d6ec66b480ef57f324cd1e68e05f976ea163ed5) by [@krosenberg](https://github.com/krosenberg))
- Reallign the shadow tree and the native tree when the user finishes interacting with the app. ([afa887b622](https://github.com/facebook/react-native/commit/afa887b6225352d35ed99eb5271bef8a3fe1c7d6) by [@cipolleschi](https://github.com/cipolleschi))
- Add missing `submitBehavior` prop and mark `blurOnSubmit` prop as deprecated in Typescript declaration file of `TextInput` ([1dcbf41725](https://github.com/facebook/react-native/commit/1dcbf41725a7296c0a0f33c4e0cc3a11e8780889) by [@thisisgit](https://github.com/thisisgit))
- Fixed `alignItems: 'baseline'` not working correctly on the new architecture ([2932c0f71f](https://github.com/facebook/react-native/commit/2932c0f71f1882607d9e579e5c09db28e131a4c9) by [@j-piasecki](https://github.com/j-piasecki))
- Updated comments for `~ShadowNodeWrapper()` and `~ShadowNodeListWrapper()` ([778fcecf35](https://github.com/facebook/react-native/commit/778fcecf357b92f8dd5bab07914aa8563796d0f7) by [@tomekzaw](https://github.com/tomekzaw))
- Loosen SectionList `renderItem` required return type ([12b64b7824](https://github.com/facebook/react-native/commit/12b64b78247f2db929c6d421262bdec1f6402e0b) by [@NickGerleman](https://github.com/NickGerleman))
- Fix Platform.constants.reactNativeVersion type ([95d9cdf228](https://github.com/facebook/react-native/commit/95d9cdf228e33d5651f41ebf5e14e80962fae118) by [@NickGerleman](https://github.com/NickGerleman))
- Add missing methods to the WithRuntimeDecorator class. ([993f9fd8db](https://github.com/facebook/react-native/commit/993f9fd8db5fe4df495b3a3454273b0e11fef489) by [@neildhar](https://github.com/neildhar))
- Reconnecting to an unknown inspector page no longer results in a zombie connection ([a7adfef0bb](https://github.com/facebook/react-native/commit/a7adfef0bb3df03517935e446ea0c6b506f7ed90) by [@motiz88](https://github.com/motiz88))
- Avoid a zombie state when opening a second debugger frontend concurrently. ([e55ea2daf1](https://github.com/facebook/react-native/commit/e55ea2daf11bb527f500323e3f1bb71f10cbe1c5) by [@motiz88](https://github.com/motiz88))
- Inspector-proxy no longer accidentally detaches connected devices. ([4c6bff01b3](https://github.com/facebook/react-native/commit/4c6bff01b384d7d899dd9d3beef12b878918704e) by [@motiz88](https://github.com/motiz88))
#### Android specific
- Ensure Appearance change listener does not skip events ([7041ed28f0](https://github.com/facebook/react-native/commit/7041ed28f092e7c6c1dac35f0ce6af095cd9a072) by [@vonovak](https://github.com/vonovak))
- RedBox content overlapping with system bars on Android 15 forced edge-to-edge ([97b661c3f0](https://github.com/facebook/react-native/commit/97b661c3f07ab0269b707b209139d5c1648d1e03) by [@alanleedev](https://github.com/alanleedev))
- Deprecating ModalHostShadowNode and ModalHostHelper classes ([77b3a8bdd6](https://github.com/facebook/react-native/commit/77b3a8bdd6164b4c2407e53cb0e27075c3ea7213) by [@alanleedev](https://github.com/alanleedev))
- Optimize BaseViewManager#setTransform to ignore duplicate values ([3df0f3b9ff](https://github.com/facebook/react-native/commit/3df0f3b9ff4cc9cd6846ef02101baf8e9605d6a0) by [@javache](https://github.com/javache))
- Don't use mGapBetweenPaths if not drawing a border ([8501b6396b](https://github.com/facebook/react-native/commit/8501b6396b0a4fd7a9bd2add2b3c8b9c755c27ae) by [@knappam](https://github.com/knappam))
- Linear gradient border styles ([20e3f4518f](https://github.com/facebook/react-native/commit/20e3f4518feac70e8ac9b1cc4fc1cbb029df96e4) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway))
- Make getUri and isResource open ([8c81ffa60a](https://github.com/facebook/react-native/commit/8c81ffa60a211e4ae7db50cd04de0e4a4c29df04) by [@shubhamguptadream11](https://github.com/shubhamguptadream11))
- PointerEvents from Modal would not be dispatched correctly in new architecture. ([75114e3672](https://github.com/facebook/react-native/commit/75114e36726979625674b2c75a77ac330fccc4d6) by [@javache](https://github.com/javache))
- Fixed black strip coming when hiding status bar ([f6b6d001a0](https://github.com/facebook/react-native/commit/f6b6d001a0e0241a9d637cd5e532f0d8610d9ee1) by [@shubhamguptadream11](https://github.com/shubhamguptadream11))
- Make Imagesource `open` for inheritance ([0e805a953d](https://github.com/facebook/react-native/commit/0e805a953d8c2e91790a2f9fa2da7850478231b7) by [@cortinico](https://github.com/cortinico))
- Fix issue with `NativeDevSettings.setIsDebuggingRemotely` where the app would keep on restarting if remote debugging was invoked from an action / component that was called on app start. ([beebf4a0a3](https://github.com/facebook/react-native/commit/beebf4a0a36c4ee9dc52631afdf2b25745a1b0f2) by [@Sushant-Sardeshpande](https://github.com/Sushant-Sardeshpande))
- Do not destroy views when there is a touch going on for New Architecture ([6b7f68240e](https://github.com/facebook/react-native/commit/6b7f68240e08c64ced29ed3d7a1f95db96a6eef4) by [@cortinico](https://github.com/cortinico))
- Anntate ReactRootView.createRootView with nullable ([6a1ecbb2bb](https://github.com/facebook/react-native/commit/6a1ecbb2bb3942e7487532262f2a4fc55f94fcad) by [@shwanton](https://github.com/shwanton))
- Gracefully handle unexpected overlow values ([82094dd9e3](https://github.com/facebook/react-native/commit/82094dd9e33d94f65fd2548f5b04a19fb89bad0f) by [@NickGerleman](https://github.com/NickGerleman))
- Fix "setTranslucentBackgroundDrawable()" deprecation version ([35d9a18b81](https://github.com/facebook/react-native/commit/35d9a18b81ff9448459c9fb033f4fea1fa17dab3) by [@NickGerleman](https://github.com/NickGerleman))
- Fix uploading GIF URI ([48669af562](https://github.com/facebook/react-native/commit/48669af562d6d3ed7835816d60a2fb400a22a19b) by [@s77rt](https://github.com/s77rt))
- ([087193c98e](https://github.com/facebook/react-native/commit/087193c98ead8f12ec4f839dd077d5bd63075d6f) by [@NickGerleman](https://github.com/NickGerleman))
- Add borderStartWidth and borderEndWidth support ([92dca53702](https://github.com/facebook/react-native/commit/92dca5370239f2c9881455b683ff384e2187430f) by [@NickGerleman](https://github.com/NickGerleman))
- Made several methods in ReactNativeHost.java thread-safe to avoid race conditions ([f9ac5b737a](https://github.com/facebook/react-native/commit/f9ac5b737a0e14c76f35840efcf348f1c7704363) by Jack Su)
- Fix scheduled animated operations not being executed in some cases ([dc8c8ebc5b](https://github.com/facebook/react-native/commit/dc8c8ebc5b7b6315b3c8e79028a80611a796ea7e) by [@j-piasecki](https://github.com/j-piasecki))
- Adds a null check in react context getter ([aeb020dfa3](https://github.com/facebook/react-native/commit/aeb020dfa34d06b63fa0151be302287d0a3fb84f) by Peter Abbondanzo)
- Sync the Shadow Tree and the Native Tree with Native animation when scroll is driving the animation ([394aae1c1c](https://github.com/facebook/react-native/commit/394aae1c1cc354eaefb762455e2bbeeec0503038) by [@cipolleschi](https://github.com/cipolleschi))
- : fixed select text on auto focus for TextInput ([18d6028ff9](https://github.com/facebook/react-native/commit/18d6028ff908eef99aae363d8ee9a6789d264284) by [@kunalchavhan](https://github.com/kunalchavhan))
- Fix AlertDialog title accessibility ([80a3ed7d0c](https://github.com/facebook/react-native/commit/80a3ed7d0c9b0ecd0cce6045672453887b5efbaf) by Peter Abbondanzo)
- Fix Android removeClippedSubviews in RTL ([ea6928fcb9](https://github.com/facebook/react-native/commit/ea6928fcb95c19e84f8f2851f28d0cd4343c6a26) by [@NickGerleman](https://github.com/NickGerleman))
- Fixed text shadow rendering with artifacts when `backgroundColor` was set on the `TextInput` ([83716298f8](https://github.com/facebook/react-native/commit/83716298f8dd6a1f3128965225858b4c6d3b2477) by [@j-piasecki](https://github.com/j-piasecki))
- Fixed Headless JS tasks in New Architecture ([9a1ae97c22](https://github.com/facebook/react-native/commit/9a1ae97c22868a312000f3ac50dacf9a8125d273) by [@robik](https://github.com/robik))
- Fix ReactImageView.hasOverlappingRendering() ([2bed2ab1a6](https://github.com/facebook/react-native/commit/2bed2ab1a658230cb6fa23fdcb4e5a962f496e18) by [@NickGerleman](https://github.com/NickGerleman))
- Fix LogModule to create view when show is called ([0847384a45](https://github.com/facebook/react-native/commit/0847384a4598d9bbc8987788047bc58d7596881d) by [@fannnzhang](https://github.com/fannnzhang))
- Fix NPE in FileReaderModule ([fd4531fe23](https://github.com/facebook/react-native/commit/fd4531fe234149f4f078a1e73ec68145f9da20b3) by [@cortinico](https://github.com/cortinico))
- Fix default for `showsHorizontalScrollIndicator` and `showsVerticalScrollIndicator` ([3af01a8a44](https://github.com/facebook/react-native/commit/3af01a8a44853246d3deb957c4a1c65e43848bb5) by [@NickGerleman](https://github.com/NickGerleman))
- **Changelog:** [Android][Fixed] - TextInput's `contextMenuHidden` prop bug fix ([8a3ffb6d23](https://github.com/facebook/react-native/commit/8a3ffb6d23f169752891eddc7dad9e34cb2d861c) by [@alanleedev](https://github.com/alanleedev))
#### iOS specific
- React_native_post_install script no longer adds duplicate entries to HEADER_SEARCH_PATHS ([d687d38987](https://github.com/facebook/react-native/commit/d687d389872f50fa11cbdd44ab3d68bdd392425b) by [@dirkpostma](https://github.com/dirkpostma))
- Codegen will start looking for codegen-enabled dependencies from the project root. ([46d17efa62](https://github.com/facebook/react-native/commit/46d17efa626cd546e839648e1a95f43a3802051c) by [@dmytrorykun](https://github.com/dmytrorykun))
- Resolve Hermes prebuilt version based on react-native packge ([b10ed0e19d](https://github.com/facebook/react-native/commit/b10ed0e19d8eec388305962667561e0cb95a3f25) by [@okwasniewski](https://github.com/okwasniewski))
- Support bundle install from outside the ios folder using --project-directory ([b22970e3cf](https://github.com/facebook/react-native/commit/b22970e3cfbe603bffea5b1c3bbf150887e3d7b8) by [@blakef](https://github.com/blakef))
- Fixes race condition when setup image loader ([6b104bbe01](https://github.com/facebook/react-native/commit/6b104bbe015c93a40a73232fdb92a99e3799b7ac) by [@zhongwuzw](https://github.com/zhongwuzw))
- Fixed an issue where the refresh control would not behave correctly if it was offscreen. ([a8be335a37](https://github.com/facebook/react-native/commit/a8be335a37eb792a7c6ccb7f577459020a2fc43c) by [@deepanshushuklad11](https://github.com/deepanshushuklad11))
- Fixes NSDataBigString length calculation ([bb3c51dc84](https://github.com/facebook/react-native/commit/bb3c51dc84e9514f55ca8a1e3abb1af140563c7b) by Tzvetan Mikov)
- Fixed baseline attachment position in multiline text ([9bfbf948df](https://github.com/facebook/react-native/commit/9bfbf948dfd23c891233e747cbaeeb6480f5fa41) by [@j-piasecki](https://github.com/j-piasecki))
- Clean up RCTParagraphComponentView & RCTParagraphTextView ([9239ad1c6b](https://github.com/facebook/react-native/commit/9239ad1c6bac2c2400f940708d823d7b2c2457c4) by [@zhongwuzw](https://github.com/zhongwuzw))
- Use CONFIG_CMD if set ([774fe0cf6f](https://github.com/facebook/react-native/commit/774fe0cf6f22f832b756c166599973d9db6a93de) by [@krystofwoldrich](https://github.com/krystofwoldrich))
- Fixes Appearance user interface style when app run from background ([efa9711e35](https://github.com/facebook/react-native/commit/efa9711e35f528245cdfb6c7028129c97ae10192) by [@zhongwuzw](https://github.com/zhongwuzw))
- App crash happening when navigate to a new app screen with a displaying modal ([52888c0c1e](https://github.com/facebook/react-native/commit/52888c0c1e722a799f233c2f502e01b9dd4a7174) by Zhi Zhou)
- Fix imports from RCTAppSetupUtils when Hermes is active ([143437a837](https://github.com/facebook/react-native/commit/143437a83732d3d0dcee13a54b8550f55d5daf90) by [@rocketraman](https://github.com/rocketraman))
- Fixes Italic text not work ([9cfd9dd1c7](https://github.com/facebook/react-native/commit/9cfd9dd1c7f8c37c156f1a9ff812183f80d67926) by [@zhongwuzw](https://github.com/zhongwuzw))
- Add missing pod dependency of jserrorhandler ([a77f26827f](https://github.com/facebook/react-native/commit/a77f26827fee0fc18a11faccd0b5e51d1b222735) by [@zhongwuzw](https://github.com/zhongwuzw))
- Mac Catalyst crash in RCTRedBox ([84fe531952](https://github.com/facebook/react-native/commit/84fe531952d4b97c3cb0d84322abdf8953382ad6) by [@sbuggay](https://github.com/sbuggay))
- Data race related to read/write on `ReactMarker::logTaggedMarkerImpl` ([7e41ea4c9d](https://github.com/facebook/react-native/commit/7e41ea4c9de943a5c73ca9821bf552d39aa49dcd) by [@hakonk](https://github.com/hakonk))
- Implement automicallyAdjustsKeyboardInsets for new arch ([e4e461c9cf](https://github.com/facebook/react-native/commit/e4e461c9cf969e1a1dfca6448ca6084b7f45ef7d) by [@okwasniewski](https://github.com/okwasniewski))
- Fixes FORCE_BUNDLING error when bundle js ([089e8289ba](https://github.com/facebook/react-native/commit/089e8289ba6cba0821b76207a2dce316b1621c3d) by [@zhongwuzw](https://github.com/zhongwuzw))
- Include x86_64 slice when building for visionOS simulator ([05dec917f2](https://github.com/facebook/react-native/commit/05dec917f2e5f8288c0d9f31bc50c10bd0c0eab3) by [@okwasniewski](https://github.com/okwasniewski))
- Implement automicallyAdjustsKeyboardInsets for new arch ([21bdce7286](https://github.com/facebook/react-native/commit/21bdce7286fc493b9601add3bf67d549b792d29b) by [@okwasniewski](https://github.com/okwasniewski))
- Fixed crash in RCTImageUtils ([3572ef3f1b](https://github.com/facebook/react-native/commit/3572ef3f1b5b11c1ecfa21f0246cbba5941bbe0f) by [@pavelgurkovskiy](https://github.com/pavelgurkovskiy))
- Fixes typo of function callFunctionOnBufferedRumtimeExecutor ([4e12c2e37c](https://github.com/facebook/react-native/commit/4e12c2e37cb168f09f8768941cb915e4024a1c34) by [@zhongwuzw](https://github.com/zhongwuzw))
- Fixes main thread stuck when reload in bridgeless mode ([a778979ed6](https://github.com/facebook/react-native/commit/a778979ed604d1dc7707faf4a3836e3deba136c6) by [@zhongwuzw](https://github.com/zhongwuzw))
- : Fixing maxLength check which was firing onChange multiple times ([d88dd14507](https://github.com/facebook/react-native/commit/d88dd145074ee84de0cc4207de02a3cd79c9ceff) by [@deepanshushuklad11](https://github.com/deepanshushuklad11))
- Use std::atomic for eliminating races in RCTCxxBridge. ([8204134024](https://github.com/facebook/react-native/commit/8204134024e81947969bd8c2ba337dc931e54bd9) by [@hakonk](https://github.com/hakonk))
- Fix legacy view interop apis not available in view method ([19cffab383](https://github.com/facebook/react-native/commit/19cffab3837c24f2e8470a31bbd8e8338d1c1b6c) by [@janicduplessis](https://github.com/janicduplessis))
- Hermes prepare_command fails with space in path ([fbcb8f6b2b](https://github.com/facebook/react-native/commit/fbcb8f6b2b2d2edeed872de704c6e152064ee319) by [@okwasniewski](https://github.com/okwasniewski))
- Data race in `RCTImageLoader` related to assignment of cancellation block. ([0f051f6034](https://github.com/facebook/react-native/commit/0f051f603492f97a85e051f112d96180352bba77) by [@hakonk](https://github.com/hakonk))
- Message ([b243d343fa](https://github.com/facebook/react-native/commit/b243d343fa741de94537d8535f76714ff2985101) by [@shubhamguptadream11](https://github.com/shubhamguptadream11))
- TestID wasn't propogating to accessibilityIdentifier ([ab485c6a94](https://github.com/facebook/react-native/commit/ab485c6a943a3b096aaa8a22d16abf506fae5b76) by [@blakef](https://github.com/blakef))
- Don't set empty string when remove ccache ([c5b87aba7c](https://github.com/facebook/react-native/commit/c5b87aba7c6fd9f73aa55a7b57ed018967695ffe) by [@zhongwuzw](https://github.com/zhongwuzw))
- Fixes ellipsis carries background from trimmed text ([fcb6cdc710](https://github.com/facebook/react-native/commit/fcb6cdc7108103527268aef42a77e530f9482668) by [@zhongwuzw](https://github.com/zhongwuzw))
- Fix: on iOS not getting 304 from `If-None-Match` request ([b8ab0fe703](https://github.com/facebook/react-native/commit/b8ab0fe703f1a0aca796bc15641d029a2036105f) by [@huzhanbo1996](https://github.com/huzhanbo1996))
- Fix data race related to access on `RCTNetworkTask.status`. ([b1ec698dc4](https://github.com/facebook/react-native/commit/b1ec698dc4baf34ba2e31b7ad43dff97c229bf99) by [@hakonk](https://github.com/hakonk))
- Data race related to access of `AllocationTestModule.valid` ([dba25fa966](https://github.com/facebook/react-native/commit/dba25fa96643bdadc9bad85b20d35e106885f8e7) by [@hakonk](https://github.com/hakonk))
- Fix rendering `RCTRedBoxExtraData` ([c9d589dab5](https://github.com/facebook/react-native/commit/c9d589dab5148cbd192078967f743d38b8048c6e) by [@krozniata](https://github.com/krozniata))
- Fixes Image load event in new arch ([7698cd0953](https://github.com/facebook/react-native/commit/7698cd09536ebf99c3b56696a7bb75d714abfb18) by [@zhongwuzw](https://github.com/zhongwuzw))
- Fixes TextInput crash when undo if text longer than maxLength ([9b9c780cc8](https://github.com/facebook/react-native/commit/9b9c780cc8b54e2c1cd61f9fac0554488f68dea8) by [@zhongwuzw](https://github.com/zhongwuzw))
- Set proper framework dependencies for built-in pods ([6bb75c7b13](https://github.com/facebook/react-native/commit/6bb75c7b133c9be5f613c3310aa918e5a28cec7f) by [@okwasniewski](https://github.com/okwasniewski))
- Retrieve status bar size using RCTUIStatusBarManager ([34cd195d9f](https://github.com/facebook/react-native/commit/34cd195d9fbd075a161afbfac842f896355991e1) by [@okwasniewski](https://github.com/okwasniewski))
- Bump cocoapods version to 1.15.2 excluding 1.15.0, 1.15.1 ([a7b2555644](https://github.com/facebook/react-native/commit/a7b25556449db64d7211c163bdd2e5437c1ad5a6) by [@okwasniewski](https://github.com/okwasniewski))
- Fixed text baseline being moved upwards in certain cases ([01f7ab814f](https://github.com/facebook/react-native/commit/01f7ab814f847eb3038efa7120d81e92e3ff4187) by [@j-piasecki](https://github.com/j-piasecki))
### Security
- Upgrade grpc/grpc-js from 1.7.0 to 1.10.9 (CVE-2024-37168) ([295626bc35](https://github.com/facebook/react-native/commit/295626bc35326cc68c127ff515dcbb8e9d7d44e3) by [@GijsWeterings](https://github.com/GijsWeterings))
- Upgrade braces from 3.0.2 to 3.0.3 (CVE-2024-4068) ([d538879e08](https://github.com/facebook/react-native/commit/d538879e08360b8230410fc893a50489bad5cf60) by [@GijsWeterings](https://github.com/GijsWeterings))
- Update ws from 7.5.1 to 7.5.10 (CVE-2024-37890) ([13f1b9e10f](https://github.com/facebook/react-native/commit/13f1b9e10f6045421808714f7e62aa17bfb3e891) by [@GijsWeterings](https://github.com/GijsWeterings))
- Update ws from 6.2.2 to 6.2.3 (CVE-2024-37890) ([80cfacef78](https://github.com/facebook/react-native/commit/80cfacef78f34d3786d955084a8bf4d42ea37f1b) by [@GijsWeterings](https://github.com/GijsWeterings))
#### Android specific
#### iOS specific
### Unknown
- Release 0.76.0-rc.0 ([f60fbc15ae](https://github.com/facebook/react-native/commit/f60fbc15ae62d901f52162864b0c5a0f307ca46c) by [@react-native-bot](https://github.com/react-native-bot))
- Fix wrong command for publishing of external-artifacts ([cf5d04d3e1](https://github.com/facebook/react-native/commit/cf5d04d3e12578be009ab0eb6ecad02d6e2f183b) by [@cortinico](https://github.com/cortinico))
- Release 0.76.0-rc.0 ([1e3c583d73](https://github.com/facebook/react-native/commit/1e3c583d73d7ee69a17ff35eed3f4ab44f4da414) by [@react-native-bot](https://github.com/react-native-bot))
- Properly make ScrollView compatible with React19 ([b395208303](https://github.com/facebook/react-native/commit/b39520830341cae8c3785250cbaf2ec99958ba69) by [@cipolleschi](https://github.com/cipolleschi))
- Make ScrollView compatible with React 18.3.1 ([8041e410e3](https://github.com/facebook/react-native/commit/8041e410e3b8ea135dc5f08daddd5ceface24439) by [@cipolleschi](https://github.com/cipolleschi))
- Bump hermes version ([f55759e633](https://github.com/facebook/react-native/commit/f55759e633aaa8f5c0f312836b57ed43af2a68ee) by [@cipolleschi](https://github.com/cipolleschi))
- Add Fusebox support for saving traces to disk ([1bd4a11736](https://github.com/facebook/react-native/commit/1bd4a11736c2916c9114df55395d474a801ee63b) by Benoit Girard)
- Fix using namespace issues in xplat ([194b642633](https://github.com/facebook/react-native/commit/194b642633d944b9e73e55b947284eabd42d55a2) by [@r-barnes](https://github.com/r-barnes))
- Eliminate a few React.Element type that will be synced to react-native ([39c338ff8d](https://github.com/facebook/react-native/commit/39c338ff8d3a65ec3f7a45f0b8319f70115e2fc1) by [@SamChou19815](https://github.com/SamChou19815))
- RSD sync ([8f548be91c](https://github.com/facebook/react-native/commit/8f548be91c2e0ac10e61535154b9db19dad7f3b7) by [@necolas](https://github.com/necolas))
- Replace YogaConstants.UNDEFINED with Float.NaN ([8bd9952eaf](https://github.com/facebook/react-native/commit/8bd9952eaf28fe8feca7490293656caeefe7897e) by Jingbo Yang)
- Increase the buffer size and try kStall to avoid dropping samples ([8a6508c623](https://github.com/facebook/react-native/commit/8a6508c62314a73fd08913cd1d03a98baaa4f1d8) by Benoit Girard)
#### Android Unknown
- Fix testing script to use debug versions of the Android APK ([026fd325ab](https://github.com/facebook/react-native/commit/026fd325abd53fbfe37fcdee341202192d2c3fcd) by [@cipolleschi](https://github.com/cipolleschi))
- GHA: create a reaper job to keep the cache < 10GB ([17cbe7d974](https://github.com/facebook/react-native/commit/17cbe7d9745667798c0bfbb5edd9cbda56607d6f) by [@blakef](https://github.com/blakef))
#### iOS Unknown
- Allow use without @react-native-community/cli-server-api ([24997dc5ae](https://github.com/facebook/react-native/commit/24997dc5ae4ed85d3965cbc6796423f5012e4eb1) by [@blakef](https://github.com/blakef))
#### Failed to parse
- Add E2E test cases for Flat/SectionList to RNTester ([17d0345fdf](https://github.com/facebook/react-native/commit/17d0345fdfe27148900d34cc613836cfcff6b2da) by [@shwanton](https://github.com/shwanton))
- Bump iOS min version for CI ([b93c2b2412](https://github.com/facebook/react-native/commit/b93c2b241247d0a7d9b79eda76af0a7bca0ac745) by [@realsoelynn](https://github.com/realsoelynn))
- Bump OSS Build infra to min iOS 15.1 ([d11c99922c](https://github.com/facebook/react-native/commit/d11c99922c0f27c30897615b4cf506c310cb01e9) by [@realsoelynn](https://github.com/realsoelynn))
- Update RNTester and HelloWorld template app to `min iOS 15.1` ([e1a1cdacf2](https://github.com/facebook/react-native/commit/e1a1cdacf2d210353c06e7ab65f971f6592e8c00) by [@realsoelynn](https://github.com/realsoelynn))
- Ve[RN][Android] Convert StyleAnimatedNode.java->.kt ([ef9149b4fc](https://github.com/facebook/react-native/commit/ef9149b4fc989827ad4b781fa89f556a1fd20db4) by [@rshest](https://github.com/rshest))
- Fixes ellipsis carries background from trimmed text ([9e2f8859c4](https://github.com/facebook/react-native/commit/9e2f8859c4d237ae2bee4679da45038405b7074e) by [@zhongwuzw](https://github.com/zhongwuzw))
## v0.75.4
### Fixed
#### Android specific
- Fix Headless Crash `Tried to finish non-existent task with id` ([56a282c44d](https://github.com/facebook/react-native/commit/56a282c44d1a3ee5114c2cba36b902bc9ae123b9) by [@RodolfoGS](https://github.com/RodolfoGS))
- TextInput's `contextMenuHidden` prop bug fix ([366f1d0df3](https://github.com/facebook/react-native/commit/366f1d0df302af860b1fa9ea5f0bd757f2dec7b3) by [@alanleedev](https://github.com/alanleedev))
- RNGP - Sanitize the output of the config command ([0265ea0577](https://github.com/facebook/react-native/commit/0265ea0577963cca582682c3fc8ee97f3ebef65e) by [@cortinico](https://github.com/cortinico))
#### iOS specific
- Convert `NSNull` to `nil` before checking `type` in `readAsDataURL` ([99ab845a5c](https://github.com/facebook/react-native/commit/99ab845a5cf0fe3463ff39b03373b95d4f5c0fac) by [@haileyok](https://github.com/haileyok))
- Add back the BUNDLE_COMMAND ([afd74ad89d](https://github.com/facebook/react-native/commit/afd74ad89de6e632eea776e6d2689e7381c4f78c) by [@Vin-Xi](https://github.com/Vin-Xi))
- Use CONFIG_CMD if set ([a4ec49cbe6](https://github.com/facebook/react-native/commit/a4ec49cbe6d0157417276731ba1608e482f3f10e) by [@krystofwoldrich](https://github.com/krystofwoldrich))
- App crash happening when navigate to a new app screen with a displaying modal ([8ec672204d](https://github.com/facebook/react-native/commit/8ec672204d5dee2b967cac08adf03c082e36ad79) by [@zhouzh1](https://github.com/zhouzh1))
## v0.75.3
### Changed
- **Infra:** Remove resolution and add commander as devDependency for the monorepo ([cf7b9b9486](https://github.com/facebook/react-native/commit/cf7b9b9486069a8a3cf4443353603fcb2174d012) by [@cipolleschi](https://github.com/cipolleschi))
- **CLI:** Bump CLI to 14.1.0 ([6a08c38263](https://github.com/facebook/react-native/commit/6a08c38263a544d88157cc3a6b1ee44ed28f7db0) by [@cipolleschi](https://github.com/cipolleschi))
### Fixed
- **TypeScript:** Allow readonly array type for transform property ([c16defaff2](https://github.com/facebook/react-native/commit/c16defaff2964a2b30656def35eb3450cff9cd71) by [@tjzel](https://github.com/tjzel))
#### Android specific
- **Autolinking:** Fix autolinking issues for Pure C++ TurboModules ([833c3a2cf5](https://github.com/facebook/react-native/commit/833c3a2cf5df6b65c6fe75577da2df7c5a085e8d) by [@hsjoberg](https://github.com/hsjoberg))
- **Renderer:** Don't use mGapBetweenPaths if not drawing a border ([8501b6396b](https://github.com/facebook/react-native/commit/8501b6396b0a4fd7a9bd2add2b3c8b9c755c27ae) by [@knappam](https://github.com/knappam))
- **Image:** Make getUri and isResource open ([8c81ffa60a](https://github.com/facebook/react-native/commit/8c81ffa60a211e4ae7db50cd04de0e4a4c29df04) by [@shubhamguptadream11](https://github.com/shubhamguptadream11))
- **RGNP:** Remove unnecessary dependency on `gradle-tooling-api-builders` - serviceOf failure ([1067798a7e](https://github.com/facebook/react-native/commit/1067798a7e9ad06f8a22c1749e582c42348a554d) by [@cortinico](https://github.com/cortinico))
#### iOS specific
- **Infra:** Include x86_64 slice when building for visionOS simulator
([05dec917f2](https://github.com/facebook/react-native/commit/05dec917f2e5f8288c0d9f31bc50c10bd0c0eab3) by [@okwasniewski](https://github.com/okwasniewski))
- **Infra:** Support bundle install from outside the ios folder using --project-directory ([b22970e3cf](https://github.com/facebook/react-native/commit/b22970e3cfbe603bffea5b1c3bbf150887e3d7b8) by [@blakef](https://github.com/blakef))
- **Codegen:** Codegen will start looking for codegen-enabled dependencies from the project root. ([46d17efa62](https://github.com/facebook/react-native/commit/46d17efa626cd546e839648e1a95f43a3802051c) by [@dmytrorykun](https://github.com/dmytrorykun))
## v0.75.2
### Added
@@ -360,6 +918,21 @@
- **turbomodule:** Fixed race condition in native module invalidation. ([b7812a8b6c](https://github.com/facebook/react-native/commit/b7812a8b6c3afbeacaad94779cd010bcc5440785) by [@dmytrorykun](https://github.com/dmytrorykun))
- **xcode:** Do not use temporary node when creating the .xcode.env.local ([8408b8bc96](https://github.com/facebook/react-native/commit/8408b8bc96db15e265ca65fce7875ee65dcfdcec) by [@cipolleschi](https://github.com/cipolleschi))
## v0.74.6
### Added
#### Android specific
- [0.74] Add support for handling `com.facebook.react.bridge.Dynamic` as parameter for TurboModules ([a9588f3718](https://github.com/facebook/react-native/commit/a9588f3718d682cf5b10db708b429885c2a06ee9) by [@cortinico](https://github.com/cortinico))
### Changed
- Bump hermes version ([4e737b0b16](https://github.com/facebook/react-native/commit/4e737b0b1649fcfed68529370f371bc2ae9319e3) by [@blakef](https://github.com/blakef))
### Fixed
- Fix(react-native): fix codegen failing in a pnpm monorepo setup ([a90a17a8b3](https://github.com/facebook/react-native/commit/a90a17a8b3f56c5f2aa84e06c48ccc19339b70eb) by [@tido64](https://github.com/tido64))
## v0.74.5
### Fixed
@@ -1026,6 +1599,30 @@
- Bump activesupport to minimum 6.1.7.5 CVE-2023-38037. ([07a159f279](https://github.com/facebook/react-native/commit/07a159f279cdcbed29c9c437dec1c0b8ac2d852f) by [@lunaleaps](https://github.com/lunaleaps))
## v0.73.10
### Removed
#### Android specific
- Stop emitting deprecated onTextInput events ([e6ad652c6a](https://github.com/facebook/react-native/commit/e6ad652c6ae2222e95b3dc351f28c0fa3a91d622) by [@javache](https://github.com/javache))
- RGNP - Remove unnecessary dependency on gradle-tooling-api-builders - serviceOf failure ([069d8fc249](https://github.com/facebook/react-native/commit/069d8fc2495b63a233cb30712e888f29a185098c) by [@cortinico](https://github.com/cortinico))
### Fixed
- fix(TypeScript): Allow readonly arrays in transform ([b4015c1eaa](https://github.com/facebook/react-native/commit/b4015c1eaaed5fe7281314a9c5988a4c1cade3a6) by [@tjzel](https://github.com/tjzel))
#### Android specific
- Fix TextInput 'contextMenuHidden' prop ([08eed9f093](https://github.com/facebook/react-native/commit/08eed9f093d759fadbaef86dcf54c801917b4602) by [@alanleedev](https://github.com/alanleedev))
#### iOS specific
- Fix `<KeyboardAvoidingView>` with floating keyboard on iPadOS ([3c54e1ee45](https://github.com/facebook/react-native/commit/3c54e1ee4522b26698bb3f99262a2a621b26fb64) by [@renchap](https://github.com/renchap))
- Fix the generation of .xcode.env.local ([88fb3daa7e](https://github.com/facebook/react-native/commit/88fb3daa7ef112a9e7500c32168a897d0d409456) by [@cipolleschi](https://github.com/cipolleschi))
- Fix iOS crash occurring when navigating to a new app screen with a displaying modal ([33ca0204f5](https://github.com/facebook/react-native/commit/33ca0204f5491f27f00686e4eb966eb9fee3f7f9) by [@zhouzh1](https://github.com/zhouzh1))
- Fabric: Fixes animations strict weak ordering sorted check failed ([f18ed7b6c7](https://github.com/facebook/react-native/commit/f18ed7b6c72d9b9443282b4c169bae56336dad8d) by [@zhongwuzw](https://github.com/zhongwuzw))
## v0.73.9
### Added
-18
View File
@@ -1,18 +0,0 @@
// flow-typed signature: b1b274e8ae71623bf11c20224c446842
// flow-typed version: c6154227d1/mkdirp_v0.5.x/flow_>=v0.104.x
declare module 'mkdirp' {
declare type Options = number | {
mode?: number,
fs?: mixed,
...
};
declare type Callback = (err: ?Error, path: ?string) => void;
declare module.exports: {
(path: string, options?: Options | Callback, callback?: Callback): void,
sync(path: string, options?: Options): void,
...
};
}
+1
View File
@@ -323,6 +323,7 @@ declare module "yargs" {
updateStrings(obj: { [key: string]: string, ... }): this;
usage(message: string, opts?: { [key: string]: Options, ... }): this;
usage(message: string, desc?: string, builder: CommonModuleObject["builder"], handler: CommonModuleObject["handler"]): this;
version(): this;
version(version: string | false): this;
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
+12 -1
View File
@@ -11,6 +11,11 @@
const {defaults} = require('jest-config');
const PODS_LOCATIONS = [
'packages/rn-tester/Pods',
'packages/helloworld/ios/Pods',
];
module.exports = {
transform: {
'^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$':
@@ -33,6 +38,8 @@ module.exports = {
'<rootDir>/packages/react-native/sdks',
'<rootDir>/packages/react-native/Libraries/Renderer',
'<rootDir>/packages/react-native-test-renderer/src',
'<rootDir>/packages/react-native/sdks/hermes/',
...PODS_LOCATIONS,
],
transformIgnorePatterns: ['node_modules/(?!@react-native/)'],
haste: {
@@ -40,7 +47,11 @@ module.exports = {
platforms: ['ios', 'android'],
},
moduleFileExtensions: ['fb.js'].concat(defaults.moduleFileExtensions),
modulePathIgnorePatterns: ['scripts/.*/__fixtures__/'],
modulePathIgnorePatterns: [
'scripts/.*/__fixtures__/',
'<rootDir>/packages/react-native/sdks/hermes/',
...PODS_LOCATIONS,
],
unmockedModulePathPatterns: [
'node_modules/react/',
'packages/react-native/Libraries/Renderer',
+22 -14
View File
@@ -12,18 +12,31 @@
'use strict';
/* eslint-disable lint/sort-imports */
const metroBabelRegister = require('metro-babel-register');
const nullthrows = require('nullthrows');
const createCacheKeyFunction =
require('@jest/create-cache-key-function').default;
// eslint-disable-next-line lint/sort-imports
const {
transformSync: babelTransformSync,
transformFromAstSync: babelTransformFromAstSync,
transformSync: babelTransformSync,
} = require('@babel/core');
const generate = require('@babel/generator').default;
const createCacheKeyFunction =
require('@jest/create-cache-key-function').default;
const metroBabelRegister = require('metro-babel-register');
const nullthrows = require('nullthrows');
if (process.env.FBSOURCE_ENV === '1') {
// If we're running in the Meta-internal monorepo, use the central Babel
// registration, which registers all of the relevant source directories
// including Metro's root.
//
// $FlowExpectedError[cannot-resolve-module] - Won't resolve in OSS
require('@fb-tools/babel-register');
} else {
// Register Babel to allow local packages to be loaded from source
require('../scripts/build/babel-register').registerForMonorepo();
}
const transformer = require('@react-native/metro-babel-transformer');
const metroTransformPlugins = require('metro-transform-plugins');
// Files matching this pattern will be transformed with the Node JS Babel
// transformer, rather than with the React Native Babel transformer. Scripts
@@ -34,10 +47,6 @@ const nodeFiles = /[\\/]metro(?:-[^/]*)[\\/]/;
// hook. This is used below to configure babelTransformSync under Jest.
const {only: _, ...nodeBabelOptions} = metroBabelRegister.config([]);
// Register Babel to allow the transformer itself to be loaded from source.
require('../scripts/build/babel-register').registerForMonorepo();
const transformer = require('@react-native/metro-babel-transformer');
// Set BUILD_EXCLUDE_BABEL_REGISTER (see ../scripts/build/babel-register.js) to
// prevent inline Babel registration in code under test, normally required when
// running from source, but not in combination with the Jest transformer.
@@ -90,8 +99,7 @@ module.exports = {
ast: true,
retainLines: true,
plugins: [
// TODO(moti): Replace with require('metro-transform-plugins').inlineRequiresPlugin when available in OSS
require('babel-preset-fbjs/plugins/inline-requires'),
metroTransformPlugins.inlineRequiresPlugin,
babelPluginPreventBabelRegister,
],
sourceType: 'module',
+13 -14
View File
@@ -3,6 +3,7 @@
"private": true,
"version": "1000.0.0",
"license": "MIT",
"packageManager": "yarn@1.22.22",
"scripts": {
"android": "cd packages/rn-tester && npm run android",
"build-android": "./gradlew :packages:react-native:ReactAndroid:build",
@@ -32,8 +33,7 @@
"test-typescript": "dtslint packages/react-native/types",
"test": "jest",
"trigger-react-native-release": "node ./scripts/releases-local/trigger-react-native-release.js",
"update-lock": "npx yarn-deduplicate",
"postinstall": "cd packages/react-native-codegen && yarn build"
"update-lock": "npx yarn-deduplicate"
},
"workspaces": [
"packages/*",
@@ -50,17 +50,16 @@
"@definitelytyped/dtslint": "^0.0.127",
"@jest/create-cache-key-function": "^29.6.3",
"@pkgjs/parseargs": "^0.11.0",
"@react-native/metro-babel-transformer": "0.76.0-main",
"@react-native/metro-config": "0.76.0-main",
"@react-native/metro-babel-transformer": "0.77.0-main",
"@react-native/metro-config": "0.77.0-main",
"@tsconfig/node18": "1.0.1",
"@types/react": "^18.2.6",
"@typescript-eslint/parser": "^7.1.1",
"ansi-styles": "^4.2.1",
"babel-plugin-minify-dead-code-elimination": "^0.5.2",
"babel-plugin-syntax-hermes-parser": "0.23.1",
"babel-plugin-syntax-hermes-parser": "0.24.0",
"babel-plugin-transform-define": "^2.1.4",
"babel-plugin-transform-flow-enums": "^0.0.2",
"babel-preset-fbjs": "^3.4.0",
"chalk": "^4.0.0",
"clang-format": "^1.8.0",
"connect": "^3.6.5",
@@ -78,23 +77,23 @@
"eslint-plugin-react-native": "^4.0.0",
"eslint-plugin-redundant-undefined": "^0.4.0",
"eslint-plugin-relay": "^1.8.3",
"flow-api-translator": "0.23.1",
"flow-bin": "^0.245.2",
"flow-api-translator": "0.24.0",
"flow-bin": "^0.250.0",
"glob": "^7.1.1",
"hermes-eslint": "0.23.1",
"hermes-transform": "0.23.1",
"hermes-eslint": "0.24.0",
"hermes-transform": "0.24.0",
"inquirer": "^7.1.0",
"jest": "^29.6.3",
"jest-junit": "^10.0.0",
"jscodeshift": "^0.14.0",
"metro-babel-register": "^0.80.10",
"metro-memory-fs": "^0.80.10",
"metro-babel-register": "^0.81.0",
"metro-memory-fs": "^0.81.0",
"metro-transform-plugins": "^0.81.0",
"micromatch": "^4.0.4",
"mkdirp": "^0.5.1",
"node-fetch": "^2.2.0",
"nullthrows": "^1.1.1",
"prettier": "2.8.8",
"prettier-plugin-hermes-parser": "0.23.1",
"prettier-plugin-hermes-parser": "0.24.0",
"react": "19.0.0-rc-fb9a90fa48-20240614",
"react-test-renderer": "19.0.0-rc-fb9a90fa48-20240614",
"rimraf": "^3.0.2",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/assets-registry",
"version": "0.76.0-main",
"version": "0.77.0-main",
"description": "Asset support code for React Native.",
"license": "MIT",
"repository": {
+2 -2
View File
@@ -55,7 +55,7 @@ const drawableFileTypes = new Set([
function getAndroidResourceFolderName(
asset: PackagerAsset,
scale: number,
): string | $TEMPORARY$string<'raw'> {
): string {
if (!drawableFileTypes.has(asset.type)) {
return 'raw';
}
@@ -78,7 +78,7 @@ function getAndroidResourceIdentifier(asset: PackagerAsset): string {
.toLowerCase()
.replace(/\//g, '_') // Encode folder structure in file name
.replace(/([^a-z0-9_])/g, '') // Remove illegal chars
.replace(/^assets_/, ''); // Remove "assets_" prefix
.replace(/^(?:assets|assetsunstable_path)_/, ''); // Remove "assets_" or "assetsunstable_path_" prefix
}
function getBasePath(asset: PackagerAsset): string {
+24 -7
View File
@@ -11,6 +11,7 @@
let FlowParser, TypeScriptParser, RNCodegen;
const {cheap: traverseCheap} = require('@babel/traverse').default;
const {basename} = require('path');
try {
@@ -168,16 +169,32 @@ module.exports = function ({parse, types: t}) {
exit(path) {
if (this.defaultExport) {
const viewConfig = generateViewConfig(this.filename, this.code);
this.defaultExport.replaceWithMultiple(
parse(viewConfig, {
babelrc: false,
browserslistConfigFile: false,
configFile: false,
}).program.body,
);
const ast = parse(viewConfig, {
babelrc: false,
browserslistConfigFile: false,
configFile: false,
});
// Almost the whole file is replaced with the viewConfig generated code that doesn't
// have a clear equivalent code on the source file when the user debugs, so we point
// it to the location of the default export that in that file, which is the closest
// to representing the code that is being generated.
// This is mostly useful when that generated code throws an error.
traverseCheap(ast, node => {
if (node?.loc) {
node.loc = this.defaultExport.node.loc;
node.start = this.defaultExport.node.start;
node.end = this.defaultExport.node.end;
}
});
this.defaultExport.replaceWithMultiple(ast.program.body);
if (this.commandsExport != null) {
this.commandsExport.remove();
}
this.codeInserted = true;
}
},
+3 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/babel-plugin-codegen",
"version": "0.76.0-main",
"version": "0.77.0-main",
"description": "Babel plugin to generate native module and view manager code for React Native.",
"license": "MIT",
"repository": {
@@ -25,7 +25,8 @@
"index.js"
],
"dependencies": {
"@react-native/codegen": "0.76.0-main"
"@babel/traverse": "^7.25.3",
"@react-native/codegen": "0.77.0-main"
},
"devDependencies": {
"@babel/core": "^7.25.2"
+11 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/community-cli-plugin",
"version": "0.76.0-main",
"version": "0.77.0-main",
"description": "Core CLI commands for React Native",
"keywords": [
"react-native",
@@ -22,18 +22,20 @@
"dist"
],
"dependencies": {
"@react-native/dev-middleware": "0.76.0-main",
"@react-native/metro-babel-transformer": "0.76.0-main",
"@react-native/dev-middleware": "0.77.0-main",
"@react-native/metro-babel-transformer": "0.77.0-main",
"chalk": "^4.0.0",
"execa": "^5.1.1",
"metro": "^0.80.10",
"metro-config": "^0.80.10",
"metro-core": "^0.80.10",
"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",
"readline": "^1.3.0"
"readline": "^1.3.0",
"semver": "^7.1.3"
},
"devDependencies": {
"metro-resolver": "^0.80.10"
"metro-resolver": "^0.81.0"
},
"peerDependencies": {
"@react-native-community/cli-server-api": "*"
@@ -14,7 +14,6 @@ import type {ConfigT} from 'metro-config';
import type {RequestOptions} from 'metro/src/shared/types.flow';
import loadMetroConfig from '../../utils/loadMetroConfig';
import {logger} from '../../utils/logger';
import parseKeyValueParamArray from '../../utils/parseKeyValueParamArray';
import saveAssets from './saveAssets';
import chalk from 'chalk';
@@ -72,13 +71,13 @@ async function buildBundleWithConfig(
);
if (config.resolver.platforms.indexOf(args.platform) === -1) {
logger.error(
`Invalid platform ${
console.error(
`${chalk.red('error')}: Invalid platform ${
args.platform ? `"${chalk.bold(args.platform)}" ` : ''
}selected.`,
);
logger.info(
console.info(
`Available platforms are: ${config.resolver.platforms
.map(x => `"${chalk.bold(x)}"`)
.join(
@@ -123,7 +122,7 @@ async function buildBundleWithConfig(
// $FlowIgnore[incompatible-call]
// $FlowIgnore[prop-missing]
// $FlowIgnore[incompatible-exact]
await bundleImpl.save(bundle, args, logger.info);
await bundleImpl.save(bundle, args, console.info);
// Save the assets of the bundle
const outputAssets = await server.getAssets({
@@ -140,7 +139,7 @@ async function buildBundleWithConfig(
args.assetCatalogDest,
);
} finally {
server.end();
await server.end();
}
}
@@ -11,7 +11,6 @@
import type {AssetData} from 'metro/src/Assets';
import {logger} from '../../utils/logger';
import {
cleanAssetCatalog,
getImageSet,
@@ -21,6 +20,7 @@ import {
import filterPlatformAssetScales from './filterPlatformAssetScales';
import getAssetDestPathAndroid from './getAssetDestPathAndroid';
import getAssetDestPathIOS from './getAssetDestPathIOS';
import chalk from 'chalk';
import fs from 'fs';
import path from 'path';
@@ -35,7 +35,7 @@ async function saveAssets(
assetCatalogDest?: string,
): Promise<void> {
if (assetsDest == null) {
logger.warn('Assets destination folder is not set, skipping...');
console.warn('Warning: Assets destination folder is not set, skipping...');
return;
}
@@ -64,13 +64,13 @@ async function saveAssets(
// remove unused scales from the optimized bundle.
const catalogDir = path.join(assetCatalogDest, 'RNAssets.xcassets');
if (!fs.existsSync(catalogDir)) {
logger.error(
`Could not find asset catalog 'RNAssets.xcassets' in ${assetCatalogDest}. Make sure to create it if it does not exist.`,
console.error(
`${chalk.red('error')}: Could not find asset catalog 'RNAssets.xcassets' in ${assetCatalogDest}. Make sure to create it if it does not exist.`,
);
return;
}
logger.info('Adding images to asset catalog', catalogDir);
console.info('Adding images to asset catalog', catalogDir);
cleanAssetCatalog(catalogDir);
for (const asset of assets) {
if (isCatalogAsset(asset)) {
@@ -84,7 +84,7 @@ async function saveAssets(
addAssetToCopy(asset);
}
}
logger.info('Done adding images to asset catalog');
console.info('Done adding images to asset catalog');
} else {
assets.forEach(addAssetToCopy);
}
@@ -98,7 +98,7 @@ function copyAll(filesToCopy: CopiedFiles) {
return Promise.resolve();
}
logger.info(`Copying ${queue.length} asset files`);
console.info(`Copying ${queue.length} asset files`);
return new Promise<void>((resolve, reject) => {
const copyNext = (error?: Error) => {
if (error) {
@@ -106,7 +106,7 @@ function copyAll(filesToCopy: CopiedFiles) {
return;
}
if (queue.length === 0) {
logger.info('Done copying assets');
console.info('Done copying assets');
resolve();
} else {
// queue.length === 0 is checked in previous branch, so this is string
@@ -0,0 +1,173 @@
/**
* 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.
*
* @flow strict-local
* @format
* @oncall react_native
*/
import type TerminalReporter from 'metro/src/lib/TerminalReporter';
import chalk from 'chalk';
import fetch from 'node-fetch';
type PageDescription = $ReadOnly<{
id: string,
title: string,
description: string,
...
}>;
export default class OpenDebuggerKeyboardHandler {
#devServerUrl: string;
#reporter: TerminalReporter;
#targetsShownForSelection: ?$ReadOnlyArray<PageDescription> = null;
constructor({
devServerUrl,
reporter,
}: {
devServerUrl: string,
reporter: TerminalReporter,
}) {
this.#devServerUrl = devServerUrl;
this.#reporter = reporter;
}
async #tryOpenDebuggerForTarget(target: PageDescription): Promise<void> {
this.#targetsShownForSelection = null;
this.#clearTerminalMenu();
try {
await fetch(
new URL(
'/open-debugger?target=' + encodeURIComponent(target.id),
this.#devServerUrl,
).href,
{method: 'POST'},
);
} catch (e) {
this.#log(
'error',
'Failed to open debugger for %s (%s): %s',
target.title,
target.description,
e.message,
);
this.#clearTerminalMenu();
}
}
/**
* Used in response to 'j' to debug - fetch the available debug targets and:
* - If no targets, warn
* - If one target, open it
* - If more, show a list. The keyboard listener should run subsequent key
* presses through maybeHandleTargetSelection, which will launch the
* debugger if a match is made.
*/
async handleOpenDebugger(): Promise<void> {
this.#setTerminalMenu('Fetching available debugging targets...');
this.#targetsShownForSelection = null;
try {
const res = await fetch(this.#devServerUrl + '/json/list', {
method: 'POST',
});
if (res.status !== 200) {
throw new Error(`Unexpected status code: ${res.status}`);
}
const targets = (await res.json()) as $ReadOnlyArray<PageDescription>;
if (!Array.isArray(targets)) {
throw new Error('Expected array.');
}
if (targets.length === 0) {
this.#log('warn', 'No connected targets');
this.#clearTerminalMenu();
} else if (targets.length === 1) {
const target = targets[0];
// eslint-disable-next-line no-void
void this.#tryOpenDebuggerForTarget(target);
} else {
this.#targetsShownForSelection = targets;
if (targets.length > 9) {
this.#log(
'warn',
'10 or more debug targets available, showing the first 9.',
);
}
this.#setTerminalMenu(
`Multiple debug targets available, please select:\n ${targets
.slice(0, 9)
.map(
({title}, i) =>
`${chalk.white.inverse(` ${i + 1} `)} - "${title}"`,
)
.join('\n ')}`,
);
}
} catch (e) {
this.#log('error', `Failed to fetch debug targets: ${e.message}`);
this.#clearTerminalMenu();
}
}
/**
* Handle key presses that correspond to a valid selection from a visible
* selection list.
*
* @return true if we've handled the key as a target selection, false if the
* caller should handle the key.
*/
maybeHandleTargetSelection(keyName: string): boolean {
if (keyName >= '1' && keyName <= '9') {
const targetIndex = Number(keyName) - 1;
if (
this.#targetsShownForSelection != null &&
targetIndex < this.#targetsShownForSelection.length
) {
const target = this.#targetsShownForSelection[targetIndex];
// eslint-disable-next-line no-void
void this.#tryOpenDebuggerForTarget(target);
return true;
}
}
return false;
}
/**
* Dismiss any target selection UI, if shown.
*/
dismiss() {
this.#clearTerminalMenu();
this.#targetsShownForSelection = null;
}
#log(level: 'info' | 'warn' | 'error', ...data: Array<mixed>): void {
this.#reporter.update({
type: 'unstable_server_log',
level,
data,
});
}
#setTerminalMenu(message: string) {
this.#reporter.update({
type: 'unstable_server_menu_updated',
message,
});
}
#clearTerminalMenu() {
this.#reporter.update({
type: 'unstable_server_menu_cleared',
});
}
}
@@ -9,98 +9,127 @@
* @oncall react_native
*/
import type {Config} from '@react-native-community/cli-types';
import type TerminalReporter from 'metro/src/lib/TerminalReporter';
import {KeyPressHandler} from '../../utils/KeyPressHandler';
import {logger} from '../../utils/logger';
import OpenDebuggerKeyboardHandler from './OpenDebuggerKeyboardHandler';
import chalk from 'chalk';
import execa from 'execa';
import fetch from 'node-fetch';
import invariant from 'invariant';
import readline from 'readline';
import {ReadStream} from 'tty';
const CTRL_C = '\u0003';
const CTRL_D = '\u0004';
const RELOAD_TIMEOUT = 500;
const throttle = (callback: () => void, timeout: number) => {
let previousCallTimestamp = 0;
return () => {
const currentCallTimestamp = new Date().getTime();
if (currentCallTimestamp - previousCallTimestamp > timeout) {
previousCallTimestamp = currentCallTimestamp;
callback();
}
};
};
type KeyEvent = {
sequence: string,
name: string,
ctrl: boolean,
meta: boolean,
shift: boolean,
};
export default function attachKeyHandlers({
cliConfig,
devServerUrl,
messageSocket,
reporter,
}: {
cliConfig: Config,
devServerUrl: string,
messageSocket: $ReadOnly<{
broadcast: (type: string, params?: Record<string, mixed> | null) => void,
...
}>,
reporter: TerminalReporter,
}) {
if (process.stdin.isTTY !== true) {
logger.debug('Interactive mode is not supported in this environment');
reporter.update({
type: 'unstable_server_log',
level: 'info',
data: 'Interactive mode is not supported in this environment',
});
return;
}
const execaOptions = {
env: {FORCE_COLOR: chalk.supportsColor ? 'true' : 'false'},
};
readline.emitKeypressEvents(process.stdin);
setRawMode(true);
const onPress = async (key: string) => {
switch (key.toLowerCase()) {
const reload = throttle(() => {
reporter.update({
type: 'unstable_server_log',
level: 'info',
data: 'Reloading connected app(s)...',
});
messageSocket.broadcast('reload', null);
}, RELOAD_TIMEOUT);
const openDebuggerKeyboardHandler = new OpenDebuggerKeyboardHandler({
reporter,
devServerUrl,
});
process.stdin.on('keypress', (str: string, key: KeyEvent) => {
if (openDebuggerKeyboardHandler.maybeHandleTargetSelection(key.name)) {
return;
}
switch (key.sequence) {
case 'r':
logger.info('Reloading connected app(s)...');
messageSocket.broadcast('reload', null);
reload();
break;
case 'd':
logger.info('Opening Dev Menu...');
reporter.update({
type: 'unstable_server_log',
level: 'info',
data: 'Opening Dev Menu...',
});
messageSocket.broadcast('devMenu', null);
break;
case 'i':
logger.info('Opening app on iOS...');
execa(
'npx',
[
'react-native',
'run-ios',
...(cliConfig.project.ios?.watchModeCommandParams ?? []),
],
execaOptions,
).stdout?.pipe(process.stdout);
break;
case 'a':
logger.info('Opening app on Android...');
execa(
'npx',
[
'react-native',
'run-android',
...(cliConfig.project.android?.watchModeCommandParams ?? []),
],
execaOptions,
).stdout?.pipe(process.stdout);
break;
case 'j':
// TODO(T192878199): Add multi-target selection
await fetch(devServerUrl + '/open-debugger', {method: 'POST'});
// eslint-disable-next-line no-void
void openDebuggerKeyboardHandler.handleOpenDebugger();
break;
case CTRL_C:
case CTRL_D:
logger.info('Stopping server');
keyPressHandler.stopInterceptingKeyStrokes();
openDebuggerKeyboardHandler.dismiss();
reporter.update({
type: 'unstable_server_log',
level: 'info',
data: 'Stopping server',
});
setRawMode(false);
process.stdin.pause();
process.emit('SIGINT');
process.exit();
}
};
});
const keyPressHandler = new KeyPressHandler(onPress);
keyPressHandler.createInteractionListener();
keyPressHandler.startInterceptingKeyStrokes();
reporter.update({
type: 'unstable_server_log',
level: 'info',
data: `Key commands available:
logger.log(
[
'',
`${chalk.bold('i')} - run on iOS`,
`${chalk.bold('a')} - run on Android`,
`${chalk.bold('r')} - reload app`,
`${chalk.bold('d')} - open Dev Menu`,
`${chalk.bold('j')} - open DevTools`,
'',
].join('\n'),
${chalk.bold.inverse(' r ')} - reload app(s)
${chalk.bold.inverse(' d ')} - open Dev Menu
${chalk.bold.inverse(' j ')} - open DevTools
`,
});
}
function setRawMode(enable: boolean) {
invariant(
process.stdin instanceof ReadStream,
'process.stdin must be a readable stream to modify raw mode',
);
process.stdin.setRawMode(enable);
}
@@ -12,7 +12,7 @@
import type {NextHandleFunction, Server} from 'connect';
import type {TerminalReportableEvent} from 'metro/src/lib/TerminalReporter';
import {logger} from '../../utils/logger';
const debug = require('debug')('ReactNative:CommunityCliPlugin');
type MiddlewareReturn = {
middleware: Server,
@@ -71,7 +71,7 @@ try {
communityMiddlewareFallback.createDevServerMiddleware =
community.createDevServerMiddleware;
} catch {
logger.debug(`⚠️ Unable to find @react-native-community/cli-server-api
debug(`⚠️ Unable to find @react-native-community/cli-server-api
Starting the server without the community middleware.`);
}
@@ -14,9 +14,9 @@ import type {Reporter} from 'metro/src/lib/reporting';
import type {TerminalReportableEvent} from 'metro/src/lib/TerminalReporter';
import typeof TerminalReporter from 'metro/src/lib/TerminalReporter';
import createDevMiddlewareLogger from '../../utils/createDevMiddlewareLogger';
import isDevServerRunning from '../../utils/isDevServerRunning';
import loadMetroConfig from '../../utils/loadMetroConfig';
import {logger} from '../../utils/logger';
import * as version from '../../utils/version';
import attachKeyHandlers from './attachKeyHandlers';
import {
@@ -51,10 +51,10 @@ export type StartCommandArgs = {
async function runServer(
_argv: Array<string>,
ctx: Config,
cliConfig: Config,
args: StartCommandArgs,
) {
const metroConfig = await loadMetroConfig(ctx, {
const metroConfig = await loadMetroConfig(cliConfig, {
config: args.config,
maxWorkers: args.maxWorkers,
port: args.port,
@@ -72,24 +72,26 @@ async function runServer(
const protocol = args.https === true ? 'https' : 'http';
const devServerUrl = url.format({protocol, hostname, port});
logger.info(`Welcome to React Native v${ctx.reactNativeVersion}`);
console.info(
chalk.blue(`\nWelcome to React Native v${cliConfig.reactNativeVersion}`),
);
const serverStatus = await isDevServerRunning(devServerUrl, projectRoot);
if (serverStatus === 'matched_server_running') {
logger.info(
console.info(
`A dev server is already running for this project on port ${port}. Exiting.`,
);
return;
} else if (serverStatus === 'port_taken') {
logger.error(
`Another process is running on port ${port}. Please terminate this ` +
console.error(
`${chalk.red('error')}: Another process is running on port ${port}. Please terminate this ` +
'process and try again, or use another port with "--port".',
);
return;
}
logger.info(`Starting dev server on port ${chalk.bold(String(port))}...`);
console.info(`Starting dev server on ${devServerUrl}\n`);
if (args.assetPlugins) {
// $FlowIgnore[cannot-write] Assigning to readonly property
@@ -98,6 +100,11 @@ async function runServer(
);
}
let reportEvent: (event: TerminalReportableEvent) => void;
const terminal = new Terminal(process.stdout);
const ReporterImpl = getReporterImpl(args.customLogReporterPath);
const terminalReporter = new ReporterImpl(terminal);
const {
middleware: communityMiddleware,
websocketEndpoints: communityWebsocketEndpoints,
@@ -111,13 +118,9 @@ async function runServer(
const {middleware, websocketEndpoints} = createDevMiddleware({
projectRoot,
serverBaseUrl: devServerUrl,
logger,
logger: createDevMiddlewareLogger(terminalReporter),
});
let reportEvent: (event: TerminalReportableEvent) => void;
const terminal = new Terminal(process.stdout);
const ReporterImpl = getReporterImpl(args.customLogReporterPath);
const terminalReporter = new ReporterImpl(terminal);
const reporter: Reporter = {
update(event: TerminalReportableEvent) {
terminalReporter.update(event);
@@ -125,11 +128,15 @@ async function runServer(
reportEvent(event);
}
if (args.interactive && event.type === 'initialize_done') {
logger.info('Dev server ready');
terminalReporter.update({
type: 'unstable_server_log',
level: 'info',
data: `Dev server ready. ${chalk.dim('Press Ctrl+C to exit.')}`,
});
attachKeyHandlers({
cliConfig: ctx,
devServerUrl,
messageSocket: messageSocketEndpoint,
reporter: terminalReporter,
});
}
},
@@ -167,7 +174,7 @@ async function runServer(
//
serverInstance.keepAliveTimeout = 30000;
await version.logIfUpdateAvailable(ctx.root);
await version.logIfUpdateAvailable(cliConfig, terminalReporter);
}
function getReporterImpl(customLogReporterPath?: string): TerminalReporter {
@@ -1,90 +0,0 @@
/**
* 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.
*
* @flow strict-local
* @format
* @oncall react_native
*/
import {CLIError} from './errors';
import {logger} from './logger';
const CTRL_C = '\u0003';
/** An abstract key stroke interceptor. */
export class KeyPressHandler {
_isInterceptingKeyStrokes = false;
_isHandlingKeyPress = false;
_onPress: (key: string) => Promise<void>;
constructor(onPress: (key: string) => Promise<void>) {
this._onPress = onPress;
}
/** Start observing interaction pause listeners. */
createInteractionListener(): ({pause: boolean, ...}) => void {
// Support observing prompts.
let wasIntercepting = false;
const listener = ({pause}: {pause: boolean, ...}) => {
if (pause) {
// Track if we were already intercepting key strokes before pausing, so we can
// resume after pausing.
wasIntercepting = this._isInterceptingKeyStrokes;
this.stopInterceptingKeyStrokes();
} else if (wasIntercepting) {
// Only start if we were previously intercepting.
this.startInterceptingKeyStrokes();
}
};
return listener;
}
_handleKeypress = async (key: string): Promise<CLIError | void> => {
// Prevent sending another event until the previous event has finished.
if (this._isHandlingKeyPress && key !== CTRL_C) {
return;
}
this._isHandlingKeyPress = true;
try {
logger.debug(`Key pressed: ${key}`);
await this._onPress(key);
} catch (error) {
return new CLIError('There was an error with the key press handler.');
} finally {
this._isHandlingKeyPress = false;
return;
}
};
/** Start intercepting all key strokes and passing them to the input `onPress` method. */
startInterceptingKeyStrokes() {
if (this._isInterceptingKeyStrokes) {
return;
}
this._isInterceptingKeyStrokes = true;
const {stdin} = process;
// $FlowFixMe[prop-missing]
stdin.setRawMode(true);
stdin.resume();
stdin.setEncoding('utf8');
stdin.on('data', this._handleKeypress);
}
/** Stop intercepting all key strokes. */
stopInterceptingKeyStrokes() {
if (!this._isInterceptingKeyStrokes) {
return;
}
this._isInterceptingKeyStrokes = false;
const {stdin} = process;
stdin.removeListener('data', this._handleKeypress);
// $FlowFixMe[prop-missing]
stdin.setRawMode(false);
stdin.resume();
}
}
@@ -0,0 +1,44 @@
/**
* 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.
*
* @flow strict-local
* @format
* @oncall react_native
*/
import type TerminalReporter from 'metro/src/lib/TerminalReporter';
type LoggerFn = (...message: $ReadOnlyArray<string>) => void;
/**
* Create a dev-middleware logger object that will emit logs via Metro's
* terminal reporter.
*/
export default function createDevMiddlewareLogger(
reporter: TerminalReporter,
): $ReadOnly<{
info: LoggerFn,
error: LoggerFn,
warn: LoggerFn,
}> {
return {
info: makeLogger(reporter, 'info'),
warn: makeLogger(reporter, 'warn'),
error: makeLogger(reporter, 'error'),
};
}
function makeLogger(
reporter: TerminalReporter,
level: 'info' | 'warn' | 'error',
): LoggerFn {
return (...data: Array<mixed>) =>
reporter.update({
type: 'unstable_server_log',
level,
data,
});
}
@@ -13,11 +13,12 @@ import type {Config} from '@react-native-community/cli-types';
import type {ConfigT, InputConfigT, YargArguments} from 'metro-config';
import {CLIError} from './errors';
import {logger} from './logger';
import {reactNativePlatformResolver} from './metroPlatformResolver';
import {loadConfig, mergeConfig, resolveConfig} from 'metro-config';
import path from 'path';
const debug = require('debug')('ReactNative:CommunityCliPlugin');
export type {Config};
export type ConfigLoadingContext = $ReadOnly<{
@@ -92,7 +93,7 @@ export default async function loadMetroConfig(
throw new CLIError(`No Metro config found in ${cwd}`);
}
logger.debug(`Reading Metro config from ${projectConfig.filepath}`);
debug(`Reading Metro config from ${projectConfig.filepath}`);
if (!global.__REACT_NATIVE_METRO_CONFIG_LOADED) {
const warning = `
@@ -105,7 +106,7 @@ This warning will be removed in future (https://github.com/facebook/metro/issues
`;
for (const line of warning.trim().split('\n')) {
logger.warn(line);
console.warn(line);
}
}
@@ -1,112 +0,0 @@
/**
* 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.
*
* @flow strict-local
* @format
* @oncall react_native
*/
import chalk from 'chalk';
const SEPARATOR = ', ';
let verbose: boolean = process.argv.includes('--verbose');
let disabled: boolean = false;
let hidden: boolean = false;
const formatMessages = (messages: Array<string>) =>
chalk.reset(messages.join(SEPARATOR));
const success = (...messages: Array<string>) => {
if (!disabled) {
console.log(`${chalk.green.bold('success')} ${formatMessages(messages)}`);
}
};
const info = (...messages: Array<string>) => {
if (!disabled) {
console.log(`${chalk.cyan.bold('info')} ${formatMessages(messages)}`);
}
};
const warn = (...messages: Array<string>) => {
if (!disabled) {
console.warn(`${chalk.yellow.bold('warn')} ${formatMessages(messages)}`);
}
};
const error = (...messages: Array<string>) => {
if (!disabled) {
console.error(`${chalk.red.bold('error')} ${formatMessages(messages)}`);
}
};
const debug = (...messages: Array<string>) => {
if (verbose && !disabled) {
console.log(`${chalk.gray.bold('debug')} ${formatMessages(messages)}`);
} else {
hidden = true;
}
};
const log = (...messages: Array<string>) => {
if (!disabled) {
console.log(`${formatMessages(messages)}`);
}
};
const setVerbose = (level: boolean) => {
verbose = level;
};
const isVerbose = (): boolean => verbose;
const disable = () => {
disabled = true;
};
const enable = () => {
disabled = false;
};
const hasDebugMessages = (): boolean => hidden;
let communityLogger;
try {
const {logger} = require('@react-native-community/cli-tools');
logger.debug("Using @react-naive-community/cli-tools' logger");
communityLogger = logger;
} catch {
// This is no longer a required dependency in react-native projects, but use it instead of
// our forked version if it's available. Fail silently otherwise.
}
type Logger = $ReadOnly<{
debug: (...message: Array<string>) => void,
error: (...message: Array<string>) => void,
log: (...message: Array<string>) => void,
info: (...message: Array<string>) => void,
warn: (...message: Array<string>) => void,
...
}>;
export const logger: Logger = communityLogger ?? {
success,
info,
warn,
error,
debug,
log,
setVerbose,
isVerbose,
hasDebugMessages,
disable,
enable,
};
if (communityLogger == null) {
logger.debug("Using @react-native/communityu-cli-plugin's logger");
}
@@ -9,12 +9,14 @@
* @oncall react_native
*/
import {logger} from './logger';
import type {Config} from '@react-native-community/cli-types';
import type TerminalReporter from 'metro/src/lib/TerminalReporter';
import chalk from 'chalk';
import {readFileSync} from 'fs';
import path from 'path';
import semver from 'semver';
const debug = require('debug')('ReactNative:CommunityCliPlugin');
type Release = {
// The current stable release
stable: string,
@@ -35,15 +37,6 @@ interface DiffPurge {
node_id: string;
}
type Update = {
// Only populated if an upgrade is available
upgrade?: Release,
// The project's package's current version
current: string,
// The project's package's name
name: string,
};
type LatestVersions = {
candidate?: string,
stable: string,
@@ -54,68 +47,45 @@ type Headers = {
[header: string]: string,
};
function getReactNativeVersion(projectRoot: string): string | void {
try {
const resolvedPath: string = require.resolve('react-native/package.json', {
paths: [projectRoot],
});
logger.debug(
`Found 'react-native' from '${projectRoot}' -> '${resolvedPath}'`,
);
return JSON.parse(readFileSync(resolvedPath, 'utf8')).version;
} catch {
logger.debug("Couldn't read the version of 'react-native'");
return;
}
}
/**
* Logs out a message if the user's version is behind a stable version of React Native
*/
export async function logIfUpdateAvailable(projectRoot: string): Promise<void> {
const versions = await latest(projectRoot);
if (!versions?.upgrade) {
return;
}
if (semver.gt(versions.upgrade.stable, versions.current)) {
logger.info(
`React Native v${versions.upgrade.stable} is now available (your project is running on v${versions.name}).
Changelog: ${chalk.dim.underline(versions.upgrade?.changelogUrl ?? 'none')}
Diff: ${chalk.dim.underline(versions.upgrade?.diffUrl ?? 'none')}
`,
);
}
}
export async function logIfUpdateAvailable(
cliConfig: Config,
reporter: TerminalReporter,
): Promise<void> {
const {reactNativeVersion: currentVersion} = cliConfig;
let newVersion = null;
/**
* Finds the latest stables version of React Native > current version
*/
async function latest(projectRoot: string): Promise<Update | void> {
try {
const currentVersion = getReactNativeVersion(projectRoot);
if (currentVersion == null) {
return;
}
const {name} = JSON.parse(
readFileSync(path.join(projectRoot, 'package.json'), 'utf8'),
);
const upgrade = await getLatestRelease(name, currentVersion);
const upgrade = await getLatestRelease(currentVersion);
if (upgrade) {
return {
name,
current: currentVersion,
upgrade,
};
newVersion = upgrade;
}
} catch (e) {
// We let the flow continue as this component is not vital for the rest of
// the CLI.
logger.debug(
debug(
'Cannot detect current version of React Native, ' +
'skipping check for a newer release',
);
logger.debug(e);
debug(e);
}
if (newVersion == null) {
return;
}
if (semver.gt(newVersion.stable, currentVersion)) {
reporter.update({
type: 'unstable_server_log',
level: 'info',
data: `React Native v${newVersion.stable} is now available (your project is running on v${currentVersion}).
Changelog: ${chalk.dim.underline(newVersion?.changelogUrl ?? 'none')}
Diff: ${chalk.dim.underline(newVersion?.diffUrl ?? 'none')}
`,
});
}
}
@@ -136,12 +106,11 @@ function isDiffPurgeEntry(data: Partial<DiffPurge>): data is DiffPurge {
* will return undefined.
*/
export default async function getLatestRelease(
name: string,
currentVersion: string,
): Promise<Release | void> {
logger.debug('Checking for a newer version of React Native');
debug('Checking for a newer version of React Native');
try {
logger.debug(`Current version: ${currentVersion}`);
debug(`Current version: ${currentVersion}`);
// if the version is a nightly/canary build, we want to bail
// since they are nightlies or unreleased versions
@@ -149,14 +118,14 @@ export default async function getLatestRelease(
return;
}
logger.debug('Checking for newer releases on GitHub');
const latestVersion = await getLatestRnDiffPurgeVersion(name);
debug('Checking for newer releases on GitHub');
const latestVersion = await getLatestRnDiffPurgeVersion();
if (latestVersion == null) {
logger.debug('Failed to get latest release');
debug('Failed to get latest release');
return;
}
const {stable, candidate} = latestVersion;
logger.debug(`Latest release: ${stable} (${candidate ?? ''})`);
debug(`Latest release: ${stable} (${candidate ?? ''})`);
if (semver.compare(stable, currentVersion) >= 0) {
return {
@@ -167,10 +136,8 @@ export default async function getLatestRelease(
};
}
} catch (e) {
logger.debug(
'Something went wrong with remote version checking, moving on',
);
logger.debug(e);
debug('Something went wrong with remote version checking, moving on');
debug(e);
}
}
@@ -185,9 +152,7 @@ function buildDiffUrl(oldVersion: string, newVersion: string) {
/**
* Returns the most recent React Native version available to upgrade to.
*/
async function getLatestRnDiffPurgeVersion(
name: string,
): Promise<LatestVersions | void> {
async function getLatestRnDiffPurgeVersion(): Promise<LatestVersions | void> {
const options = {
// https://developer.github.com/v3/#user-agent-required
headers: {'User-Agent': '@react-native/community-cli-plugin'} as Headers,
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/core-cli-utils",
"version": "0.76.0-main",
"version": "0.77.0-main",
"description": "React Native CLI library for Frameworks to build on",
"license": "MIT",
"main": "./src/index.flow.js",
+2 -2
View File
@@ -1,5 +1,5 @@
@generated SignedSource<<d156d11a5d3cc2a10238c2f014ada9f9>>
Git revision: a556d261a5e2131864f4e38ded62d8f90e81c39a
@generated SignedSource<<1b9049cb997851561480ca34c5073b7d>>
Git revision: 117c96a1dda920e4dcfcbb22c30cc5f507ebd546
Built with --nohooks: false
Is local checkout: false
Remote URL: https://github.com/facebookexperimental/rn-chrome-devtools-frontend
@@ -20,7 +20,6 @@ style.setProperty('--image-file-nodeIcon', 'url(\"' + new URL('./nodeIcon.avif',
style.setProperty('--image-file-popoverArrows', 'url(\"' + new URL('./popoverArrows.png', import.meta.url).toString() + '\")');
style.setProperty('--image-file-react_native/learn-debugging-basics', 'url(\"' + new URL('./react_native/learn-debugging-basics.jpg', import.meta.url).toString() + '\")');
style.setProperty('--image-file-react_native/learn-native-debugging', 'url(\"' + new URL('./react_native/learn-native-debugging.jpg', import.meta.url).toString() + '\")');
style.setProperty('--image-file-react_native/learn-react-devtools', 'url(\"' + new URL('./react_native/learn-react-devtools.jpg', import.meta.url).toString() + '\")');
style.setProperty('--image-file-react_native/learn-react-native-devtools', 'url(\"' + new URL('./react_native/learn-react-native-devtools.jpg', import.meta.url).toString() + '\")');
style.setProperty('--image-file-react_native/welcomeIcon', 'url(\"' + new URL('./react_native/welcomeIcon.png', import.meta.url).toString() + '\")');
style.setProperty('--image-file-toolbarResizerVertical', 'url(\"' + new URL('./toolbarResizerVertical.png', import.meta.url).toString() + '\")');
Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
import*as e from"../../core/i18n/i18n.js";import*as o from"../../ui/legacy/legacy.js";const t={title:"⚛️ Components",command:"Show React DevTools Components panel"},n=e.i18n.registerUIStrings("panels/react_devtools/react_devtools_components-meta.ts",t),a=e.i18n.getLazilyComputedLocalizedString.bind(void 0,n);let i;o.ViewManager.registerViewExtension({location:"panel",id:"react-devtools-components",title:a(t.title),commandPrompt:a(t.command),persistence:"permanent",order:1e3,loadView:async()=>new((await async function(){return i||(i=await import("./react_devtools.js")),i}()).ReactDevToolsComponentsView.ReactDevToolsComponentsViewImpl)});
import*as e from"../../core/i18n/i18n.js";import*as o from"../../ui/legacy/legacy.js";const t={title:"Components",command:"Show React DevTools Components panel"},n=e.i18n.registerUIStrings("panels/react_devtools/react_devtools_components-meta.ts",t),a=e.i18n.getLazilyComputedLocalizedString.bind(void 0,n);let i;o.ViewManager.registerViewExtension({location:"panel",id:"react-devtools-components",title:a(t.title),commandPrompt:a(t.command),persistence:"permanent",order:1e3,loadView:async()=>new((await async function(){return i||(i=await import("./react_devtools.js")),i}()).ReactDevToolsComponentsView.ReactDevToolsComponentsViewImpl)});
@@ -1 +1 @@
import*as e from"../../core/i18n/i18n.js";import*as o from"../../ui/legacy/legacy.js";const t={title:"⚛️ Profiler",command:"Show React DevTools Profiler panel"},i=e.i18n.registerUIStrings("panels/react_devtools/react_devtools_profiler-meta.ts",t),r=e.i18n.getLazilyComputedLocalizedString.bind(void 0,i);let a;o.ViewManager.registerViewExtension({location:"panel",id:"react-devtools-profiler",title:r(t.title),commandPrompt:r(t.command),persistence:"permanent",order:1e3,loadView:async()=>new((await async function(){return a||(a=await import("./react_devtools.js")),a}()).ReactDevToolsProfilerView.ReactDevToolsProfilerViewImpl)});
import*as e from"../../core/i18n/i18n.js";import*as o from"../../ui/legacy/legacy.js";const t={title:"Profiler",command:"Show React DevTools Profiler panel"},i=e.i18n.registerUIStrings("panels/react_devtools/react_devtools_profiler-meta.ts",t),r=e.i18n.getLazilyComputedLocalizedString.bind(void 0,i);let a;o.ViewManager.registerViewExtension({location:"panel",id:"react-devtools-profiler",title:r(t.title),commandPrompt:r(t.command),persistence:"permanent",order:1e3,loadView:async()=>new((await async function(){return a||(a=await import("./react_devtools.js")),a}()).ReactDevToolsProfilerView.ReactDevToolsProfilerViewImpl)});
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
import*as e from"../../lit-html/lit-html.js";import*as t from"../../visual_logging/visual_logging.js";import*as i from"../icon_button/icon_button.js";import*as n from"../input/input.js";import*as s from"../../../core/common/common.js";const a=new CSSStyleSheet;a.replaceSync(":host{padding:0;margin:0}input{height:12px;width:12px;min-height:12px;min-width:12px}label{display:inline-flex;align-items:center;overflow:hidden;text-overflow:ellipsis}p{margin:12px 0}.disabled-reason{box-sizing:border-box;margin-left:3px;width:16px;height:16px}\n/*# sourceURL=settingCheckbox.css */\n");const o=new CSSStyleSheet;o.replaceSync(".clickable{cursor:pointer}devtools-icon{vertical-align:text-bottom;padding-left:2px}\n/*# sourceURL=settingDeprecationWarning.css */\n");class c extends HTMLElement{static litTagName=e.literal`devtools-setting-deprecation-warning`;#e=this.attachShadow({mode:"open"});connectedCallback(){this.#e.adoptedStyleSheets=[o]}set data(e){this.#t(e)}#t({disabled:t,warning:n,experiment:a}){const o={clickable:!1};let c;t&&a&&(o.clickable=!0,c=()=>{s.Revealer.reveal(a)}),e.render(e.html`<${i.Icon.Icon.litTagName} class=${e.Directives.classMap(o)} .data=${{iconName:"info",color:"var(--icon-default)",width:"16px"}} title=${n} @click=${c}></${i.Icon.Icon.litTagName}>`,this.#e,{host:this})}}customElements.define("devtools-setting-deprecation-warning",c);var l=Object.freeze({__proto__:null,SettingDeprecationWarning:c});class r extends HTMLElement{static litTagName=e.literal`setting-checkbox`;#e=this.attachShadow({mode:"open"});#i;#n;connectedCallback(){this.#e.adoptedStyleSheets=[n.checkboxStyles,a]}set data(e){this.#n&&this.#i&&this.#i.removeChangeListener(this.#n.listener),this.#i=e.setting,this.#n=this.#i.addChangeListener((()=>{this.#t()})),this.#t()}#s(){if(this.#i?.deprecation)return e.html`<${c.litTagName} .data=${this.#i.deprecation}></${c.litTagName}>`}#t(){if(!this.#i)throw new Error('No "Setting" object provided for rendering');const n=this.#s(),s=this.#i.disabledReason()?e.html`
import*as e from"../../lit-html/lit-html.js";import*as t from"../../visual_logging/visual_logging.js";import*as i from"../icon_button/icon_button.js";import*as n from"../input/input.js";import*as s from"../../../core/common/common.js";const a=new CSSStyleSheet;a.replaceSync(":host{display:block;padding:0;margin:0}input{height:12px;width:12px;min-height:12px;min-width:12px}label{display:inline-flex;align-items:center;overflow:hidden;text-overflow:ellipsis}p{margin:12px 0}.disabled-reason{box-sizing:border-box;margin-left:3px;width:16px;height:16px}\n/*# sourceURL=settingCheckbox.css */\n");const o=new CSSStyleSheet;o.replaceSync(".clickable{cursor:pointer}devtools-icon{vertical-align:text-bottom;padding-left:2px}\n/*# sourceURL=settingDeprecationWarning.css */\n");class c extends HTMLElement{static litTagName=e.literal`devtools-setting-deprecation-warning`;#e=this.attachShadow({mode:"open"});connectedCallback(){this.#e.adoptedStyleSheets=[o]}set data(e){this.#t(e)}#t({disabled:t,warning:n,experiment:a}){const o={clickable:!1};let c;t&&a&&(o.clickable=!0,c=()=>{s.Revealer.reveal(a)}),e.render(e.html`<${i.Icon.Icon.litTagName} class=${e.Directives.classMap(o)} .data=${{iconName:"info",color:"var(--icon-default)",width:"16px"}} title=${n} @click=${c}></${i.Icon.Icon.litTagName}>`,this.#e,{host:this})}}customElements.define("devtools-setting-deprecation-warning",c);var l=Object.freeze({__proto__:null,SettingDeprecationWarning:c});class r extends HTMLElement{static litTagName=e.literal`setting-checkbox`;#e=this.attachShadow({mode:"open"});#i;#n;connectedCallback(){this.#e.adoptedStyleSheets=[n.checkboxStyles,a]}set data(e){this.#n&&this.#i&&this.#i.removeChangeListener(this.#n.listener),this.#i=e.setting,this.#n=this.#i.addChangeListener((()=>{this.#t()})),this.#t()}#s(){if(this.#i?.deprecation)return e.html`<${c.litTagName} .data=${this.#i.deprecation}></${c.litTagName}>`}#t(){if(!this.#i)throw new Error('No "Setting" object provided for rendering');const n=this.#s(),s=this.#i.disabledReason()?e.html`
<${i.Icon.Icon.litTagName} class="disabled-reason" name="info" title=${this.#i.disabledReason()} @click=${onclick}></${i.Icon.Icon.litTagName}>
`:e.nothing;e.render(e.html`
<p>
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/debugger-frontend",
"version": "0.76.0-main",
"version": "0.77.0-main",
"description": "Debugger frontend for React Native based on Chrome DevTools",
"keywords": [
"react-native",
+6 -2
View File
@@ -64,12 +64,16 @@ Subpaths of this endpoint are reserved to serve the JavaScript debugger frontend
#### POST `/open-debugger`
Open the JavaScript debugger for a given CDP target (direct Hermes debugging).
Open the JavaScript debugger for a given CDP target. Must be provided with one of the following query params:
- `device` — An ID unique to a combination of device and app, stable across installs. Implemented by `getInspectorDeviceId` on each native platform.
- `target` — The target page ID as returned by `/json/list` for the current dev server session.
- `appId` (deprecated, legacy only) — The application bundle identifier to match (non-unique across multiple connected devices). This param will only match legacy Hermes debugger targets.
<details>
<summary>Example</summary>
curl -X POST 'http://localhost:8081/open-debugger?appId=com.meta.RNTester'
curl -X POST 'http://localhost:8081/open-debugger?target=<targetId>'
</details>
### WebSocket endpoints
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/dev-middleware",
"version": "0.76.0-main",
"version": "0.77.0-main",
"description": "Dev server middleware for React Native",
"keywords": [
"react-native",
@@ -23,7 +23,7 @@
],
"dependencies": {
"@isaacs/ttlcache": "^1.4.1",
"@react-native/debugger-frontend": "0.76.0-main",
"@react-native/debugger-frontend": "0.77.0-main",
"chrome-launcher": "^0.15.2",
"chromium-edge-launcher": "^0.2.0",
"connect": "^3.6.5",
@@ -21,7 +21,7 @@ declare var globalThis: $FlowFixMe;
*/
export async function fetchLocal(
url: string,
options?: Parameters<typeof fetch>[1] & {dispatcher?: mixed},
options?: Partial<Parameters<typeof fetch>[1] & {dispatcher?: mixed}>,
): ReturnType<typeof fetch> {
return await fetch(url, {
...options,
@@ -14,6 +14,7 @@ import type {
JsonVersionResponse,
} from '../inspector-proxy/types';
import DefaultBrowserLauncher from '../utils/DefaultBrowserLauncher';
import {fetchJson, fetchLocal} from './FetchUtils';
import {createDeviceMock} from './InspectorDeviceUtils';
import {withAbortSignalForEachTest} from './ResourceUtils';
@@ -184,6 +185,7 @@ describe('inspector proxy HTTP API', () => {
);
expect(json).toEqual([
{
appId: 'bar-app',
description: 'bar-app',
deviceName: 'foo',
devtoolsFrontendUrl: expect.any(String),
@@ -198,6 +200,7 @@ describe('inspector proxy HTTP API', () => {
webSocketDebuggerUrl: expect.any(String),
},
{
appId: 'bar-app',
description: 'bar-app',
deviceName: 'foo',
devtoolsFrontendUrl: expect.any(String),
@@ -368,4 +371,59 @@ describe('inspector proxy HTTP API', () => {
}
});
});
describe('/open-debugger endpoint', () => {
test('opens requested device using device and target query params', async () => {
// Connect a device to use when opening the debugger
const device = await createDeviceMock(
`${serverRef.serverBaseWsUrl}/inspector/device?device=device1&name=foo&app=bar`,
autoCleanup.signal,
);
device.getPages.mockImplementation(() => [
{
app: 'bar-app',
id: 'page1',
title: 'bar-title',
vm: 'bar-vm',
capabilities: {
// Ensure the device target can be found when launching the debugger
nativePageReloads: true,
},
},
]);
jest.advanceTimersByTime(PAGES_POLLING_DELAY);
// Hook into `DefaultBrowserLauncher.launchDebuggerAppWindow` to ensure debugger was launched
const launchDebuggerSpy = jest
.spyOn(DefaultBrowserLauncher, 'launchDebuggerAppWindow')
.mockResolvedValueOnce();
try {
// Fetch the target information for the device
const pageListResponse = await fetchJson<JsonPagesListResponse>(
`${serverRef.serverBaseUrl}/json`,
);
// Select the first target from the page list response
expect(pageListResponse.length).toBeGreaterThanOrEqual(1);
const firstPage = pageListResponse[0];
// Build the URL for the debugger
const openUrl = new URL('/open-debugger', serverRef.serverBaseUrl);
openUrl.searchParams.set(
'device',
firstPage.reactNative.logicalDeviceId,
);
openUrl.searchParams.set('target', firstPage.id);
// Request to open the debugger for the first device
const response = await fetchLocal(openUrl.toString(), {method: 'POST'});
// Ensure the request was handled properly
expect(response.status).toBe(200);
// Ensure the debugger was launched
expect(launchDebuggerSpy).toHaveBeenCalledWith(expect.any(String));
} finally {
device.close();
}
});
});
});
@@ -160,7 +160,8 @@ export default class InspectorProxy implements InspectorProxyQueries {
return {
id: `${deviceId}-${page.id}`,
title: page.title,
description: page.app,
description: page.description ?? page.app,
appId: page.app,
type: 'node',
devtoolsFrontendUrl,
webSocketDebuggerUrl,
@@ -18,9 +18,10 @@ export type TargetCapabilityFlags = $ReadOnly<{
* The target supports a stable page representation across reloads.
*
* In the proxy, this disables legacy page reload emulation and the
* additional '(Experimental)' target in `/json/list`.
* additional 'React Native Experimental' target in `/json/list`.
*
* In the launch flow, this allows targets to be matched directly by `appId`.
* In the launch flow, this allows targets to be matched directly by
* `logicalDeviceId`.
*/
nativePageReloads?: boolean,
@@ -53,6 +54,8 @@ export type TargetCapabilityFlags = $ReadOnly<{
export type PageFromDevice = $ReadOnly<{
id: string,
title: string,
/** Sent from modern targets only */
description?: string,
/** @deprecated This is sent from legacy targets only */
vm?: string,
app: string,
@@ -113,12 +116,14 @@ export type MessageToDevice =
export type PageDescription = $ReadOnly<{
id: string,
title: string,
appId: string,
description: string,
type: string,
devtoolsFrontendUrl: string,
webSocketDebuggerUrl: string,
// React Native specific fields
/** @deprecated Prefer `title` */
deviceName: string,
/** @deprecated This is sent from legacy targets only */
vm?: string,
@@ -20,6 +20,9 @@ import type {IncomingMessage, ServerResponse} from 'http';
import getDevToolsFrontendUrl from '../utils/getDevToolsFrontendUrl';
import url from 'url';
const LEGACY_SYNTHETIC_PAGE_TITLE =
'React Native Experimental (Improved Chrome Reloads)';
type Options = $ReadOnly<{
serverBaseUrl: string,
logger?: Logger,
@@ -32,8 +35,8 @@ type Options = $ReadOnly<{
/**
* Open the debugger frontend for a given CDP target.
*
* Currently supports Hermes targets, opening debugger websocket URL in Chrome
* DevTools.
* Currently supports React Native DevTools (rn_fusebox.html) and legacy Hermes
* (rn_inspector.html) targets.
*
* @see https://chromedevtools.github.io/devtools-protocol/
*/
@@ -61,6 +64,7 @@ export default function openDebuggerMiddleware({
launchId,
target: targetId,
}: {
/** @deprecated Will only match legacy Hermes targets */
appId?: string,
device?: string,
launchId?: string,
@@ -71,7 +75,7 @@ export default function openDebuggerMiddleware({
const targets = inspectorProxy.getPageDescriptions().filter(
// Only use targets with better reloading support
app =>
app.title === 'React Native Experimental (Improved Chrome Reloads)' ||
app.title === LEGACY_SYNTHETIC_PAGE_TITLE ||
app.reactNative.capabilities?.nativePageReloads === true,
);
@@ -92,7 +96,9 @@ export default function openDebuggerMiddleware({
target = targets.find(
_target =>
(targetId == null || _target.id === targetId) &&
(appId == null || _target.description === appId) &&
(appId == null ||
(_target.appId === appId &&
_target.title === LEGACY_SYNTHETIC_PAGE_TITLE)) &&
(device == null || _target.reactNative.logicalDeviceId === device),
);
} else if (targets.length > 0) {
@@ -132,6 +138,7 @@ export default function openDebuggerMiddleware({
{launchId, useFuseboxEntryPoint},
),
);
res.writeHead(200);
res.end();
break;
case 'redirect':
@@ -155,6 +162,7 @@ export default function openDebuggerMiddleware({
appId: appId ?? null,
deviceId: device ?? null,
resolvedTargetDescription: target.description,
resolvedTargetAppId: target.appId,
prefersFuseboxFrontend: useFuseboxEntryPoint ?? false,
});
return;
@@ -41,6 +41,7 @@ export type ReportableEvent =
appId: string | null,
deviceId: string | null,
resolvedTargetDescription: string,
resolvedTargetAppId: string,
prefersFuseboxFrontend: boolean,
}>
| ErrorResult<mixed>
+2 -2
View File
@@ -39,7 +39,7 @@ module.exports = {
overrides: [
{
files: ['*.js'],
parser: '@babel/eslint-parser',
parser: 'hermes-eslint',
plugins: ['ft-flow'],
rules: {
// Flow Plugin
@@ -51,7 +51,7 @@ module.exports = {
},
{
files: ['*.jsx'],
parser: '@babel/eslint-parser',
parser: 'hermes-eslint',
},
{
files: ['*.ts', '*.tsx'],
@@ -1,6 +1,6 @@
{
"name": "@react-native/eslint-config",
"version": "0.76.0-main",
"version": "0.77.0-main",
"description": "ESLint config for React Native",
"license": "MIT",
"repository": {
@@ -21,8 +21,7 @@
"main": "index.js",
"dependencies": {
"@babel/core": "^7.25.2",
"@babel/eslint-parser": "^7.25.1",
"@react-native/eslint-plugin": "0.76.0-main",
"@react-native/eslint-plugin": "0.77.0-main",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"eslint-config-prettier": "^8.5.0",
@@ -31,7 +30,8 @@
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-native": "^4.0.0"
"eslint-plugin-react-native": "^4.0.0",
"hermes-eslint": "0.24.0"
},
"peerDependencies": {
"eslint": ">=8",
@@ -12,7 +12,7 @@
const ESLintTester = require('eslint').RuleTester;
ESLintTester.setDefaultConfig({
parser: require.resolve('@babel/eslint-parser'),
parser: require.resolve('hermes-eslint'),
parserOptions: {
requireConfigFile: false,
ecmaVersion: 6,
@@ -1,6 +1,6 @@
{
"name": "@react-native/eslint-plugin",
"version": "0.76.0-main",
"version": "0.77.0-main",
"description": "ESLint rules for @react-native/eslint-config",
"license": "MIT",
"repository": {
@@ -16,8 +16,12 @@
"react-native"
],
"bugs": "https://github.com/facebook/react-native/issues",
"main": "index.js",
"devDependencies": {
"babel-plugin-syntax-hermes-parser": "0.24.0",
"hermes-eslint": "0.24.0"
},
"engines": {
"node": ">=18"
},
"main": "index.js"
}
}
@@ -12,13 +12,13 @@
const ESLintTester = require('eslint').RuleTester;
ESLintTester.setDefaultConfig({
parser: require.resolve('@babel/eslint-parser'),
parser: require.resolve('hermes-eslint'),
parserOptions: {
requireConfigFile: false,
ecmaVersion: 6,
sourceType: 'module',
babelOptions: {
presets: [require.resolve('@babel/preset-flow')],
presets: [require.resolve('babel-plugin-syntax-hermes-parser')],
},
},
});
+9 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/eslint-plugin-specs",
"version": "0.76.0-main",
"version": "0.77.0-main",
"description": "ESLint rules to validate NativeModule and Component Specs",
"license": "MIT",
"repository": {
@@ -18,9 +18,6 @@
"specs"
],
"bugs": "https://github.com/facebook/react-native/issues",
"engines": {
"node": ">=18"
},
"main": "index.js",
"scripts": {
"prepack": "node prepack.js",
@@ -28,12 +25,17 @@
},
"dependencies": {
"@babel/core": "^7.25.2",
"@babel/eslint-parser": "^7.25.1",
"@babel/plugin-transform-flow-strip-types": "^7.25.2",
"@babel/preset-flow": "^7.24.7",
"@react-native/codegen": "0.76.0-main",
"@react-native/codegen": "0.77.0-main",
"make-dir": "^2.1.0",
"pirates": "^4.0.1",
"source-map-support": "0.5.0"
},
"devDependencies": {
"babel-plugin-syntax-hermes-parser": "0.24.0",
"hermes-eslint": "0.24.0"
},
"engines": {
"node": ">=18"
}
}
+18 -3
View File
@@ -5,7 +5,22 @@
* LICENSE file in the root directory of this source tree.
*/
plugins {
alias(libs.plugins.kotlin.jvm).apply(false)
id("java-gradle-plugin")
plugins { alias(libs.plugins.kotlin.jvm).apply(false) }
tasks.register("build") {
dependsOn(
":react-native-gradle-plugin:build",
":settings-plugin:build",
":shared-testutil:build",
":shared:build",
)
}
tasks.register("clean") {
dependsOn(
":react-native-gradle-plugin:clean",
":settings-plugin:clean",
":shared-testutil:clean",
":shared:clean",
)
}
@@ -1,10 +1,10 @@
[versions]
agp = "8.6.0"
agp = "8.7.1"
gson = "2.8.9"
guava = "31.0.1-jre"
javapoet = "1.13.0"
junit = "4.13.2"
kotlin = "1.9.24"
kotlin = "2.0.21"
assertj = "3.25.1"
[libraries]
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-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.76.0-main",
"version": "0.77.0-main",
"description": "Gradle Plugin for React Native",
"license": "MIT",
"repository": {
@@ -6,6 +6,8 @@
*/
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
@@ -60,11 +62,12 @@ java { targetCompatibility = JavaVersion.VERSION_11 }
kotlin { jvmToolchain(17) }
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
apiVersion = "1.6"
compilerOptions {
apiVersion.set(KotlinVersion.KOTLIN_1_7)
// See comment above on JDK 11 support
jvmTarget = "11"
allWarningsAsErrors = true
jvmTarget.set(JvmTarget.JVM_11)
allWarningsAsErrors =
project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false
}
}
@@ -188,6 +188,7 @@ abstract class ReactExtension @Inject constructor(val project: Project) {
?.dependencies
?.values
?.filter { it.platforms?.android !== null }
?.filterNot { it.platforms?.android?.isPureCxxDependency == true }
?.forEach { deps ->
val nameCleansed = deps.nameCleansed
val dependencyConfiguration = deps.platforms?.android?.dependencyConfiguration
@@ -166,6 +166,10 @@ abstract class GenerateAutolinkingNewArchitecturesFileTask : DefaultTask() {
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)
# We set REACTNATIVE_MERGED_SO so libraries/apps can selectively decide to depend on either libreactnative.so
# or link against a old prefab target (this is needed for React Native 0.76 on).
set(REACTNATIVE_MERGED_SO true)
{{ libraryIncludes }}
set(AUTOLINKED_LIBRARIES
@@ -30,10 +30,19 @@ abstract class GeneratePackageListTask : DefaultTask() {
@TaskAction
fun taskAction() {
val model = JsonUtils.fromAutolinkingConfigJson(autolinkInputFile.get().asFile)
val model =
JsonUtils.fromAutolinkingConfigJson(autolinkInputFile.get().asFile)
?: error(
"""
RNGP - Autolinking: Could not parse autolinking config file:
${autolinkInputFile.get().asFile.absolutePath}
The file is either missing or not containing valid JSON so the build won't succeed.
"""
.trimIndent())
val packageName =
model?.project?.android?.packageName
model.project?.android?.packageName
?: error(
"RNGP - Autolinking: Could not find project.android.packageName in react-native config output! Could not autolink packages without this field.")
@@ -9,6 +9,8 @@ package com.facebook.react.tasks.internal
import com.facebook.react.utils.Os.unixifyPath
import com.facebook.react.utils.windowsAwareBashCommandLine
import java.io.File
import java.io.FileOutputStream
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.FileTree
import org.gradle.api.provider.Property
@@ -37,6 +39,15 @@ abstract class BuildCodegenCLITask : Exec() {
}
override fun exec() {
val logfile = "${project.layout.buildDirectory}/build-cli.log"
File(logfile).apply {
parentFile.mkdirs()
if (exists()) {
delete()
}
createNewFile()
}
standardOutput = FileOutputStream(logfile)
commandLine(
windowsAwareBashCommandLine(
codegenDir.asFile.get().canonicalPath.unixifyPath().plus(BUILD_SCRIPT_PATH),
@@ -30,13 +30,13 @@ abstract class PrepareGlogTask : DefaultTask() {
@TaskAction
fun taskAction() {
project.copy {
it.from(glogPath)
it.from(project.file("src/main/jni/third-party/glog/"))
it.include("glog-${glogVersion.get()}/src/**/*", "CMakeLists.txt", "config.h")
it.duplicatesStrategy = DuplicatesStrategy.WARN
it.includeEmptyDirs = false
it.filesMatching("**/*.h.in") { matchedFile ->
project.copy { action ->
action.from(glogPath)
action.from(project.file("src/main/jni/third-party/glog/"))
action.include("glog-${glogVersion.get()}/src/**/*", "CMakeLists.txt", "config.h")
action.duplicatesStrategy = DuplicatesStrategy.INCLUDE
action.includeEmptyDirs = false
action.filesMatching("**/*.h.in") { matchedFile ->
matchedFile.filter(
mapOf(
"tokens" to
@@ -60,20 +60,20 @@ abstract class PrepareGlogTask : DefaultTask() {
ReplaceTokens::class.java)
matchedFile.path = (matchedFile.name.removeSuffix(".in"))
}
it.into(outputDir)
action.into(outputDir)
}
val exportedDir = File(outputDir.asFile.get(), "exported/glog/").apply { mkdirs() }
project.copy {
it.from(outputDir)
it.include(
project.copy { action ->
action.from(outputDir)
action.include(
"stl_logging.h",
"logging.h",
"raw_logging.h",
"vlog_is_on.h",
"**/src/glog/log_severity.h")
it.eachFile { file -> file.path = file.name }
it.includeEmptyDirs = false
it.into(exportedDir)
action.eachFile { file -> file.path = file.name }
action.includeEmptyDirs = false
action.into(exportedDir)
}
}
}
@@ -43,6 +43,9 @@ internal object NdkConfiguratorUtils {
if (cmakeArgs.none { it.startsWith("-DPROJECT_BUILD_DIR") }) {
cmakeArgs.add("-DPROJECT_BUILD_DIR=${project.layout.buildDirectory.get().asFile}")
}
if (cmakeArgs.none { it.startsWith("-DPROJECT_ROOT_DIR") }) {
cmakeArgs.add("-DPROJECT_ROOT_DIR=${project.rootProject.layout.projectDirectory.asFile}")
}
if (cmakeArgs.none { it.startsWith("-DREACT_ANDROID_DIR") }) {
cmakeArgs.add(
"-DREACT_ANDROID_DIR=${extension.reactNativeDir.file("ReactAndroid").get().asFile}")
@@ -189,6 +189,44 @@ class ReactExtensionTest {
assertThat(deps).isEmpty()
}
@Test
fun getGradleDependenciesToApply_withIsPureCxxDeps_filtersCorrectly() {
val validJsonFile =
createJsonFile(
"""
{
"reactNativeVersion": "1000.0.0",
"dependencies": {
"@react-native/oss-library-example": {
"root": "./node_modules/@react-native/android-example",
"name": "@react-native/android-example",
"platforms": {
"android": {
"sourceDir": "src/main/java",
"packageImportPath": "com.facebook.react"
}
}
},
"@react-native/another-library-for-testing": {
"root": "./node_modules/@react-native/cxx-testing",
"name": "@react-native/cxx-testing",
"platforms": {
"android": {
"sourceDir": "src/main/java",
"packageImportPath": "com.facebook.react",
"isPureCxxDependency": true
}
}
}
}
}
"""
.trimIndent())
val deps = getGradleDependenciesToApply(validJsonFile)
assertThat(deps).containsExactly("implementation" to ":react-native_android-example")
}
private fun createJsonFile(@Language("JSON") input: String) =
tempFolder.newFile().apply { writeText(input) }
}
@@ -115,6 +115,10 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)
# We set REACTNATIVE_MERGED_SO so libraries/apps can selectively decide to depend on either libreactnative.so
# or link against a old prefab target (this is needed for React Native 0.76 on).
set(REACTNATIVE_MERGED_SO true)
set(AUTOLINKED_LIBRARIES
@@ -137,6 +141,10 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)
# We set REACTNATIVE_MERGED_SO so libraries/apps can selectively decide to depend on either libreactnative.so
# or link against a old prefab target (this is needed for React Native 0.76 on).
set(REACTNATIVE_MERGED_SO true)
add_subdirectory(./a/directory/ aPackage_autolinked_build)
add_subdirectory(./another/directory/ anotherPackage_autolinked_build)
add_subdirectory(./another/directory/cxx/ anotherPackage_cxxmodule_autolinked_build)
@@ -6,6 +6,8 @@
*/
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
@@ -50,11 +52,12 @@ java { targetCompatibility = JavaVersion.VERSION_11 }
kotlin { jvmToolchain(17) }
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
apiVersion = "1.6"
compilerOptions {
apiVersion.set(KotlinVersion.KOTLIN_1_7)
// See comment above on JDK 11 support
jvmTarget = "11"
allWarningsAsErrors = true
jvmTarget.set(JvmTarget.JVM_11)
allWarningsAsErrors =
project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false
}
}
@@ -6,6 +6,8 @@
*/
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { alias(libs.plugins.kotlin.jvm) }
@@ -21,10 +23,12 @@ java { targetCompatibility = JavaVersion.VERSION_11 }
kotlin { jvmToolchain(17) }
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
apiVersion = "1.6"
jvmTarget = "11"
allWarningsAsErrors = true
compilerOptions {
apiVersion.set(KotlinVersion.KOTLIN_1_7)
// See comment above on JDK 11 support
jvmTarget.set(JvmTarget.JVM_11)
allWarningsAsErrors =
project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false
}
}
@@ -6,6 +6,8 @@
*/
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { alias(libs.plugins.kotlin.jvm) }
@@ -27,10 +29,12 @@ java { targetCompatibility = JavaVersion.VERSION_11 }
kotlin { jvmToolchain(17) }
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
apiVersion = "1.6"
jvmTarget = "11"
allWarningsAsErrors = true
compilerOptions {
apiVersion.set(KotlinVersion.KOTLIN_1_7)
// See comment above on JDK 11 support
jvmTarget.set(JvmTarget.JVM_11)
allWarningsAsErrors =
project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false
}
}
@@ -21,8 +21,23 @@ object JsonUtils {
}
fun fromAutolinkingConfigJson(input: File): ModelAutolinkingConfigJson? =
input.bufferedReader().use {
runCatching { gsonConverter.fromJson(it, ModelAutolinkingConfigJson::class.java) }
input.bufferedReader().use { reader ->
runCatching {
// We sanitize the output of the `config` command as it could contain debug logs
// such as:
//
// > AwesomeProject@0.0.1 npx
// > rnc-cli config
//
// which will render the JSON invalid.
val content =
reader
.readLines()
.filterNot { line -> line.startsWith(">") }
.joinToString("\n")
.trim()
gsonConverter.fromJson(content, ModelAutolinkingConfigJson::class.java)
}
.getOrNull()
}
}
@@ -186,6 +186,54 @@ class JsonUtilsTest {
assertThat("implementation").isEqualTo(parsed.project!!.android!!.dependencyConfiguration)
}
@Test
fun fromAutolinkingConfigJson_withInfoLogs_sanitizeAndParseIt() {
@Suppress("JsonStandardCompliance")
val validJson =
createJsonFile(
"""
> AwesomeProject@0.0.1 npx
> rnc-cli config
{
"reactNativeVersion": "1000.0.0",
"project": {
"ios": {
"sourceDir": "./packages/rn-tester",
"xcodeProject": {
"name": "RNTesterPods.xcworkspace",
"isWorkspace": true
},
"automaticPodsInstallation": false
},
"android": {
"sourceDir": "./packages/rn-tester",
"appName": "RN-Tester",
"packageName": "com.facebook.react.uiapp",
"applicationId": "com.facebook.react.uiapp",
"mainActivity": ".RNTesterActivity",
"watchModeCommandParams": [
"--mode HermesDebug"
],
"dependencyConfiguration": "implementation"
}
}
}
"""
.trimIndent())
val parsed = JsonUtils.fromAutolinkingConfigJson(validJson)!!
assertThat("./packages/rn-tester").isEqualTo(parsed.project!!.android!!.sourceDir)
assertThat("RN-Tester").isEqualTo(parsed.project!!.android!!.appName)
assertThat("com.facebook.react.uiapp").isEqualTo(parsed.project!!.android!!.packageName)
assertThat("com.facebook.react.uiapp").isEqualTo(parsed.project!!.android!!.applicationId)
assertThat(".RNTesterActivity").isEqualTo(parsed.project!!.android!!.mainActivity)
assertThat("--mode HermesDebug")
.isEqualTo(parsed.project!!.android!!.watchModeCommandParams!![0])
assertThat("implementation").isEqualTo(parsed.project!!.android!!.dependencyConfiguration)
}
@Test
fun fromAutolinkingConfigJson_withDependenciesSpecified_canParseIt() {
val validJson =
+1 -2
View File
@@ -14,10 +14,9 @@ import {
StatusBar,
StyleSheet,
Text,
useColorScheme,
View,
useColorScheme,
} from 'react-native';
import {Colors, Header} from 'react-native/Libraries/NewAppScreen';
function App(): React.JSX.Element {
@@ -16,6 +16,7 @@ import com.facebook.react.ReactPackage
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.soloader.OpenSourceMergedSoMapping
import com.facebook.soloader.SoLoader
class MainApplication : Application(), ReactApplication {
@@ -41,7 +42,7 @@ class MainApplication : Application(), ReactApplication {
override fun onCreate() {
super.onCreate()
SoLoader.init(this, false)
SoLoader.init(this, OpenSourceMergedSoMapping)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
+1 -1
View File
@@ -12,7 +12,7 @@ buildscript {
compileSdkVersion = 35
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.24"
kotlinVersion = "2.0.21"
}
repositories {
google()
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
+5 -6
View File
@@ -1,6 +1,6 @@
{
"name": "helloworld",
"version": "0.76.0-main",
"version": "0.77.0-main",
"private": true,
"scripts": {
"bootstrap": "node ./cli.js bootstrap",
@@ -19,11 +19,10 @@
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native/babel-preset": "0.76.0-main",
"@react-native/core-cli-utils": "0.76.0-main",
"@react-native/eslint-config": "0.76.0-main",
"@react-native/metro-config": "0.76.0-main",
"babel-jest": "^29.6.3",
"@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",
"chalk": "^4.1.2",
"commander": "^12.0.0",
"eslint": "^8.19.0",
@@ -1,6 +1,6 @@
{
"name": "@react-native/hermes-inspector-msggen",
"version": "0.76.0-main",
"version": "0.77.0-main",
"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.76.0-main",
"version": "0.77.0-main",
"description": "Metro configuration for React Native.",
"license": "MIT",
"repository": {
@@ -26,9 +26,9 @@
"dist"
],
"dependencies": {
"@react-native/js-polyfills": "0.76.0-main",
"@react-native/metro-babel-transformer": "0.76.0-main",
"metro-config": "^0.80.10",
"metro-runtime": "^0.80.10"
"@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"
}
}
+2
View File
@@ -13,6 +13,8 @@ import type {ConfigT} from 'metro-config';
import {getDefaultConfig as getBaseConfig, mergeConfig} from 'metro-config';
export type {MetroConfig} from 'metro-config';
const INTERNAL_CALLSITES_REGEX = new RegExp(
[
'/Libraries/BatchedBridge/MessageQueue\\.js$',
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/normalize-colors",
"version": "0.76.0-main",
"version": "0.77.0-main",
"description": "Color normalization for React Native.",
"license": "MIT",
"repository": {

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