Commit Graph
8994 Commits
Author SHA1 Message Date
Nick GerlemanandFacebook GitHub Bot 1e5cc693fc Add equality operators to CSS data types (#48989)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48989

tsia

Also added a quick helper to CSSColor used later.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D68741768

fbshipit-source-id: e0b4c75c15891e4957c7e05a7a89820c1bea72c3
2025-02-03 16:04:07 -08:00
Riccardo CipolleschiandFacebook GitHub Bot 870aca62de Remove references of CircleCI from the readme (#49120)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49120

This change removes any reference of CircleCI from the READMEs in React Native

## Changelog
[Internal] - Remove CircleCI references

Reviewed By: cortinico, huntie

Differential Revision: D69047437

fbshipit-source-id: 602350372c1d869098be0c8da7cb3db2077474d8
2025-02-03 10:02:19 -08:00
Riccardo CipolleschiandFacebook GitHub Bot 6c6d3413cf Remove CircleCI references from gradle and android (#49118)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49118

We finished the migration away from CircleCI, so we are cleaning up the codebase.

This change updates references to CircleCI from gradle.

## Changelog:
[Internal] - Remove references from CircleCI in RNGP

Reviewed By: cortinico

Differential Revision: D69047484

fbshipit-source-id: 4ab40be62e6769eb3a8f65136464eed6628d47a4
2025-02-03 10:02:19 -08:00
Nicola CortiandFacebook GitHub Bot e0da0fe710 Convert com.facebook.react.devsupport.PausedInDebuggerOverlayDialogManager to Kotlin (#49088)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49088

Just another Kotlin migration for the devsupport package.

Changelog:
[Internal] [Changed] -

Reviewed By: huntie

Differential Revision: D68954221

fbshipit-source-id: 40dd1227f6cd042b1ea47b1e5b77347a3cdcb136
2025-02-03 09:41:20 -08:00
Rubén NorteandFacebook GitHub Bot 7e12060420 Move Fantom-related specs to src/private/testing/fantom/specs (#49101)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49101

Changelog: [internal]

We can move this out of the deprecated directory. Also added a `.npmignore` entry so this won't be published to npm with the package.

Reviewed By: lenaic

Differential Revision: D68896208

fbshipit-source-id: ec85236aeeabdc9abcd870f0f4c1322eeb3cc659
2025-02-03 09:15:31 -08:00
Rubén NorteandFacebook GitHub Bot 2f27327f33 Rename src/private/specs as src/private/specs_DEPRECATED (#49068)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49068

Changelog: [internal]

Renamed directory to better signal it's deprecated and added README.md to clarify intent.

Reviewed By: huntie

Differential Revision: D68895998

fbshipit-source-id: 5bc70d0782194db27c27cc89cc402d99f11aafa4
2025-02-03 09:15:31 -08:00
Rubén NorteandFacebook GitHub Bot c8ecc32ece Move geometry to its own directory outside dom (#49100)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49100

Changelog: [internal]

This API isn't part of the DOM standard so can be moved out.

Reviewed By: huntie

Differential Revision: D68896484

fbshipit-source-id: 5d275beb909ce5c5ce0eddb6c6e04cf7491aa1cb
2025-02-03 09:15:31 -08:00
Mateo GuzmánandFacebook GitHub Bot 1a67214a3a Make SystraceRequestListener internal (#49107)
Summary:
As part of the initiative to reduce the public API surface, this class can be internalized. I've checked there are [no relevant OSS usages](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+com.facebook.react.modules.fresco.SystraceRequestListener).

## Changelog:

[INTERNAL] - Make com.facebook.react.modules.fresco.SystraceRequestListener internal

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

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

Reviewed By: cortinico

Differential Revision: D69046100

Pulled By: javache

fbshipit-source-id: 0cb4c6eda385f458c3e4b02068ce77f2dd15af23
2025-02-03 08:15:25 -08:00
kirillzyuskoandFacebook GitHub Bot 243aecc095 fix: avoid ConcurrentModificationException (#49109)
Summary:
Fixes a `ConcurrentModificationException` when iterating over `TextWatcher` `mListeners` array.

If you open Android open source code (`TextView` class), then we can see that Android iterates with `for/n` loop (not `for/:`):

```java
    void sendAfterTextChanged(Editable text) {
        if (mListeners != null) {
            final ArrayList<TextWatcher> list = mListeners;
            final int count = list.size();
            for (int i = 0; i < count; i++) {
                list.get(i).afterTextChanged(text);
            }
        }

        notifyListeningManagersAfterTextChanged();

        hideErrorIfUnchanged();
    }
```

<hr>

We can catch the `ConcurrentModificationException` with old code, when for example we have 3 listeners:

- 0 is `EmojiTextWatcher` (seems like it's added by OS);
- 1 is `OnlyChangeIfRequiredMaskedTextChangedListener` (added by `react-native-text-input-mask`);
- 2 is a listener that attached by `react-native-keyboard-controller`.

On every afterTextChanged [input-mask-android](https://github.com/RedMadRobot/input-mask-android/tree/df452edc0c52a37e5082adcfc3d05d77b5aa34e8) [removes](https://github.com/RedMadRobot/input-mask-android/blob/df452edc0c52a37e5082adcfc3d05d77b5aa34e8/inputmask/src/main/kotlin/com/redmadrobot/inputmask/MaskedTextChangedListener.kt#L212) the listener and [adds](https://github.com/RedMadRobot/input-mask-android/blob/df452edc0c52a37e5082adcfc3d05d77b5aa34e8/inputmask/src/main/kotlin/com/redmadrobot/inputmask/MaskedTextChangedListener.kt#L231) it back.

The oversimplified version of the code can be next:

```java
public class MyClass {
    public static void main(String args[]) {
        ArrayList<Integer> mListeners = new ArrayList<>();
        mListeners.add(0);
        mListeners.add(1);
        mListeners.add(2);

        Iterator<Integer> iterator = mListeners.iterator();

        while (iterator.hasNext()) {
            Integer listener = iterator.next();

            // Check if the listener is equal to 1
            // 1 is OnlyChangeIfRequiredMaskedTextChangedListener and we simulate the behavior of this class
            if (listener == 1) {
                int i = mListeners.indexOf(listener);

                if (i >= 0) {
                    mListeners.remove(i);
                }

                // Add the removed element at the end
                mListeners.add(listener);
            }
        }

        // Print the modified list
        System.out.println(mListeners);
    }
}
```

Key points are:
- if we have only [0, 1] listener, then it works well and `ConcurrentModificationException` will not be thrown, because we modify last element;
- if we have `[0, 1, 2]` then exception will be thrown.

So in this PR I decided to re-work code to match what Android has. With `for/n` approach `ConcurrentModificationException` will not be thrown, because we don't check array immutability in this case.

More information also can be found here: https://github.com/kirillzyusko/react-native-keyboard-controller/issues/324

## Changelog:

[ANDROID] [CHANGED] - avoid `ConcurrentModificationException` when iterating over `mListeners` `TextWatcher` array

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

Reviewed By: cortinico

Differential Revision: D69050984

Pulled By: javache

fbshipit-source-id: 9c6a7a428467fa5e546d70549dfcc91d6b2e58d2
2025-02-03 07:27:58 -08:00
Alex HuntandFacebook GitHub Bot 880fd927a9 Remove internal XHRInterceptor API (#49132)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49132

Follows D68780147 and D68953084. We're able to safely remove this API by relocating the implementation into the one dependent internal test call site.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D69049203

fbshipit-source-id: 82c4b15d7f6736aed21171eeec1c197d2f34b33e
2025-02-03 06:56:08 -08:00
Riccardo CipolleschiandFacebook GitHub Bot 3bd3f101b9 Be less strict with method parsing of TurboModule Interop Layer (#49072)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49072

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

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

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

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

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

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

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

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

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

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

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

Reviewed By: javache

Differential Revision: D68901734

fbshipit-source-id: 844d1bf29423d5c601b583540e86d57dfffd1428
2025-02-03 06:50:05 -08:00
Pieter De BaetsandFacebook GitHub Bot e5ba5791b2 Enable -Wundef for react-native targets (#49041)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49041

Prevent the class of issues seen in D68797482 by making `#if FOO` where `FOO` is not defined an error.

Changelog: [Internal]

Reviewed By: NickGerleman, sammy-SC

Differential Revision: D68824244

fbshipit-source-id: 1291c5f2f84ecb023ba76a015716cc7c9ae0f89e
2025-02-03 06:29:28 -08:00
Pieter De BaetsandFacebook GitHub Bot 4799463435 Fix incorrect noexcept attributes (#49127)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49127

These tests are marked as noexcept, but they can indeed throw exceptions: they trigger synchronous commits, which may cause exceptions in the mounting layer.

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D69049587

fbshipit-source-id: 02c6187c8d0e043c9840aad9c9e4d27866898b4a
2025-02-03 06:15:36 -08:00
Oskar KwaśniewskiandFacebook GitHub Bot ae59702f8e fix(iOS): bring back enableFixForViewCommandRace feature flag (#49126)
Summary:
As pointed out by RyanCommits the ReactNativeFactory PR removed `enableFixForViewCommandRace` feature flag by mistake. Reference: https://github.com/facebook/react-native/pull/46298/files

This PR re-adds the feature flag.

## Changelog:

[IOS] [FIXED] - Re-enable enableFixForViewCommandRace feature flag

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

Test Plan: Not needed, the feature flag was there before refactor.

Reviewed By: huntie

Differential Revision: D69049668

Pulled By: cipolleschi

fbshipit-source-id: b7bf382c76878e72619145283fa8cc2c1046b486
2025-02-03 06:12:12 -08:00
Alex HuntandFacebook GitHub Bot fb493fd72d Restore XMLHttpRequest setInterceptor API, rename as DO_NOT_USE (#49081)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49081

Follows D68780147. We are depending on this API in one internal E2E test. Rename as `__setInterceptor_DO_NOT_USE`.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D68953084

fbshipit-source-id: 66b685a90b6e7f18646752dc90892963d16f9a83
2025-02-03 05:55:53 -08:00
Jakub PiaseckiandFacebook GitHub Bot 8d90be814e Refactor ActionSheetIOS to better align with OSS types (#49094)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49094

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D68957719

fbshipit-source-id: 4e4738a619583000ea6fe78808d46e300428504a
2025-02-03 04:47:06 -08:00
Alex HuntandFacebook GitHub Bot 71ad6369ce Remove unused nativeNetworkInspection flag, clarify static experiment key (#49096)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49096

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D68958813

fbshipit-source-id: d2222e8bcc1bc0664cf93d9017a796016ee270a2
2025-02-03 04:10:18 -08:00
Alex HuntandFacebook GitHub Bot e1575857dd Relocate babel-register script (#49102)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49102

Moves this script one level up. In the next diff, will be used to support execution of scripts themselves, as well as `packages/`.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D68960279

fbshipit-source-id: 7b62420c269dc1c1366ac9a827db078d34cb86c5
2025-02-03 03:49:23 -08:00
Mateo GuzmánandFacebook GitHub Bot 3a5e217df6 Add CountingOutputStream tests (#49058)
Summary:
Working on migrating some of the com.facebook.react.modules.network classes to Kotlin, I'm creating some test cases here for `CountingOutputStream` before migrating that class.

## Changelog:

[INTERNAL] - Add CountingOutputStream tests

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

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

Reviewed By: cortinico

Differential Revision: D68903427

Pulled By: rshest

fbshipit-source-id: f71926cf526a65b2434aaa762007e0b4ca5dd1a4
2025-02-03 03:43:55 -08:00
Nicola CortiandFacebook GitHub Bot bdbd0fa0ca Convert com.facebook.react.devsupport.IInspectorPackagerConnection to Kotlin (#49092)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49092

Just another Kotlin migration for the devsupport package.

Changelog:
[Internal] [Changed] -

Reviewed By: huntie

Differential Revision: D68954220

fbshipit-source-id: fbdf391152578ba5cc0b0a9b303a5a6700bfdb0e
2025-02-03 01:47:18 -08:00
Nicola CortiandFacebook GitHub Bot 17f7bf3773 Convert com.facebook.react.devsupport.HMRClient to Kotlin (#49089)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49089

Just another Kotlin migration for the devsupport package.

Changelog:
[Internal] [Changed] -

Reviewed By: tdn120

Differential Revision: D68954223

fbshipit-source-id: 6dd6e33ade211a6df2eea7a8dd761cc427bfd5c3
2025-02-03 01:47:18 -08:00
Edmond ChuiandFacebook GitHub Bot e45883e44f enable Network.enable behind feature flag (#49098)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49098

Changelog: [Internal][Added] enable Network.enable behind feature flag (in preparation for Network Panel)

Respond to `Network.enable` calls. Params are currently not supported. https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-enable

Reviewed By: huntie

Differential Revision: D68959142

fbshipit-source-id: 78a195979c39b1199be2fd8f9bdcfe4fe51dd6dd
2025-01-31 19:28:45 -08:00
Nicola CortiandFacebook GitHub Bot 4523fdd932 Internalize com.facebook.react.devsupport.inspector (#49086)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49086

Making all the classes inside `com.facebook.react.devsupport.inspector` internal.
Those should have not been exposed in the first place.

I've verified that there are no usages for those clases in OSS:
https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+%22import+com.facebook.react.devsupport.inspector.%22

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D68954014

fbshipit-source-id: 02e0ab566977383105d5d42336123335309cfc34
2025-01-31 12:49:45 -08:00
Intl SchedulerandFacebook GitHub Bot cc74db2bba translation auto-update for Apps/Wilde/scripts/intl-config.json on master
Summary:
Chronos Job Instance ID: 1125907955550893
Sandcastle Job Instance ID: 1654683818
allow-large-files
ignore-conflict-markers
opt-out-review
drop-conflicts

Differential Revision: D68971915

fbshipit-source-id: c58b74d0998bd485dcd608defee0948409a503b4
2025-01-31 12:00:18 -08:00
Thomas NardoneandFacebook GitHub Bot 7cfb19e7e3 Add ReactBuildConfig.ENABLE_PERFETTO (#48981)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48981

Add entry for this flag in ReactBuildConfig

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D68725330

fbshipit-source-id: afce4093665ba0c78f4630ab412297219f65d157
2025-01-31 10:02:12 -08:00
Mateo GuzmánandFacebook GitHub Bot 491ede6404 Migrate com.facebook.react.packagerconnection interfaces to Kotlin (#49025)
Summary:
Migrate com.facebook.react.packagerconnection interfaces to Kotlin. Also, moving to `org.mockito.kotlin` instead of `org.mockito.Mockito` for JSPackagerClientTest to make it compatible with the migrated files.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.packagerconnection interfaces to Kotlin

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

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

Reviewed By: cortinico, Abbondanzo

Differential Revision: D68842336

Pulled By: tdn120

fbshipit-source-id: c3062675b5535277970fd97490720739fc748f2a
2025-01-31 09:19:52 -08:00
Nicola CortiandFacebook GitHub Bot d37a8d2830 Convert com.facebook.react.devsupport.inspector to Kotlin (#49087)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49087

I'm moving the whole module to be in Kotlin and updating the BUCK file.
Those files also have 0 usages in OSS so not a breaking change.

Changelog:
[Internal] [Changed] -

Reviewed By: robhogan

Differential Revision: D68953731

fbshipit-source-id: d8238bf805661cbdd6fb070a60f3e32b44ec9832
2025-01-31 07:50:28 -08:00
Jakub PiaseckiandFacebook GitHub Bot c3ea606660 Align TextInput types with TypeScript (#48972)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48972

Changelog: [Internal]

Align TextInput types with TypeScript definitions.

Reviewed By: huntie

Differential Revision: D68713179

fbshipit-source-id: bb36d9333e45f2a30db91a17b8698b34cd792eb6
2025-01-31 04:54:42 -08:00
Jakub PiaseckiandFacebook GitHub Bot e815fdae53 Align TextInput event types with TypeScript (#48971)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48971

Changelog: [Internal]

Mosltly align event types of TextInput components with TypeScript definitions.

Reviewed By: mellyeliu, thatmichael85

Differential Revision: D68713180

fbshipit-source-id: d8e9c0458466ef492fecf516fd58bc5459b35e26
2025-01-31 04:54:42 -08:00
Alex HuntandFacebook GitHub Bot 21541b51b3 Apply stripPrivateProperties transform to public-api-test (#49064)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49064

Update `public-api-test` to disregard all object/type members prefixed with an underscore (`_`). These are considered existing internal APIs.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D68895376

fbshipit-source-id: db581df7cc37802fa5f7d3aa4d7c07514223209a
2025-01-31 04:27:13 -08:00
Rubén NorteandFacebook GitHub Bot 3d4906e7ec Optimize data structure to store listeners in EventTarget (#48964)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48964

Changelog: [internal]

This replaces the data structure used to store listeners in `EventTarget`, from a map of arrays to a map of maps.

This essentially optimizes listener registration/deregistraton at the expense of event dispatching. Given that it'll be common to have many nodes registering to events that are never dispatched, this might be the right trade-off.

* Before:

| (index) | Task name                                                             | Latency average (ns)  | Latency median (ns)    | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | --------------------------------------------------------------------- | --------------------- | ---------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'dispatchEvent, no bubbling, no listeners'                            | '4624.68 ± 0.49%'     | '4570.00'              | '218089 ± 0.02%'           | '218818'                  | 216232  |
| 1       | 'dispatchEvent, no bubbling, single listener'                         | '5771.34 ± 0.99%'     | '5670.00'              | '175389 ± 0.02%'           | '176367'                  | 173270  |
| 2       | 'dispatchEvent, no bubbling, multiple listeners'                      | '48207.35 ± 1.18%'    | '47290.00'             | '20964 ± 0.04%'            | '21146'                   | 20744   |
| 3       | 'dispatchEvent, bubbling, no listeners'                               | '185005.29 ± 0.16%'   | '184060.00'            | '5410 ± 0.05%'             | '5433'                    | 5406    |
| 4       | 'dispatchEvent, bubbling, single listener per target'                 | '286630.57 ± 0.11%'   | '285560.00'            | '3491 ± 0.06%'             | '3502'                    | 3489    |
| 5       | 'dispatchEvent, bubbling, multiple listeners per target'              | '4435944.62 ± 0.27%'  | '4425840.00 ± 30.00'   | '226 ± 0.12%'              | '226'                     | 1000    |
| 6       | 'addEventListener, one listener'                                      | '1734.88 ± 0.57%'     | '1670.00'              | '594938 ± 0.01%'           | '598802'                  | 576411  |
| 7       | 'addEventListener, one target, one type, multiple listeners'          | '266031.11 ± 0.68%'   | '261810.00'            | '3781 ± 0.15%'             | '3820'                    | 3759    |
| 8       | 'addEventListener, one target, multiple types, one listener per type' | '124768.56 ± 0.39%'   | '121160.00'            | '8112 ± 0.16%'             | '8254'                    | 8015    |
| 9       | 'addEventListener, one target, multiple types, multiple listeners'    | '27141326.31 ± 0.15%' | '27298945.00 ± 115.00' | '37 ± 0.15%'               | '37'                      | 1000    |
| 10      | 'addEventListener, multiple targets, one type, one listener'          | '142646.24 ± 0.49%'   | '137460.00'            | '7123 ± 0.19%'             | '7275'                    | 7011    |

* After:

| (index) | Task name                                                             | Latency average (ns)  | Latency median (ns)   | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | --------------------------------------------------------------------- | --------------------- | --------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'dispatchEvent, no bubbling, no listeners'                            | '4518.27 ± 0.51%'     | '4460.00'             | '223269 ± 0.02%'           | '224215'                  | 221324  |
| 1       | 'dispatchEvent, no bubbling, single listener'                         | '6563.10 ± 0.98%'     | '6450.00'             | '154311 ± 0.02%'           | '155039'                  | 152367  |
| 2       | 'dispatchEvent, no bubbling, multiple listeners'                      | '65429.69 ± 0.25%'    | '64840.00'            | '15330 ± 0.05%'            | '15423'                   | 15284   |
| 3       | 'dispatchEvent, bubbling, no listeners'                               | '181104.21 ± 0.13%'   | '180300.00'           | '5525 ± 0.05%'             | '5546'                    | 5522    |
| 4       | 'dispatchEvent, bubbling, single listener per target'                 | '367231.05 ± 0.10%'   | '366035.00 ± 5.00'    | '2724 ± 0.07%'             | '2732'                    | 2724    |
| 5       | 'dispatchEvent, bubbling, multiple listeners per target'              | '6269141.58 ± 0.24%'  | '6253275.00 ± 155.00' | '160 ± 0.11%'              | '160'                     | 1000    |
| 6       | 'addEventListener, one listener'                                      | '1665.23 ± 0.51%'     | '1610.00'             | '618122 ± 0.01%'           | '621118'                  | 600517  |
| 7       | 'addEventListener, one target, one type, multiple listeners'          | '97724.12 ± 1.34%'    | '94640.00'            | '10433 ± 0.14%'            | '10566'                   | 10233   |
| 8       | 'addEventListener, one target, multiple types, one listener per type' | '116915.60 ± 0.54%'   | '113380.00'           | '8707 ± 0.17%'             | '8820'                    | 8554    |
| 9       | 'addEventListener, one target, multiple types, multiple listeners'    | '12276537.38 ± 0.42%' | '11924070.00 ± 10.00' | '82 ± 0.35%'               | '84'                      | 1000    |
| 10      | 'addEventListener, multiple targets, one type, one listener'          | '133307.67 ± 0.58%'   | '128340.00'           | '7666 ± 0.20%'             | '7792'                    | 7502    |

Reviewed By: rshest

Differential Revision: D68671944

fbshipit-source-id: 1a555ba9400e5830b4a56cdf12fd9418cd4a2a4f
2025-01-31 04:00:31 -08:00
Rubén NorteandFacebook GitHub Bot 1f8ace8cce Expand benchmarks for EventTarget to include perf for addEventListener (#49070)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49070

Changelog: [internal]

Adds benchmarks for `addEventListener` in benchmark file for `EventTarget`.

Baseline:

| (index) | Task name                                                             | Latency average (ns)  | Latency median (ns)    | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | --------------------------------------------------------------------- | --------------------- | ---------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'dispatchEvent, no bubbling, no listeners'                            | '4624.68 ± 0.49%'     | '4570.00'              | '218089 ± 0.02%'           | '218818'                  | 216232  |
| 1       | 'dispatchEvent, no bubbling, single listener'                         | '5771.34 ± 0.99%'     | '5670.00'              | '175389 ± 0.02%'           | '176367'                  | 173270  |
| 2       | 'dispatchEvent, no bubbling, multiple listeners'                      | '48207.35 ± 1.18%'    | '47290.00'             | '20964 ± 0.04%'            | '21146'                   | 20744   |
| 3       | 'dispatchEvent, bubbling, no listeners'                               | '185005.29 ± 0.16%'   | '184060.00'            | '5410 ± 0.05%'             | '5433'                    | 5406    |
| 4       | 'dispatchEvent, bubbling, single listener per target'                 | '286630.57 ± 0.11%'   | '285560.00'            | '3491 ± 0.06%'             | '3502'                    | 3489    |
| 5       | 'dispatchEvent, bubbling, multiple listeners per target'              | '4435944.62 ± 0.27%'  | '4425840.00 ± 30.00'   | '226 ± 0.12%'              | '226'                     | 1000    |
| 6       | 'addEventListener, one listener'                                      | '1734.88 ± 0.57%'     | '1670.00'              | '594938 ± 0.01%'           | '598802'                  | 576411  |
| 7       | 'addEventListener, one target, one type, multiple listeners'          | '266031.11 ± 0.68%'   | '261810.00'            | '3781 ± 0.15%'             | '3820'                    | 3759    |
| 8       | 'addEventListener, one target, multiple types, one listener per type' | '124768.56 ± 0.39%'   | '121160.00'            | '8112 ± 0.16%'             | '8254'                    | 8015    |
| 9       | 'addEventListener, one target, multiple types, multiple listeners'    | '27141326.31 ± 0.15%' | '27298945.00 ± 115.00' | '37 ± 0.15%'               | '37'                      | 1000    |
| 10      | 'addEventListener, multiple targets, one type, one listener'          | '142646.24 ± 0.49%'   | '137460.00'            | '7123 ± 0.19%'             | '7275'                    | 7011    |

Reviewed By: lenaic

Differential Revision: D68708145

fbshipit-source-id: b3f2f1f9e239856dcc9d8e699edf4ed2ada404dd
2025-01-31 04:00:31 -08:00
Nicola CortiandFacebook GitHub Bot 64c2a52ca9 Remove unnecessary public keyword (#49062)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49062

Another round of cleanup for the `public` keyword that I found around.
Those are unnecessary here as those classes are `internal` and we should remove them.

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D68894182

fbshipit-source-id: 6f7bac6051e17785a1bfb0d544950250429c71cb
2025-01-30 14:13:57 -08:00
Nicola CortiandFacebook GitHub Bot 9afa3596cb Make DevSettingsActivity internal (#49073)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49073

This activity should be internal as it's exposed by ReactNative's Debug Manifest.
No need to have it public. I checked that there are no OSS usages of it:

https://www.google.com/url?q=https://github.com/search?type%3Dcode%26q%3DNOT%2Bis%253Afork%2BNOT%2Borg%253Afacebook%2BNOT%2Brepo%253Areact-native-tvos%252Freact-native-tvos%2BNOT%2Brepo%253Anuagoz%252Freact-native%2BNOT%2Brepo%253A2lambda123%252Freact-native%2BNOT%2Brepo%253Apvinis%252Freact-native---investigation%2BNOT%2Brepo%253Abeanchips%252Ffacebookreactnative%2BNOT%2Brepo%253AfabOnReact%252Freact-native-notes%2BNOT%2Buser%253Ahuntie%2Bcom.facebook.react.devsupport.DevSettingsActivity&sa=D&source=editors&ust=1738261498882961&usg=AOvVaw295OXKV-8dAbdsMTY5usSx

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D68904656

fbshipit-source-id: b98b417e60a3e8ebba0c9946959ee43ea963b066
2025-01-30 12:21:54 -08:00
Alex HuntandFacebook GitHub Bot 9ba4dd81db Delete Libraries/JSInspector (#49019)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49019

Removes the `JSInspector` class and its dependencies.

- This was related to the legacy `ReactCommon/inspector/` subsystem (D4021490) — which added a compat layer from JavaScriptCore to CDP for an earlier version of Chrome debugging.
- The JS components of this system (`JSInspector.js`, `NetworkAgent.js`) were added in D4021516.

`ReactCommon/inspector/` has since been deleted and these components are no longer load bearing.

- We intend to replace this logic (at least, the archaic `XHRInterceptor` behaviour, which worked at one point) with native debugger `Network` domain support in our C++ layer.

**Changes**

- Remove all modules under `Libraries/JSInspector/`.
- Remove all `XHRInterceptor` call sites.
- Remove the `JSInspector.registerAgent()` mount point in `setUpDeveloperTools.js`.
- Exclude `Libraries/Core/setUp*` from `public-api-test` (these are side-effect setup files with no exported API).

Changelog:
[General][Breaking] - Remove legacy Libraries/JSInspector modules

Reviewed By: christophpurrer

Differential Revision: D68780147

fbshipit-source-id: 3d11cc89886a91055e6b69ac6f0609c288965801
2025-01-30 11:30:05 -08:00
Jorge Cabiedes AcostaandFacebook GitHub Bot accde40e1b Fix gapbetween making backgroundColor render when width/height is 0 (#49074)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49074

This used to not be noticeable when we were clipping the background even without a border, after fixing that, we got line when the width/height was 0

This is again not an issue with new Background and Border since they take a slightly different approach

Diff that caused the issue D68279400

ie.
 {F1974794589}

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D68843649

fbshipit-source-id: a25ace46b604690e3385c49d6f4bb3a4163bc594
2025-01-30 11:04:19 -08:00
Vitali ZaidmanandFacebook GitHub Bot 566a45e28c adjust rntester readme to use "yarn prepare-ios" (#49067)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49067

## Changelog:

[Internal] [Fixed] - fixed rntester readme to guide users to launch the correct ios prepare command

Reviewed By: cipolleschi

Differential Revision: D68897627

fbshipit-source-id: 93d30b2728f452e27448d0ef468ee148296f2324
2025-01-30 08:45:24 -08:00
Iwo PlazaandFacebook GitHub Bot 8783196ee5 Migrate files in Libraries/EventEmitter and Libraries/Image to use export syntax (#49020)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49020

## Motivation
Modernising the RN codebase to allow for modern Flow tooling to process it.

## This diff
- Migrates the `Libraries/EventEmitter/*.js` and `Libraries/Image/*.js` files to use the `export` syntax.
- Updates deep-imports of these files to use `.default`
- Updates the current iteration of API snapshots (intended).

Changelog:
[General][Breaking] - Deep imports to modules inside `Libraries/EventEmitter` and `Libraries/Image/*.js` with `require` syntax need to be appended with '.default'.

Reviewed By: huntie

Differential Revision: D68780876

fbshipit-source-id: bd8e702aba33878e38df6d9c89bec27e7c8df0ac
2025-01-30 07:27:03 -08:00
Rubén NorteandFacebook GitHub Bot 82cc465645 Clean up disableEventLoopOnBridgeless feature flag (#49065)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49065

Changelog: [internal]

Cleaning up the flag because it's no longer necessary.

Reviewed By: sammy-SC

Differential Revision: D68892995

fbshipit-source-id: 4e0290bfb11181dc388e6590af1b82581588b9ee
2025-01-30 07:20:52 -08:00
Iwo PlazaandFacebook GitHub Bot 4101a2f0b6 Add compat layer for react-native-codegen and processColorArray (#49063)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49063

## Motivation
Modernising the RN codebase to allow for modern Flow tooling to process it.

## This diff
- Updates react-native-codegen to generate ViewConfigs that are compatible with react-native both before and after the export syntax migration.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D68894819

fbshipit-source-id: fca46c1b91c15e22f1e1128ce8621c05341e2fe6
2025-01-30 07:16:54 -08:00
Rubén NorteandFacebook GitHub Bot 105e3ab837 Implement additional traversal methods on ReactNativeDocument (#49013)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49013

Changelog: [internal]

Adds `Document`-specific traversal methods to `ReactNativeDocument`:
* `childElementCount`
* `children`
* `firstElementChild`
* `lastElementChild`

Reviewed By: yungsters

Differential Revision: D67693032

fbshipit-source-id: 1e3279586ece809c5c3584279c07f991cadf0fc6
2025-01-30 07:11:43 -08:00
Rubén NorteandFacebook GitHub Bot 2436e3ba84 Implement ReactNativeDocument (#49012)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49012

Changelog: [internal]

(This is internal for now, until we rollout the DOM APIs in stable).

This refines the concept of root elements from the merged proposal for [DOM Traversal & Layout APIs](https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0607-dom-traversal-and-layout-apis.md).

The original proposal included a reference to have the root node in the tree as `getRootNode()` and no other methods/accessors to access it.

This makes the following changes:
* The root node is a new abstraction in React Native implementing the concept of `Document` from Web. `node.getRootNode()`, as well as `node.ownerDocument` now return instances to this node (except when the node is detached, in which case `getRootNode` returns the node itself, aligning with the spec).
* The existing root node in the shadow tree is exposed as the `documentElement` of the new document instance. It would be the first and only child of the document instance, and the topmost parent of all the host nodes rendered in the tree.

In terms of APIs:
* Implements `getRootNode` correctly, according to the specified semantics.
* Adds `ownerDocument` to the `ReadOnlyNode` interface.
* Adds the `ReactNativeDocument` interface, which extends `ReadOnlyNode` (with no new methods on its own, which will be added in a following PR).

NOTE: This is currently gated under `ReactNativeFeatureFlags.enableDOMDocumentAPI` feature flag, which is disabled by default.

Reviewed By: yungsters

Differential Revision: D67526381

fbshipit-source-id: dff3645469e7ea2b2026dbbaa94d9fd0e00291be
2025-01-30 07:11:43 -08:00
Rubén NorteandFacebook GitHub Bot 3dab9c66ba Expose new method in Fabric renderer to access root instance from root tag (#49011)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49011

Changelog: [internal]

This exposes the new `getPublicInstanceFromRoot` method from the React renderer in our RN façades, preparing for the new change to implement the document interface in RN.

Reviewed By: javache

Differential Revision: D68767143

fbshipit-source-id: 9a3403f9bc1612b402305695d084497a46ee4480
2025-01-30 07:11:43 -08:00
Rubén NorteandFacebook GitHub Bot 8f7f3be9af Add support for document instance in React Native (#32260) (#49051)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49051

## Summary

We're adding support for `Document` instances in React Native (as
`ReactNativeDocument` instances) in
https://github.com/facebook/react-native/pull/49012 , which requires the
React Fabric renderer to handle its lifecycle.

This modifies the renderer to create those document instances and
associate them with the React root, and provides a new method for React
Native to access them given its containerTag / rootTag.

## How did you test this change?

Tested e2e in https://github.com/facebook/react-native/pull/49012
manually syncing these changes.

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

Reviewed By: javache

Differential Revision: D68839346

fbshipit-source-id: 589ddce15d0f32ba3eab1c03306c405d38616723
2025-01-30 07:11:43 -08:00
Iwo PlazaandFacebook GitHub Bot 4d6785bdb5 Migrate LayoutAnimation and Linking libraries to use export syntax (#49021)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49021

## Motivation
Modernising the RN codebase to allow for modern Flow tooling to process it.

## This diff
- Migrates files in `Libraries/LayoutAnimation/*.js` and `Libraries/Linking/*.js` to use the `export` syntax.
- Updates deep-imports of these files to use `.default`
- Updates jest mocks
- Updates the current iteration of API snapshots (intended).

Changelog:
[General][Breaking] - Deep imports to modules inside `Libraries/LayoutAnimation` and `Libraries/Linking` with `require` syntax need to be appended with '.default'.

Reviewed By: huntie

Differential Revision: D68782429

fbshipit-source-id: c9ea4fadbc44587a165d311b054fcd03444842c8
2025-01-30 07:07:08 -08:00
Alex HuntandFacebook GitHub Bot 45a2d9c5a8 Delete deprecated YellowBox API (#49061)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49061

Changelog:
[General][Breaking] - Remove deprecated `YellowBox` and `console.ignoredYellowBox` APIs. Use `LogBox`.

Reviewed By: cortinico, hezi

Differential Revision: D68893550

fbshipit-source-id: 5030a20a2d1a60ca37eaf928339b8dd5d5abaa27
2025-01-30 06:49:13 -08:00
Rubén NorteandFacebook GitHub Bot 252294bc76 Improve naming for benchmark suite options (#49014)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49014

Changelog: [internal]

Use better names for the Fantom benchmarking API than the ones defined in `tinybench`:
* `time` => `minDuration`
* `iterations` = `minIterations`
* `warmupTime` => `minWarmupDuration`
* `warmupIterations` => `minWarmupIterations`

Reviewed By: rshest

Differential Revision: D68710952

fbshipit-source-id: 05dc1145a72a50ea73de7ccbb08bb28d7975245f
2025-01-30 03:24:39 -08:00
Tommy NguyenandFacebook GitHub Bot ee8088b615 fix(dev-middleware): add missing invariant dependency (#49047)
Summary:
`dev-middleware` uses `invariant` but does not declare it as a dependency. Under certain hoisting scenarios, or when using pnpm, this will cause `dev-middleware` to fail while being loaded.

## Changelog:

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

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

Test Plan: n/a

Reviewed By: cortinico

Differential Revision: D68835789

Pulled By: huntie

fbshipit-source-id: 13718f4970ed55e6e062b7c2bd719be977abdd0c
2025-01-30 01:58:27 -08:00
David VaccaandFacebook GitHub Bot 40575f26d2 Internalize ReactBridge (#49049)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49049

ReactBridge can be internalize, there are no usages in OSS

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D68540710

fbshipit-source-id: ce7fe6ca52186414650dcc529c5891dc59cab51a
2025-01-29 17:32:25 -08:00
Erica KleinandFacebook GitHub Bot 04afbd90e6 Back out "Fabric: Fixes crash of dynamic color when light/dark mode changed" (#49054)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49054

Original commit changeset: 01959845b742

Original Phabricator Diff: D68157559

Reviewed By: javache

Differential Revision: D68861984

fbshipit-source-id: c2e6fcf5d626447bd658b047adbb64947c2a5266
2025-01-29 15:55:32 -08:00