Commit Graph
36498 Commits
Author SHA1 Message Date
Eric RozellandFacebook GitHub Bot d9823d80bb Delete ShadowTreeRevision on background thread (#50997)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50997

In some apps, we spend a non-trivial amount of time calling ShadowNode destructors on the UI thread.

A simple way to avoid stalling the UI thread is to move the `baseRevision_` instance to a data structure that is cleared on a background thread, so it's tree of ShadowNode shared_ptrs are released (and in most cases destroyed) on the background thread.

Rather than using std::thread, this change introduces the LowPriorityExecutor abstraction that should be supplied by host platforms. The implementation of this LowPriorityExecutor for each platform is as follows:
- iOS: uses dispatch_async to a low priority dispatch queue
- Android: uses a pthread with SCHED_OTHER and priority = 19

Moving the ShadowTreeRevision into a lambda capture and punting the lambda to the LowPriorityExecutor moves the destructor calls of the ShadowNodes to the host platform implementation of the LowPriorityExecutor.

This change is also guarded by a feature flag so we can keep an eye out for potential memory leaks.

## Changelog

[Internal]

Reviewed By: NickGerleman

Differential Revision: D73688009

fbshipit-source-id: 6a66da248e6fe5c38375bf026499346e8381e75a
2025-05-05 07:44:02 -07:00
Dawid MałeckiandFacebook GitHub Bot 8d08845cda Root export PublicRootInstance and PublicTextInstance for ReactNativeTypes to use (#51018)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51018

`ReactNativeTypes` deep imports  `MeasureOnSuccessCallback`, `PublicInstance`, `PublicRootInstance` and `PublicTextInstance`. The `MeasureOnSuccessCallback` type  is already root exported, `PublicInstance` is exported as `HostInstance` and there are two types left to export to root import all of them from react-native. This is needed for `simpleResolve` to properly resolve and build types located in `ReactNativePrivateInterface`.

This cannot be fixed on the resolver level because that would also involve change in the `exports` field in `package.json` to enable types resolution for deep paths which should be strict by design.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D73926160

fbshipit-source-id: 3a711a0f002ea42d9ad538c07ec00f22cc4afb6b
2025-05-05 03:24:02 -07:00
Ruslan LesiutinandFacebook GitHub Bot 271232d856 Make call frames point to function definition, not callsite (#51084)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51084

# Changelog: [Internal]

Reviewed By: dannysu

Differential Revision: D73850528

fbshipit-source-id: fc1c22c5bf7cf71f76cf49643af06eeb188b770c
2025-05-05 02:20:58 -07:00
Alex HuntandFacebook GitHub Bot 69f9a9a029 Add status bar offset to New App Screen on Android (#51091)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51091

Fix for top padding with Android edge-to-edge (default for current version of the RN template). We add a `statusBarHeightOffset` explicitly, since this is not covered by the builtin `SafeAreaView`.

{F1977676990}

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D74142357

fbshipit-source-id: 6d70db43d8b80b7e3d2d4b598e29560efa046b5c
2025-05-04 13:07:52 -07:00
Rob HoganandFacebook GitHub Bot 93f22e79d4 community-cli-plugin: Use TerminalReporter type from metro, replace deep imports (#51092)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51092

`TerminalReporter` is re-exported from `metro` (since [0.76.7](https://github.com/facebook/metro/releases/tag/v0.76.7)), so we can update these deep imports to use public exports.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D74141704

fbshipit-source-id: 22cd3209868ed9ab260e199f9099ef98335feaeb
2025-05-04 09:57:57 -07:00
Nick GerlemanandFacebook GitHub Bot 5eed872463 Split Java TextLayoutManager Logic (#51066)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51066

Splits up some of the `measureText` code in Android TextLayoutManager, ahead of D73970149, which adds `measurePreparedLayout` to reuse most of this logic. Most significant change, is we pull out logic to iterate and retrieve metrics for attachments, since `measurePreparedLayout`, needs to also return dimensions, and fill into ArrayList, instead of received buffer.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D74035246

fbshipit-source-id: 2a0f5b171c4343e26ffa5b2538a0018939b06773
2025-05-02 23:22:09 -07:00
Jorge Cabiedes AcostaandFacebook GitHub Bot 989b3f61a0 Fix clipToPaddingBox on new Background and Border drawable (#51055)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51055

When clipping to the padding box without a background or border set, we should default to clipping to the drawing rectangle.

This ensures accurate clipping behavior when there is no background or border set. This is because it seems bounds accommodates the contents of the drawables but when no content is present (either a background or a border) the bounds are 0. In which case we want to rely on the drawing rect instead of the bounds for this edge case.

Changelog: [Android][Fixed] - Fix incorrect clip to padding box on new Background and Border drawables

Reviewed By: NickGerleman

Differential Revision: D74014372

fbshipit-source-id: bd5a496db6de44c4185760ed72b3013d9f2faa00
2025-05-02 19:00:28 -07:00
Jiawei LüandFacebook GitHub Bot d45c0419ac Revert D73922341: Report PerformanceResourceTiming events
Differential Revision:
D73922341

Original commit changeset: bcfc03c3d8a9

Original Phabricator Diff: D73922341

fbshipit-source-id: 3898ae763332b79f5a37fc91abb70be53c299655
2025-05-02 14:42:24 -07:00
Joe VilchesandFacebook GitHub Bot e00028f6bb Clean up useEditTextStockAndroidFocusBehavior feature flag (#51039)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51039

We added a feature flag in case this broke things. Its been about 4 months now with now issues, I think we can clean this up.

Changelog: [Android][Fixed] - Can now focus TextInput with keyboard

Reviewed By: NickGerleman

Differential Revision: D73954790

fbshipit-source-id: 4682cf709aa2f34ba69e76a35d07a908edb28f23
2025-05-02 13:21:27 -07:00
Mateo GuzmánandFacebook GitHub Bot 6fa1864d52 Make ModuleDataCleaner internal (#51060)
Summary:
This class can be internalized as part of the initiative to reduce the public API surface. 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+NOT+user%3Acortinico+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+NOT+repo%3Apkcsecurity%2Fdecompiled-lightbulb+com.facebook.react.modules.common.ModuleDataCleaner).

Only one library uses it (https://github.com/jbrodriguez/react-native-android-sqlite), but it's hasn't been updated for 10 years. Marking it as breaking, but it's unlikely that the library is used nowadays. See:

## Changelog:

[ANDROID][BREAKING] - Make com.facebook.react.modules.common.ModuleDataCleaner internal

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

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

Reviewed By: cortinico, shwanton

Differential Revision: D74036994

Pulled By: arushikesarwani94

fbshipit-source-id: 520fc3dfdc1ecfb27f161a1b59ad5d79dfc854cf
2025-05-02 12:51:13 -07:00
Ramanpreet NaraandFacebook GitHub Bot f4d99d6a23 Reland: [rn][ios] Bridgeless: Fix unstable_hasComponent (#51053)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51053

unstable_hasComponent(component) first registers the component with react native, if possible. Then, it returns you whether registration succeeded.

## Problem
For unregistered components, the initial call returns false. But, all subsequent calls return true.

The reason why: After the initial call fails, react native registers unimplemented view under that component name. So, all subsequent calls return true.

## Solution
Just record the initial loopup result. And always return that initial lookup result from this method.

Changelog: [iOS][Fixed] Fix bug: unstable_hasComponent(*) = true for unregistered components for n > 1th call.

Reviewed By: yungsters, cipolleschi

Differential Revision: D73949864

fbshipit-source-id: ac5b6fc373cb1b2436045ae1f78391f0712bca17
2025-05-02 12:27:58 -07:00
generatedunixname499836121andFacebook GitHub Bot c514333f41 Apply fixup patch to fbsource
Summary:
This is an automatically generated fixup patch to bring fbsource back into sync with
facebook/react on GitHub. Please land this patch as soon as possible, as the difference
reflected on here is already on GitHub and future changes may depend on these
changes!

Changelog: [Internal]

<< DO NOT EDIT BELOW THIS LINE >>
diff-train-skip-merge

Generated by: https://www.internalfb.com/intern/sandcastle/job/22517999956752681/

GitHub Repo: facebook/react

Reviewed By: kassens

Differential Revision: D73844457

fbshipit-source-id: 840a8448839992538427cd52501cdfaf0a2e82da
2025-05-02 12:24:24 -07:00
David VaccaandFacebook GitHub Bot 3f62d001fd Update error message for non-registered ViewManagers (#51067)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51067

Update error message for non-registered ViewManagers

changelog: [internal] internal

Reviewed By: arushikesarwani94, cortinico

Differential Revision: D74048740

fbshipit-source-id: 016469ec79654863d51a7b1acff513bf50fd4e86
2025-05-02 12:22:32 -07:00
David VaccaandFacebook GitHub Bot 8c231b7d81 Document logic implemented in ComponentDescriptorRegistry when a component is not found (#51062)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51062

Document logic implemented in ComponentDescriptorRegistry when a component is not found

changelog: [internal] internal

Reviewed By: arushikesarwani94, cortinico

Differential Revision: D74036572

fbshipit-source-id: 20a5d182e0308538cdfa3f5e97957d488f010f0d
2025-05-02 12:22:32 -07:00
David VaccaandFacebook GitHub Bot 5ae6f6be25 Cleanup and document ReactUnimplementedView (#51063)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51063

Cleanup and document ReactUnimplementedView

changelog: [internal] internal

Reviewed By: rshest, cortinico

Differential Revision: D74036571

fbshipit-source-id: 75077914697cac56743c99fba7d7cdccad5c828a
2025-05-02 12:22:32 -07:00
Mateo GuzmánandFacebook GitHub Bot 809372c49e Make EventBeatManager internal (#51057)
Summary:
This class can be internalized as part of the initiative to reduce the public API surface. 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+NOT+user%3Acortinico+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+NOT+repo%3Apkcsecurity%2Fdecompiled-lightbulb+com.facebook.react.fabric.events.EventBeatManager).

## Changelog:

[INTERNAL] - Make com.facebook.react.fabric.events.EventBeatManager internal

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

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

Reviewed By: javache, cortinico

Differential Revision: D74037193

Pulled By: arushikesarwani94

fbshipit-source-id: 77e677a977d8a5c4d7f985c3eff352c19ca1140c
2025-05-02 11:55:01 -07:00
HyunWoo LeeandFacebook GitHub Bot 78dbbaafdd Support collections dsl (#51042)
Summary:
This PR introduces a concise Kotlin DSL for constructing `ReadableMap` and `ReadableArray` in Android native modules:

- Adds `buildReadableMap { … }` and `buildReadableArray { … }` functions, modeled after Kotlin’s `buildMap`/`buildList` APIs.
- Wraps `Arguments.createMap()` / `Arguments.createArray()` in a type-safe, nested DSL to reduce boilerplate and prevent errors.
- Improves readability and maintainability when assembling nested map/array structures for React Native bridges.

Current code like:
```kotlin
val map = Arguments.createMap().apply {
  putString("name", user.name)
  putInt("age", user.age)
  // …
}
```

can now be written as:

```kotlin
val userMap = buildReadableMap {
  put("name", user.name)
  put("age", user.age)
  put("scores") {
    user.scores.forEach { add(it) }
  }
}
```

This feature proposal also written in [[Android] Support Collection DSL](https://github.com/react-native-community/discussions-and-proposals/issues/899)

## Changelog:

[Android] [Added] - Collections DSL functions for Kotlin(`buildReadableMap`, `buildReadableArray`)

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

Test Plan:
### Run Unit Test

```shell
cd packages/react-native/ReactAndroid
./gradlew :ReactAndroid:unitTest
```

Ensure all tests in `src/test/java/.../ReadableMapBuilderTest.kt` and `ReadableArrayBuilderTest.kt` pass.

Reviewed By: javache

Differential Revision: D73986390

Pulled By: cortinico

fbshipit-source-id: b9f94327646bcb6e0190cdd06dfb9bb5eaa6375c
2025-05-02 11:02:52 -07:00
Nicola CortiandFacebook GitHub Bot 2590438b67 Minor cleanup of AbstractLayoutAnimationTest (#51079)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51079

This test was not using AssertJ. I've updated it then.

Changelog:
[Internal] [Changed] -

Reviewed By: javache

Differential Revision: D74065455

fbshipit-source-id: 2393340fd75aaf9599ba789237c29bb91e0192ae
2025-05-02 10:21:57 -07:00
Alex HuntandFacebook GitHub Bot ec38728c75 Report PerformanceResourceTiming events (#51025)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51025

(Sparsely) wires up reporting of Network events to the Web Performance subsystem.

Our plan is to report to the Web Performance APIs (lightweight timing metadata, here) for all build flavours, and report to CDP (more costly full metadata/previews) in dev/profiling builds.

**Notes**

- Introduces `PerformanceEntryReporter::unstable_reportResourceTiming` — this will become "stable" when further network events/fields are fully hydrated on Android and iOS.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D73922341

fbshipit-source-id: bcfc03c3d8a9a286ae72ba00a3313602fb2adea8
2025-05-02 08:14:40 -07:00
Alex HuntandFacebook GitHub Bot 6b304bc551 Fix missing podspec dependency in RCTNetwork (#51071)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51071

Follows D73995864.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D74062263

fbshipit-source-id: 2cb9bc30b36ecd2cd925bf5efa5ee31e9c8a92a6
2025-05-02 08:14:40 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 58a9046978 Improve cleanup script for ios (#51046)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51046

This small change improves the cleanup script for ios, which is now not deleting the workspace and that it might be keeping an outdated version of the codegen for OSS.

## Changelog:
[Internal] - Improve yarn clean-ios script

Reviewed By: cortinico

Differential Revision: D73988442

fbshipit-source-id: 6de5d6ab08812ba7fdb19b0cc955a38840d82f89
2025-05-02 04:21:12 -07:00
Mateo GuzmánandFacebook GitHub Bot 5d98f6f364 Kotlin: Clean up redundant constructs (#51061)
Summary:
Static code analysis detected several redundant constructs across the codebase. Most of the ones fixed here are marked as warnings/weak warnings, likely code smells post-migration from Java.

Doing a small round to clean up some of them.

## Changelog:

[INTERNAL] - Kotlin: Clean up redundant constructs

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

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

Reviewed By: rshest

Differential Revision: D74056259

Pulled By: javache

fbshipit-source-id: 04f7ce7ce7b4f6063c8e1712840a44fd91d3b9e1
2025-05-02 03:59:22 -07:00
Nicola CortiandFacebook GitHub Bot c6685d29ad Fix RNTester SampleLegacyModule not rendering in Old Arch (#51073)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51073

Currently the SampleLegacyModule screen is not loading in OldArch for RNTester.

That's because we gate adding a `SampleLegacyModule` to the BaseReactPackage
only if NewArch is enabled.

This shouldn't be the case as we can still build RNTester in oldarch and we
should be able to visualize the SampleLegacyModule example.

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D74009245

fbshipit-source-id: 55eae3dc6063343f57261af2742e643a8e5c2b50
2025-05-02 03:59:10 -07:00
Mateo GuzmánandFacebook GitHub Bot 506f03b5e1 Make ShareModule internal (#51059)
Summary:
This class can be internalized as part of the initiative to reduce the public API surface. 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+NOT+user%3Acortinico+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+NOT+repo%3Apkcsecurity%2Fdecompiled-lightbulb+com.facebook.react.modules.share.ShareModule).

## Changelog:

[INTERNAL] - Make com.facebook.react.modules.share.ShareModule internal

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

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

Reviewed By: javache

Differential Revision: D74037444

Pulled By: arushikesarwani94

fbshipit-source-id: 13f7652a0db35200b4de9ea95a800cf9ea52b837
2025-05-02 02:18:47 -07:00
Alex HuntandFacebook GitHub Bot e1632da01c Gate network event reporting with feature flag (#51050)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51050

Gate network event reporting on iOS (inputting into the network reporting subsystem), now that this is load-bearing with the Performance API.

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D73995864

fbshipit-source-id: 65a15485cdae445eadff6c57148f3682af6de215
2025-05-01 23:19:29 -07:00
Mateo GuzmánandFacebook GitHub Bot c4a2cb9d90 Make JSResponderHandler internal (#51058)
Summary:
This class can be internalized as part of the initiative to reduce the public API surface. 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+NOT+user%3Acortinico+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+NOT+repo%3Apkcsecurity%2Fdecompiled-lightbulb+com.facebook.react.touch.JSResponderHandler).

## Changelog:

[INTERNAL] - Make com.facebook.react.touch.JSResponderHandler internal

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

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

Reviewed By: mdvacca

Differential Revision: D74036832

Pulled By: arushikesarwani94

fbshipit-source-id: c31cd271e7c1007fdfe9582c8c3055ecbda324a6
2025-05-01 22:45:33 -07:00
Alex HuntandFacebook GitHub Bot 195b723d74 Refactor performanceNow call, remove cxxreact dependency (#51024)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51024

Prevents a dependency cycle in the next diff.

Changelog: [Internal]

Reviewed By: rubennorte, hoxyq

Differential Revision: D73933671

fbshipit-source-id: 79c66cd5f6a32ed7287a2d6e7840a512466306a9
2025-05-01 22:40:39 -07:00
Alex HuntandFacebook GitHub Bot baf895c239 Add internal support for PerformanceResourceTiming (#50996)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50996

Adds a representation of the [`PerformanceResourceTiming`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming) event type to the Web Performance subsystem, ahead of integration with our network event reporting.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D73861431

fbshipit-source-id: 8258058c432727808d30c338bba79ca92a17c1c8
2025-05-01 22:40:39 -07:00
Alex HuntandFacebook GitHub Bot 1135f10e05 Refactor PerformanceEntry as std::variant (#50995)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50995

Refactors our previous single-struct representation for `PerformanceEntry` ([see MDN](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry)) as a `std::variant`.

This maps closely to the `PerformanceEntry` type inheritance in the web spec, and makes this type substantially cleaner to extend and work with in D73861431.

Changelog: [Internal]

Reviewed By: rubennorte, rshest

Differential Revision: D73860532

fbshipit-source-id: f3b7a7444d2456370620c1a1ba9a43f118cb9730
2025-05-01 22:40:39 -07:00
Alex HuntandFacebook GitHub Bot e6870c68f9 Limit request body size for Network.requestWillBeSent (#51026)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51026

Performance optimisation — truncate request body content (sent as `Request.postData` over CDP) at 1MB.

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D71905868

fbshipit-source-id: ba82b4937902e057d4694bf4f000eb77ee37aa8a
2025-05-01 21:46:36 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 04f0e66a6b Avoid accessing the MainBundle multiple times (#51044)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51044

This change prevents RN from accessing the MainBundle every time a NativeModule is registered by caching the `legacyLogEnabled` property in a static variable.

## Changelog:
[Internal] - Prevent multiple access to mainBundle

Reviewed By: javache

Differential Revision: D73992070

fbshipit-source-id: a14aada43f367314b7f868a0b5e30b9f92d0971a
2025-05-01 20:22:50 -07:00
Richard HowellandFacebook GitHub Bot 21bf7cf6cf remove ATOMIC_VAR_INIT
Summary:
ATOMIC_VAR_INIT is deprecated in C17, and does nothing anyway.

Changelog:
[iOS][Fixed] - Remove deprecated ATOMIC_VAR_INIT macro in RCTProfile.m

Reviewed By: NSProgrammer

Differential Revision: D74002901

fbshipit-source-id: e453fbc084cd0b1049c7f8b052c9779d9b19b44f
2025-05-01 19:16:54 -07:00
Nick GerlemanandFacebook GitHub Bot e4b6b346bc Remove ENABLE_MEASURE_LOGGING (#51064)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51064

This is pretty much just checked in printf debugging. Let's clean it up, before we duplicate some code which has the logs.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D73975310

fbshipit-source-id: d2b936ad62a17aef20903fd2ca0defc23c647aa0
2025-05-01 18:13:39 -07:00
Nick GerlemanandFacebook GitHub Bot b1367eeb81 Resubmit: Incorporate maxLines and ellipsization into text layout (#51040)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51040

## Resubmit

We were previously only checking for `maxNumberOfLines` of `ReactConstants.UNSET` (-1), but it may also be `0` to signify unset from other checks (wut), and different versions of Android would handle this case of `maxLines={0}` differently.

The resubmission adds an explicit check for zero here as well.

```
      if (ReactNativeFeatureFlags.incorporateMaxLinesDuringAndroidLayout()) {
        if (maxNumberOfLines != ReactConstants.UNSET && maxNumberOfLines != 0) {
          builder.setEllipsize(ellipsizeMode).setMaxLines(maxNumberOfLines);
        }
      }
```

## Previous

Right now, we fully layout text, then use max lines to determine  a metric to use when calculating size.

Android API 23+ which we fully target allows incorporating ellipsization and maxlines directly into the layout. This will let us directly draw the layout when using maxLines later. This may also let Android optimize line-breaking a bit, when we hit truncation.

Special care is taken not to set this when we are in `adjustsFontSizeToFit` path, so that line count will flow over, signifing overflow.

I think the main user-facing change is that `onTextLayout` events will have measures post-ellipsization.

Changelog:
[Android][Changed] - Incorporate maxLines and ellipsization into text layout

Reviewed By: lenaic, joevilches

Differential Revision: D73953691

fbshipit-source-id: 2e08faab5bb9eda90a126545571bb441ea1ece39
2025-05-01 18:13:39 -07:00
Zeya PengandFacebook GitHub Bot 0c58ccf501 Call Java AudioModule from C++ TM to play audio (#51037)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51037

## Changelog:

[Android] [Changed] - Make mHybridData in CxxReactPackage protected

In some cases subclass needs to override it in constructor

Reviewed By: javache

Differential Revision: D73894471

fbshipit-source-id: 7958f9b88841a0201d39e49fba09af76927e5737
2025-05-01 14:22:10 -07:00
Fabrizio CucciandFacebook GitHub Bot b406c0a37e Add changelog entry for 0.79.2 (#51054)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51054

As per title.

Changelog: [Internal]

Reviewed By: Abbondanzo

Differential Revision: D74013007

fbshipit-source-id: f5a8a99956ec3fe4dcf56ffd5f7ed2f4cef158eb
2025-05-01 12:45:39 -07:00
Alex HuntandFacebook GitHub Bot b731ea3d3f Internalise RNTester examples referencing unexported APIs (#51019)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51019

Follows D72228547 and D73770609.

This diff internalises (moves files from fbsource+GitHub to fbsource only) a number of RNTester examples which referenced `'react-native/src/private/'` subpaths.

In future, new components/APIs should be exported from index as `unstable_`, or added to `RNTesterListFbInternal` if they are exported from `src/fb_internal/`.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D73777092

fbshipit-source-id: d9fb0833c56f2ae580b6db62ddbbbeae774a0004
2025-05-01 09:58:30 -07:00
Alex HuntandFacebook GitHub Bot ba5acdba83 Introduce enableNetworkEventReporting and enableResourceTimingAPI feature flags
Summary: Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D73995231

fbshipit-source-id: ade6f858b14928a32fa022d4e9a85704bc944726
2025-05-01 07:00:52 -07:00
Nick LefeverandFacebook GitHub Bot 07073fbac8 Override useShadowNodeStateOnClone for OSS (#51041)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51041

Enabling `useShadowNodeStateOnClone` by default on OSS to resolve https://github.com/facebook/react-native/issues/49694

Changelog: [Internal]

Reviewed By: cortinico, cipolleschi

Differential Revision: D73970421

fbshipit-source-id: 4021c9fc07a7fc28012c022f6131409486e8aea7
2025-05-01 05:48:52 -07:00
Riccardo CipolleschiandFacebook GitHub Bot e1d2285791 Do not access to main bundle when running in prod (#51043)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51043

The call to the mainBundle to read the `RCTLegacyWarningsEnabled` key can sometime deadlock in prod.
However, these are development logs that we don't want to run in Prod.

This change should disable the logs in prod, skipping the access to the `mainBundle`, and avoid the deadlock completely.

## Changelog:
[Internal] - Fix deadlock at startup to read `RCTLegacyWarningsEnabled`

Reviewed By: philIip, javache

Differential Revision: D73987454

fbshipit-source-id: 014410266733fdfa1e7b29d41fab5f7112b1ddb4
2025-05-01 04:48:55 -07:00
Pieter De BaetsandFacebook GitHub Bot 773ba66c64 Cleanup unnecessary unsafe dereferences in BlobModule (#51016)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51016

Addressing some lint feedback.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D73840204

fbshipit-source-id: ed1035bb785ce0246e714bca86a1ae84578f1464
2025-05-01 04:07:30 -07:00
Mateo GuzmánandFacebook GitHub Bot 81f3f091ae Make ReactModalHostManager internal (#51002)
Summary:
This class can be internalized as part of the initiative to reduce the public API surface. 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+NOT+user%3Acortinico+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+NOT+repo%3Apkcsecurity%2Fdecompiled-lightbulb+com.facebook.react.views.modal.ReactModalHostManager).

## Changelog:

[INTERNAL] - Make com.facebook.react.views.modal.ReactModalHostManager internal

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

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

Reviewed By: cortinico, rshest

Differential Revision: D73890830

Pulled By: alanleedev

fbshipit-source-id: 6443c4ab80a287fbe963ee60e361ff7864a0d73f
2025-05-01 02:23:01 -07:00
Joe VilchesandFacebook GitHub Bot 69f41ca367 a11y] Let links discovered by dataDetectorType be accessible (#50914)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50914

The URL spans generated by Linkify are not actually accessible because we do not update the delegate's virtual views.

I also had to change how AccessibilityLinks get generated, since it does not work well if it includes spans that are not `ReactClickableSpans`

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D73612119

fbshipit-source-id: 0c6028a7473e0484216300863f2d7a043fb2ea85
2025-05-01 01:52:46 -07:00
Joe VilchesandFacebook GitHub Bot 70aced5eb1 Let LinkMovementMethod take precedence over accessibility delegate when dataDetector is present (#50887)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50887

There is currently a bug with the recent changes to keyboard accessibility with Text and nested links. If something with nested links has a `dataDetectorType` prop then we have 2 different selections when we navigate with arrow keys since the drawing behind the 2 are separate.

Removing LinkMovementMethod is not possible since it allows for clicking the links it detects

As a result, lets just allow it to take precedence over the delegate when handling link navigation in the cases its present.

Changelog: [Android][Fixed] - Double selection with dataDetectorType and links

Reviewed By: NickGerleman

Differential Revision: D73549839

fbshipit-source-id: bbe37470e78841bb119fa68e197b327023031c7e
2025-05-01 01:52:46 -07:00
Ruslan LesiutinandFacebook GitHub Bot 0f5eeb6970 Use correct scriptId (#51030)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51030

# Changelog: [Internal]

I've been using the wrong thing this whole time, because it is referenced in `ChromeTraceSerializer.cpp`:
https://www.internalfb.com/code/fbsource/[b422eeb3bb6334ef95e8cf01b18e32ba8ab72bbe]/xplat/hermes-snapshot/lib/VM/Profiler/ChromeTraceSerializer.cpp?lines=439

Turns out, there is a real `scriptId`, defined by the Runtime and which is unique for every script. This also aligns with other parts of the CDP stack in Hermes. Since this scriptId is always available, there is no need to make it optional.

Reviewed By: dannysu

Differential Revision: D73185984

fbshipit-source-id: 1bb057584cf3f18bd7b440fef44de9e880ceb961
2025-05-01 00:22:44 -07:00
Ruslan LesiutinandFacebook GitHub Bot 0b6ed6c7d5 Define range for iteration over samples and call stack frames (#51029)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51029

# Changelog: [Internal]

Instead of exposing vector of samples / call frames directly, we will share pair of iterators that would allow iterating over them in a specified order.

Reviewed By: dannysu

Differential Revision: D73448002

fbshipit-source-id: 16c476453e943a71403b375b168b30da7d261cfa
2025-05-01 00:22:44 -07:00
Ruslan LesiutinandFacebook GitHub Bot a5f2acde20 Avoid heap allocations when serializing sampling profile (#51028)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51028

# Changelog: [Internal]

There is a way to implement the trie without allocating `ProfileTreeNode` on the heap. The serialization logic (`RuntimeSamplingProfilerTraceEventSerializer.cpp`) remained mostly the same, the only new limitation is that we can only use pointer to `ProfileTreeNode` until the next push into a `children` container, when all pointers are invalidated. Not sure if we can avoid this invalidation, since we don't know the potential size of `children` vector, it has to be dynamically allocated.

Main changes are in `ProfileTreeNode`:
- Instead of receving already created instane that will be check if it should be added as a child, it will expose predicate to check if such node already exists - `getIfAlreadyExists`. If not, then caller can use `addChild` to register it and receive a pointer.

Reviewed By: huntie

Differential Revision: D73213284

fbshipit-source-id: 385be884bcc5feb61b3a8cbd0ff36402e3b20c6c
2025-05-01 00:22:44 -07:00
Ruslan LesiutinandFacebook GitHub Bot c09340e73e Use std::variant, remove heap allocations (#50847)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50847

# Changelog: [Internal]

We have different types of call frames, right now we defined 4 of them. Previously, they would descend from `ProfileSampleCallStackFrame`, which has `kind_` field that can be used for determining the type of the call frame.
We were using polymorphism later on React Native side to cast from base type to derived.

Instead of this, and instead of doing heap allocations for potentially tens of thousands of objects, we will use std::variant for storing frames in a single container and them distinguishing them.

This fixes memory leaks caused by new-ing objects and not clearing out when Profile is destroyed.

Reviewed By: dannysu

Differential Revision: D72803934

fbshipit-source-id: a279c6d68c7c2628f0eab585f33137222ad9e3f1
2025-05-01 00:22:44 -07:00
Sam ZhouandFacebook GitHub Bot 88a04c530e Pre-suppress errors related to Object.assign
Summary:
The `Object.assign` support is [inherently unsound](https://github.com/facebook/flow/issues/3392), carries a lot of tech debt, and we want to error on them.

This diff pre-suppresses errors that will be added in the next version of Flow, to make the next release easier.

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D73963639

fbshipit-source-id: ebefc82c123588eb0b72ab48a24e45c42be33267
2025-04-30 19:44:58 -07:00
Nick GerlemanandFacebook GitHub Bot 025f2d931e Back out "Incorporate maxLines and ellipsization into text layout" (#51035)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51035

This is causing some problems with older versions of Android. Let's back out for now.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D73950625

fbshipit-source-id: 424dfc1216ae811e1e287774c6ac5d0c9ba5aa17
2025-04-30 17:45:25 -07:00