Commit Graph

38536 Commits

Author SHA1 Message Date
Chi Tsai 891ee78f13 Add JSI APIs setRuntimeData and getRuntimeData (#50197)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50197

Adds `setRuntimeData` and `getRuntimeData` JSI APIs. This provides a
convenient way for users to store some custom data associated with an
UUID.

For the default implementation of this feature, store the runtime data
in the global map that is shared between all VMs. This is done to keep
JSI lightweight and stateless, instead of adding data members.

Changelog: [Internal]

Reviewed By: neildhar

Differential Revision: D71579532

fbshipit-source-id: 553e28fbf80c93e268d475860197a00d2c5bacf7
2025-05-09 21:07:15 -07:00
Chi Tsai 499fcfad53 Add UUID struct to JSI (#50270)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50270

Add UUID struct to JSI. This will be used in the incoming changes, such
as identifying JSI interfaces and storing custom runtime data.

Changelog: [Internal]

Reviewed By: tmikov

Differential Revision: D71826382

fbshipit-source-id: e0d9bc20fb0f0e75407b9c88e731623e6a9975dd
2025-05-09 21:07:15 -07:00
Chi Tsai 316f86f29f Build JSI with C++17 (#50413)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50413

Build JSI with C++17.

Changelog: [Internal]

Reviewed By: dannysu

Differential Revision: D72079417

fbshipit-source-id: 3b7796a100db8db75a7089423be303312a4f0e10
2025-05-09 21:07:15 -07:00
generatedunixname89002005287564 cda82f5dd8 fbsource//xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated:animatedAndroid (#51215)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51215

Reviewed By: javache

Differential Revision: D74463923

fbshipit-source-id: a2494b9f1881b40488d284f84dbaafc807c2a2e9
2025-05-09 17:19:14 -07:00
Nick Gerleman 71ef049065 Directly Trust Text Layout Width (#51206)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51206

When we create a layout from measure constraints, we do some processing of the width, to return a different one, potentially smaller than the layout width, sometimes using line width, and sometimes using the container width.

This logic has gotten spooooky over time, and after a series of changes, and bugfixes, now effectively does nothing!

1. Way back in 2020, yungsters made D21056031 introducing this logic to "shrink wrap" text which is wrapped.
2. "Shrink wrapping" is not how web works when text is wrapped, (though it is how it works when there is explicit newline), and https://github.com/facebook/react-native/pull/47435 later undid this change
3. https://github.com/facebook/react-native/pull/37790 made changes specific to the case of trailing newline, because the logic to "shrink wrap" did not handle correctly.

After D74366936, which changes width used for layout creation to correctly respect `Layout.desiredWidth`, we should be back to multiline layouts, with no paragraph whose lines take up more than container width, being "shrink wrapped", while not doing so when there is wrapping or ellipsization, like current behavior. The desired width also excludes the non-visible trailing whitespace.

It means we can remove all of this logic, while preserving the same behavior. Mismatched measure widths from those used in the intermediate layout may also result in issues for Facsimile (see example in last diff of stack).

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D74368513

fbshipit-source-id: df5d7b773ad1888ebca1966ee4020a5c2ce7fd64
2025-05-09 12:52:36 -07:00
Mateo Guzmán 3a84d42aa1 Make RetryableMountingLayerException internal (#51171)
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.bridge.RetryableMountingLayerException).

## Changelog:

[INTERNAL] - Make com.facebook.react.bridge.RetryableMountingLayerException internal

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

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

Reviewed By: rshest

Differential Revision: D74381780

Pulled By: cortinico

fbshipit-source-id: 6d7255318669ac8edd0010d9655a105e72adf011
2025-05-09 10:40:19 -07:00
Pieter De Baets cf428bde1c Simplify StubViewTree creation (#51221)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51221

In the case of an empty root node, we don't need `buildStubViewTreeWithoutUsingDifferentiator` to create the initial `StubViewTree`

When testing with Fantom, this caused an additional unnecessary clone of RootShadowNode.

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D74472766

fbshipit-source-id: 076e859a6c5795e9026c7a5f8246a5658db4a94b
2025-05-09 08:36:44 -07:00
Nicola Corti 35c96007eb Fix the use import on DefaultStyleValuesUtil (#51214)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51214

D74381864 caused a series of crashes to spike due to .IncompatibleClassChangeError: Class 'android.content.res.TypedArray' does not implement interface 'java.lang.AutoCloseable'

This fixes it.

Changelog:
[Internal] [Changed] -

Reviewed By: javache

Differential Revision: D74468593

fbshipit-source-id: 70c14bdba4f229d4f59a01da3b56cd4fec29752f
2025-05-09 08:24:52 -07:00
Vitali Zaidman 0750b5f040 Improve the error thrown when a bundle fails to load (#51070)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51070

Changelog: [General][Internal][Breaking] When a bundle is failing to load throw an error of special type.

### Breaking
`didCompleteNetworkResponse` now throws an Error instead of throwing a string.

In dev, we use [lazy bundling](https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0605-lazy-bundling.md#__loadbundleasync-in-metro) which allows us to re-build only the parts of the app that are changed.

However the function that loads these lazy bundles in `loadBundleFromServer.js` for requests that reach `didCompleteNetworkResponse` with an error **throws a string representing the error message** which makes debugging very inconvenient because it lacks stack trace and error type. Throwing strings is not a standard practice. We better throw an error in these cases so it can be handled better.

Why a special type of error?
* As you can see in the "after", in the test plan below, even with a stack trace, it might be hard to know where this error originates from
* Also so extra information can be added on it. Currently adding "url"
* Also to support error handling based on the type of error

Reviewed By: hoxyq

Differential Revision: D73925027

fbshipit-source-id: a0f98d283ec8842696f1b87864fb63cb30c0c028
2025-05-09 07:24:37 -07:00
Rubén Norte 54499d8007 Ensure LogBox is disabled in Fantom tests (#51210)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51210

Changelog: [internal]

This adds a safety mechanism to Fantom tests to prevent LogBox from swallowing errors.

Now we validate that LogBox isn't installed when running tasks, so we can properly fix error reporting in tests.

Reviewed By: rshest

Differential Revision: D74464749

fbshipit-source-id: ef5e814b14aedbc681a4c7f9f8f60f454b239b6d
2025-05-09 07:11:24 -07:00
Rubén Norte 30363070a3 Define Fantom specific initialization module (#51211)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51211

Changelog: [internal]

This modifies the setup for Fantom so:
1. We don't inject "InitializeCore" by default.
2. We define a default environment setup module for Fantom with good defaults (LogBox, etc. disabled).

We also migrate all existing tests to use the new module.

The goal of this is to prevent LogBox from being used in tests so we can properly fix error propagation in the work loop (so they're not intercepted by it).

Reviewed By: rshest

Differential Revision: D69003812

fbshipit-source-id: 00353b5055e3700943a08ea67f698d49e068555b
2025-05-09 07:11:24 -07:00
Rubén Norte 9494eee868 Extract RN environment setup to a specific module (#51209)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51209

Changelog: [internal]

This refactors `InitializeCore` to extract the initialization logic to a separate configurable module.

By default, this does the same thing it does now, but the new module could be used without `InitializeCore` to set up the environment forcing disabling developer tools (e.g.: for testing in Fantom in development environments).

Reviewed By: rshest

Differential Revision: D69003811

fbshipit-source-id: ab85b10e4f21adccd8844a848d3272c407832031
2025-05-09 07:11:24 -07:00
Rubén Norte 7e640b5dd3 Add additional test cases for error handling in Fantom event loop (#51208)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51208

Changelog: [internal]

Adding a few more test cases to make sure error handling is fixed considering these use cases.

Reviewed By: rshest

Differential Revision: D74459974

fbshipit-source-id: 9a5865a9a09dd64535b4d38307db6c30f213b45f
2025-05-09 07:11:24 -07:00
Christian Falch 8f722937ff Add Package.swift file to prebuild React native core (#51197)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51197

This change adds the Package.swift file that can finally build React Native core using SPM

## Changelog:
[Internal] - Add Swift PM file to uild React Native Core using SwiftPM

Test Plan:
prepare the repo with
```
node packages/react-native/scripts/ios-prebuilds.js
```
and by downloading the ReactNativedependencies from the CI

Then open the Package.swift file in Xcode. I successfully built:
- iOS
- iOS Simulator
- Mac Catalyst

Reviewed By: lenaic

Differential Revision: D74393435

Pulled By: cipolleschi

fbshipit-source-id: 7d61ad1d09444a0c16e865062ae448ec1e7ef5ad
2025-05-09 03:19:47 -07:00
Yannick Loriot 7a72037b37 Revert D74291373: Ensure that ShadowNode measure functions respect constraints
Differential Revision:
D74291373

Original commit changeset: 44166f2e4732

Original Phabricator Diff: D74291373

fbshipit-source-id: 54a4dd0af1c020caacebe6f02cb95eba0c95c62f
2025-05-09 01:45:16 -07:00
Yannick Loriot 435d2e84ef Revert D74292949: Expose Unsnapped Dimensions
Differential Revision:
D74292949

Original commit changeset: 05011c66a9a9

Original Phabricator Diff: D74292949

fbshipit-source-id: c6ca51c7b882950d54b6a43e206973774db40429
2025-05-09 01:45:16 -07:00
Ramanpreet Nara f00fbaedbe Revert D74361644: IntersectionObserver: Clean up shadow nodes after unobserve
Differential Revision:
D74361644

Original commit changeset: 1a5ccce1486a

Original Phabricator Diff: D74361644

fbshipit-source-id: 89792482a09501aed24c21627c44b3229a0c7a32
2025-05-08 22:11:27 -07:00
Ramanpreet Nara a55f430daa IntersectionObserver: Clean up shadow nodes after unobserve
Summary:
After unobserve is called, the shadow node actually isn't deleted from the `targetToShadowNode` WeakMap. So, if the element is kept around, the shadow node will leak.

We suspect this doesn't happen in practice. But, still it's good to just do this cleanup, just in case.

Changelog: [General][Fixed] Fix potential leak inside IntersectionObserver

Reviewed By: lunaleaps, yungsters

Differential Revision: D74361644

fbshipit-source-id: 1a5ccce1486aa200fc7318c689bfa887f713c284
2025-05-08 20:52:13 -07:00
Ramanpreet Nara e6516f2d7b IntersectionObserver: Migrate js infra to shadow node family (#51148)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51148

Intersection observer should not be holding on to shadow nodes.

This diff migrates the javascript infra to instead use families.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D74262804

fbshipit-source-id: cc090be54f7312ce32b853ddf86567bb43e676b8
2025-05-08 20:52:13 -07:00
Ramanpreet Nara a4be563935 Migrate IntersectionObserverManager to shadow node family
Summary:
IntersectionObserverManager now uses families to manage IntersectionObservers.

This diff just migrates its apis to family too.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D74263375

fbshipit-source-id: d2e5fda327dfc75f0f711932626643d49cb3322f
2025-05-08 20:52:13 -07:00
Nick Gerleman 8ed5ccca62 Expose Unsnapped Dimensions (#51181)
Summary:
X-link: https://github.com/facebook/yoga/pull/1809

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

We want to know if an artifact created during measurement can fully be reused after final layout, but the final layout is allowed to be slightly larger due to pixel grid rounding (while still allowing reuse). It's hard to tell after the fact, whether it is larger because of this rounding (though the measure is used), or if it may be a pixel larger for valid reasons.

We can expose the unsnapped dimensions of a node to give us this information, and to correlate measurement artifacts.

This is most of the time the same as the layout's measured dimension, though I don't think it's safe to use this, since anything else measuring the node after could clobber this (I think `YGNodeLayoutGetOverflow` may also be prone to this as a bug).

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D74292949

fbshipit-source-id: 05011c66a9a9480544313eb1dfe2c46bf7742bac
2025-05-08 17:45:16 -07:00
Nick Gerleman 99119a2104 Fix TextLayoutManager MeasureMode Regression (#51183)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51183

D58818560 tried to deduplicate some code, but introduced an error, where we no longer correctly incorporate the width MeasureMode into the text layout that we create, instead, passing `YogaMeasureMode.EXACTLY`.

In effect, this means the Android layout created always takes up the maximum allowable space, even if content is smaller. This is later masked, because our returned measure when `AT_MOST` is based on maximum line length, and the layout is then recreated when drawing a TextView, but means:

1. Attachments may not be positioned correctly, when using a non-left-aligned paragraph alignment
2. Directly drawing the layout shows the wrong thing

Changelog:
[Android][Fixed] - Fix TextLayoutManager MeasureMode Regression

Reviewed By: rshest

Differential Revision: D74366936

fbshipit-source-id: 3eda8c716ba9790a61c2da19023e140afbb6971d
2025-05-08 16:18:01 -07:00
Nick Gerleman 1c52eec2c6 Ensure that ShadowNode measure functions respect constraints (#51180)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51180

Android's TextLayoutManager may return widths greather than the max measure constraint.

Yoga will clamp these, but this sort of issue points to a logic bug, and creates issues when we are looking at caching text measurements based on constraint reuse.

Let's debug assert that we don't do that, and fix a case of rounding up at a pixel boundary, to ensure that it doesn't go above max width. This should theoretically be safe, since Yoga is already doing this clamping, which is what dictates final size of the TextView.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D74291373

fbshipit-source-id: 44166f2e47323384cb00f3cf4c32f398e298a63e
2025-05-08 14:41:50 -07:00
Christian Falch 65544024b3 Add script to prepare the .build folder to prebuild React Native with SwiftPM (#51195)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51195

This change adds a script that prepares the repository by creating hard links to the header files in the `.build` folder that is also gitignored

## Changelog:
[Internal] - Add sdcript to setup the repository so that we can build it properly.

Test Plan:
run:
```
node packages/react-native/scripts/ios-prebuilds.js
```
observe the folder `.build` being created with all the files.

Reviewed By: cortinico

Differential Revision: D74393116

Pulled By: cipolleschi

fbshipit-source-id: 4951e61b49db83fbebbcc265ae025f53185fec81
2025-05-08 12:59:49 -07:00
Christian Falch 500f458e5d Add utils script to create folders to prebuild React Native core (#51194)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51194

This change adds an utils script to set up folders when needed.

## Changelog:

[INTERNAL] - Add utils script

Test Plan: This is tested in the next diff of the stack.

Reviewed By: cortinico

Differential Revision: D74393298

Pulled By: cipolleschi

fbshipit-source-id: db3db61ec938d2ebe5c0bf5ae0a42aa20c673bb0
2025-05-08 12:59:49 -07:00
Christian Falch 43bfb5da11 building up to React Core (#50766)
Summary:
- Added multiple targets to Package.swift
- WIP: Builds up untill we need to touch files in React/Base

## Changelog:

[INTERNAL] - WIP: prebuilding using Swift packages

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

Test Plan: This will be tested in a diff in the stack.

Reviewed By: cortinico

Differential Revision: D74386522

Pulled By: cipolleschi

fbshipit-source-id: 7bac3c21a362c4ef79d0104727cdd3494419012f
2025-05-08 12:59:49 -07:00
Mark Verlingieri a21a4b87c3 Allow fadingEdgeLength to be set independently on the start and end of the scrollview (#51174)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51174

Allows the start and end of the scrollview to be faded to different values independently by passing an object containing a "start" and "end" value to the fadingEdgeLength prop.

To support non-uniform edge lengths we use the [FadingEdgeStrength](https://developer.android.com/reference/android/view/View#getTopFadingEdgeStrength()) api to set different values for the start/end of the scrollview. The FadingEdgeStrength value is multiplied by the FadingEdgeLength value [internally by Android when drawing the view.](https://cs.android.com/android/platform/superproject/+/android15-qpr1-release:frameworks/base/core/java/android/view/View.java;l=25007)

Because the value of FadingEdgeStrength is required to be between 0 and 1, we set setFadingEdgeLength to the max value and set the smaller side as a percentage of that value.

Changelog: [Android][Added] Allow fadingEdgeLength to be set independently on the start and end of the scrollview

Reviewed By: martinbooth

Differential Revision: D74222606

fbshipit-source-id: 7010ca803cc48450ab98c2a457fdc72ff47c29d7
2025-05-08 10:59:32 -07:00
Nick Lefever 536aa67817 Add getDiffProps for RawText component (#51179)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51179

See title

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D74365934

fbshipit-source-id: a1db8db1f3f2b63f3e3facd7070e9a12c01cbc5b
2025-05-08 09:37:26 -07:00
Nick Lefever 0dbfcda6c6 Add getDiffProps for ScrollView component (#51168)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51168

See title

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D74327336

fbshipit-source-id: 9e306400578ac6d83c49537ab2c38e86209fbcfd
2025-05-08 09:37:26 -07:00
Nick Lefever 4591bb2909 Add missing ScrollView props to ScrollProps (#51167)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51167

Adding the ScrollView properties that are android specific to the common ScrollView props so that they can be diffed in a getDiffProps implementation.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D74327335

fbshipit-source-id: 8e5683d4bf7fe0f6d54d4b97f535731721c60292
2025-05-08 09:37:26 -07:00
Nick Lefever 68baff1d67 Add getDiffProps for Unimplemented View component (#51166)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51166

See title

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D74327337

fbshipit-source-id: c5b44d833fccaa200d6019932dd5e9b1760c3af3
2025-05-08 09:37:26 -07:00
Nick Lefever 73a03d5314 Add getDiffProps for Image component (#51165)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51165

See title

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D74327298

fbshipit-source-id: 8faa04807615e223033cbede80112df4496f77ef
2025-05-08 09:37:26 -07:00
Dawid Małecki f3c289835f Move imported types from @react-native/assets-registry and @react-native/js-polyfills to react-native repo (#51192)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51192

The `build-types` script cannot currently resolve `react-native/assets-registry` and `react-native/js-polyfills`. This diff moves imported types from these packages to `react-native` to include them in generated types.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D74392568

fbshipit-source-id: cbce977b710f54dc53ce1b0fc080704b420490d4
2025-05-08 09:07:42 -07:00
Alan Lee 14cea6e70e migrate deprecated KEYCODE_BACK in Modal (#51097)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51097

**Problem:** `Event.KEYCODE_BACK`has been deprecated with targetSdk 36, predictive back will be enforced and KEYCODE_BACK no longer triggered. We need to migrate to backward compatible `OnBackPressedCallback`.
- https://developer.android.com/about/versions/16/behavior-changes-16#predictive-back.

**Solution:**
Use `OnBackPressedCallback` to handle BACK. Logic for ESC key handling still remains.
To support the callback mechanism, we are using AndroidX ComponentDialog ([src](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:activity/activity/src/main/java/androidx/activity/ComponentDialog.kt)) which is a thin wrapper on the existing Dialog.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D74162844

fbshipit-source-id: ebd0e89c29999d3dd99431a4359c442e42d23911
2025-05-08 08:50:45 -07:00
Alan Lee bc876fb3b3 migrate deprecated onBackPressed() (#51096)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51096

**Problem:** `Activity.onBackPressed()` has been deprecated and with targetSdk 36, predictive back will be enforced and the API no longer called. We need to migrate to backward compatible AndroidX `OnBackPressedCallback`.
- https://developer.android.com/about/versions/16/behavior-changes-16#predictive-back.

**Solution:**
`OnBackPressedCallback` is registered conditionally only if it is `targetSdk` 36 or greater.
If the callback in enabled, `onBackPressed()` is not called and callback is used regardless of `android:enableOnBackInvokedCallback` property in <application> or <activity> set in AndroidManifest.xml.

As a workaround callback is manually calling existing `onBackPressed()`.

This is done rather than removing onBackPressed() completely and using only `OnBackPressedCallback` as we are not sure of the impact of removing the implementation entirely. Once we determine it is safe to do so then, we should remove the workaround and fully transition to `OnBackPressedCallback`

* I also surveyed child classes extending ReactActivity for overridden `onPressedBack()` usage and found only one usage which will be handled later.

NOTE: `ReactDelegate.onHostResume()` sets up the `DefaultHardwareBackBtnHandler` using `ReactActivity` (https://fburl.com/ul47tbeo) and will be called from JS `BackHanderl.exitApp` (https://fburl.com/code/a4l2pjsw). Calling `BackHanderl.exitApp` enables predictive back to work.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D74161428

fbshipit-source-id: 2e081ba6922b315e9d1746e83a41bab5277fa62e
2025-05-08 08:50:45 -07:00
Dawid Małecki fd21570a3c Attach @deprecated tag and doc block to ProgressBarAndroid (#51136)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51136

This diff attaches doc block to ProgressBarAndroid copied from the manual TS types.

Generated types result:

```ts
import * as React from "react";
import type $$IMPORT_TYPEOF_1$$ from "./ProgressBarAndroidNativeComponent";
type ProgressBarAndroidNativeComponentType = typeof $$IMPORT_TYPEOF_1$$;
import type { ProgressBarAndroidProps } from "./ProgressBarAndroidTypes";
export type { ProgressBarAndroidProps };
declare let ProgressBarAndroid: (props: Omit<ProgressBarAndroidProps, keyof {
  ref?: React.Ref<React.ComponentRef<ProgressBarAndroidNativeComponentType>>;
}> & {
  ref?: React.Ref<React.ComponentRef<ProgressBarAndroidNativeComponentType>>;
}) => React.ReactNode;
/**
 * ProgressBarAndroid has been extracted from react-native core and will be removed in a future release.
 * It can now be installed and imported from `react-native-community/progress-bar-android` instead of 'react-native'.
 * see https://github.com/react-native-community/progress-bar-android
 * deprecated
 */
declare const $$ProgressBarAndroid: typeof ProgressBarAndroid;
declare type $$ProgressBarAndroid = typeof $$ProgressBarAndroid;
export default $$ProgressBarAndroid;

```

Changelog:
[Internal]

Reviewed By: robhogan

Differential Revision: D73855212

fbshipit-source-id: c6c09ea68c9f61f305f96c0954370bb938fc59d9
2025-05-08 08:14:32 -07:00
Fabrizio Cucci 090a8da0d1 Kotlinify ReactInstanceManagerInspectorTarget + make internal (#51196)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51196

As per title.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D74325454

fbshipit-source-id: a490614c83bd69660ecdd4cc8439a1a168de3010
2025-05-08 07:47:57 -07:00
Dawid Małecki 69fe957dcf Add transform that moves comments for default exported variable declarations (#51135)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51135

In generated types default exported variables are re-declared which shadows attached tags and doc blocks. This transform moves necessary comments on top of re-declarations to keep them accessible.

Example output for SafeAreaView:

```ts
import type { ViewProps } from "../View/ViewPropTypes";
import View from "../View/View";
import * as React from "react";
declare const exported: (props: Omit<ViewProps, keyof {
  ref?: React.Ref<React.ComponentRef<typeof View>>;
}> & {
  ref?: React.Ref<React.ComponentRef<typeof View>>;
}) => React.ReactNode;
/**
 * Renders nested content and automatically applies paddings reflect the portion
 * of the view that is not covered by navigation bars, tab bars, toolbars, and
 * other ancestor views.
 *
 * Moreover, and most importantly, Safe Area's paddings reflect physical
 * limitation of the screen, such as rounded corners or camera notches (aka
 * sensor housing area on iPhone X).
 */
declare const SafeAreaView_DEFAULT: typeof exported;
declare type SafeAreaView_DEFAULT = typeof SafeAreaView_DEFAULT;
export default SafeAreaView_DEFAULT;
```

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D74249424

fbshipit-source-id: 5cdd1c746e7fed99e3d3427d6ebf4c0e7ba3f3fd
2025-05-08 07:07:02 -07:00
Jakub Piasecki 1f795eb93d Validate that typegen script can run in action (#51189)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51189

Changelog: [Internal]

Adds a Github action that validates that the typegen script can successfully translate every necessary Flow file to TypeScript.

Reviewed By: huntie

Differential Revision: D74390916

fbshipit-source-id: 8c6d554c8681a2b92a8b182244a329ee538d9e53
2025-05-08 06:11:22 -07:00
Alex Hunt 320231c6f9 Narrow file set for no-commonjs-exports lint rule (#51191)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51191

Avoids over-matching non-runtime files such as `packages/react-native/scripts/`.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D74394261

fbshipit-source-id: dbfd13e305d51c91d36fbc844af7631f066b8297
2025-05-08 06:09:57 -07:00
ismarbesic be8595b18a Exclude selectively disabled libraries from codegen generation (#51078)
Summary:
Selectively disabling autolinking of a native dependency with components registered in the codegen configuration in react-native.config.js causes builds to crash upon launch on iOS. This is because the generated `RCTThirdPartyComponentsProvider.mm` file contains references to the excluded library using `NSClassFromString` causing the returned NSDictionary from `+[RCTThirdPartyComponentsProvider thirdPartyFabricComponents]` to be populated with nil values and therefore crashing the app. This has been confirmed in 0.78.2 and 0.79.2 but probably exists in 0.77.x as well.

The issue has been further described in https://github.com/facebook/react-native/issues/51077.

## Changelog:

[IOS][FIXED] - Skip codegen for selectively disabled libraries in react-native.config.js

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

Test Plan:
1. Install a library that has the componentProvider field set in the codegen config (see reproducer) and install the iOS pods.
2. Build the app.
3. App should run successfully without any crashes.

Reviewed By: cortinico

Differential Revision: D74248371

Pulled By: cipolleschi

fbshipit-source-id: 1ff7b477ed3d94ca45616ae243d3d2d30bd897db
2025-05-08 04:38:29 -07:00
Mateo Guzmán 04ab28fb7e Kotlin: Clean up redundant constructs (2/n) (#51170)
Summary:
Follow up from https://github.com/facebook/react-native/issues/51061 – 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 another 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/51170

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

Reviewed By: rshest

Differential Revision: D74381864

Pulled By: cortinico

fbshipit-source-id: 25244cdf384875f7cc4e2d091c8b247710de5ecf
2025-05-08 03:53:33 -07:00
Nicola Corti db18aac521 hermes-engine should build with target Java version 17 (#51162)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51162

We specify the java target version to 17 for ReactAndroid but not for hermes-engine.
This is causing it to be the default (8) which will cause our build to fail on JDK 21.
This fixes it.

Changelog:
[Internal] [Changed] -

Reviewed By: alanleedev

Differential Revision: D74325107

fbshipit-source-id: 39ba745be4fa754fb0b0408160202940a61fcd94
2025-05-08 03:17:16 -07:00
React Native Bot f75c8f6f04 Add changelog for v0.80.0-rc.0 (#51152)
Summary:
Add Changelog for 0.80.0-rc.0

## Changelog:
[Internal] - Add Changelog for 0.80.0-rc.0

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

Test Plan: N/A

Reviewed By: rshest

Differential Revision: D74333203

Pulled By: hezi

fbshipit-source-id: 052147550ecbe47f9e75dba6ebf6257a10a49f5b
2025-05-08 02:33:00 -07:00
Kacper Rożniata 473e42bbc3 fix(iOS): enable DEFINES_MODULE in React-jsc (#51160)
Summary:
Enables `DEFINES_MODULE` in `React-jsc.podspec`

After upgrading app to RN `0.79`, when installing pods with JSC enabled there is an error being thrown that

`The following Swift pods cannot yet be integrated as static libraries`
`The Swift pod 'RNFlashList' depends upon 'React-jsc', which does not define modules. ...`
when installing packages that use Swift

## Changelog:

[IOS] [CHANGED] -  enable `DEFINES_MODULE` in `React-jsc.podspec`

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

Test Plan: RNTester runs and builds correctly

Reviewed By: huntie

Differential Revision: D74325357

Pulled By: cipolleschi

fbshipit-source-id: b994b7e678633440d5e362ae6965b2d5188d34f1
2025-05-08 02:12:45 -07:00
Intl Scheduler 457f29f09c translation auto-update for batch 0/58 on master
Summary:
Chronos Job Instance ID: 1125907957818733
Sandcastle Job Instance ID: 31525199229818080

Processed xml files:
android_res/com/facebook/common/util/res/values/strings.xml
android_res/com/oculus/auth/authenticator/meta/res/values/strings.xml
android_res/com/oculus/horizon/common/res/values/strings.xml
android_res/com/oculus/horizon/platformplugin/res/values/strings.xml
android_res/com/oculus/horizon/try_before_you_buy/res/values/strings.xml
android_res/com/oculus/os/q4b/mma/res/values/strings.xml
android_res/com/oculus/horizon/mediaupload/res/values/strings.xml
android_res/com/oculus/horizon/linkedaccounts/res/values/strings.xml
android_res/com/oculus/auth/authenticator/work/res/values/strings.xml
android_res/com/oculus/auth/authenticator/oculus/res/values/strings.xml
android_res/com/oculus/auth/authenticator/instagramsso/res/values/strings.xml
android_res/com/oculus/auth/authenticator/horizonworldsplatform/res/values/strings.xml
android_res/com/oculus/auth/authenticator/facebooksso/res/values/strings.xml
android_res/com/oculus/auth/authenticator/facebook/res/values/strings.xml
android_res/com/oculus/demoapp/res/values/strings.xml
android_res/com/facebook/wearable/common/comms/notification/res/values/strings.xml
android_res/com/facebook/wearable/apps/igdirect/res/values/strings.xml
android_res/com/facebook/wearable/common/wds/theme/res/values/strings.xml
../xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/res/views/uimanager/values/strings.xml
../xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/res/systeminfo/values/strings.xml
android_res/rendercore/res/values/strings.xml
../xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/res/devsupport/values/strings.xml
android_res/com/facebook/content/res/values/strings.xml
android_res/com/facebook/common/i18n/res/values/strings.xml
android_res/com/facebook/common/timeformat/res/values/strings.xml
libraries/foa/ui/cds/widgets-litho/brandasset/res/values/strings.xml
android_res/com/meta/icon/res/values/strings.xml
android_res/com/facebook/resources/res/values/strings.xml
android_res/com/facebook/common/strings/external/res/values/strings.xml
android_res/com/facebook/common/strings/res/values/strings.xml
android_res/com/oculus/twilight/app/res/values/strings.xml
android_res/com/facebook/fbui/widget/pagerindicator/res/values/strings.xml
android_res/com/facebook/fbui/widget/contentview/res/values/strings.xml
android_res/com/facebook/stella/res/values/strings.xml
android_res/com/facebook/wearable/companion/settings/keys/res/values/strings.xml
android_res/com/bloks/foa/cds/bottomsheet/strings/res/values/strings.xml
android_res/com/facebook/reportaproblem/res/values/strings.xml
android_res/com/oculus/twilight/reportaproblem/res/values/strings.xml
android_res/com/facebook/widget/res/values/strings.xml
android_res/com/facebook/config/appspecific/res/values/strings.xml
android_res/com/facebook/fbavatar/res/values/strings.xml
android_res/com/facebook/messaging/ui/stickerstore/res/values/strings.xml
android_res/com/facebook/stickers/res/values/strings.xml
android_res/com/facebook/messaging/shared/res/values/strings.xml
android_res/com/facebook/caspian/res/values/strings.xml
android_res/com/facebook/timeline/widget/actionbar/res/values/strings.xml
android_res/com/facebook/showpages/res/values/strings.xml
android_res/com/facebook/nux/res/values/strings.xml
android_res/com/facebook/facecast/common/badge/res/values/strings.xml
android_res/com/facebook/nativetemplates/res/values/strings.xml
android_res/com/facebook/iorg/common/upsell/res/values/strings.xml
android_res/com/facebook/iorg/common/res/values/strings.xml
android_res/com/facebook/zero/common/res/values/strings.xml
android_res/com/facebook/video/components/feed/res/values/strings.xml
android_res/com/facebook/runtimepermissions/res/values/strings.xml
android_res/com/facebook/dialtone/res/values/strings.xml
android_res/com/oculus/twilight/gcm/messaging/res/values/strings.xml
android_res/com/oculus/twilight/gcm/followrequest/res/values/strings.xml
android_res/com/facebook/rtc/notification/res/values/strings.xml
android_res/com/facebook/rp/platform/ui/common/res/values/strings.xml
android_res/com/facebook/zero/messenger/semi/res/values/strings.xml
android_res/com/facebook/zero/res/values/strings.xml
android_res/com/facebook/widget/facepile/res/values/strings.xml
android_res/com/facebook/tabbar/res/values/strings.xml
android_res/com/facebook/ui/toolbar/res/values/strings.xml
android_res/com/facebook/dialtone/messenger/res/values/strings.xml
android_res/com/facebook/catalyst/shell/res/values/strings.xml
android_res/com/facebook/rtc/runtimepermissions/manager/res/values/strings.xml
android_res/com/facebook/rtc/connectionservice/res/values/strings.xml
android_res/com/facebook/rtc/helpers/connectionservicecoordinator/res/values/strings.xml
android_res/com/facebook/rp/platform/ui/callstatus/participantinfo/res/values/strings.xml
android_res/com/facebook/rp/platform/ui/callstatus/res/values/strings.xml
android_res/com/facebook/rp/platform/ui/incoming/res/values/strings.xml
android_res/com/facebook/rp/platform/ui/participant/res/values/strings.xml
android_res/com/facebook/rp/platform/ui/pip/res/values/strings.xml
android_res/com/facebook/rp/platform/ui/header/res/values/strings.xml
android_res/com/facebook/rp/platform/ui/callcontrols/audioselector/res/values/strings.xml
android_res/com/facebook/rp/platform/ui/callcontrols/res/values/strings.xml
android_res/com/facebook/rp/platform/ui/incall/res/values/strings.xml
android_res/com/facebook/rp/platform/ui/ended/res/values/strings.xml
android_res/com/facebook/payments/dcp/res/values/strings.xml
libraries/smartcapture/common/common-ui/res/values/strings.xml
android_res/com/bloks/common/components/autogenmediagallery/res/values/strings.xml
android_res/com/facebook/ui/mainview/res/values/strings.xml
android_res/com/facebook/audience/stories/storysurface/activity/main/res/values/strings.xml
android_res/com/facebook/horizon/res/values/strings.xml
android_res/com/meta/fxmetalogin/res/values/strings.xml
android_res/com/instagram/ui/common/res/values/strings.xml
android_res/com/instagram/actionbar/res/values/strings.xml
android_res/com/instagram/tabs/res/values/strings.xml
android_res/com/instagram/avatar/res/values/strings.xml
android_res/com/instagram/icons/igax/res/values/strings.xml
android_res/com/instagram/debug/res/values/strings.xml
android_res/com/facebookpay/widget/res/values/strings.xml
android_res/com/facebookpay/ecpexception/res/values/strings.xml
android_res/com/facebookpay/expresscheckout/res/values/strings.xml
android_res/com/fbpay/auth/res/values/strings.xml
android_res/com/oculus/twilight/hsrmobile/res/values/strings.xml
android_res/com/oculus/twilight/calling/res/values/strings.xml
../xplat/messengervr/msys/feature_aggregation/src/i18n/res/values/strings.xml

allow-large-files
ignore-conflict-markers
opt-out-review
drop-conflicts

Differential Revision: D74381578

fbshipit-source-id: 3e17ebecf9bd5a6822bf98c9d195885320705655
2025-05-08 01:28:36 -07:00
Maddie Lord bbc1e121c7 Allow Custom ReactNativeFeatureFlags for Shell 2.0 (#51177)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51177

Introduce DefaultNewArchitectureEntryPoint.loadWithFeatureFlags() to allow custom feature flags while using DefaultNewArchitectureEntryPoint

Reviewed By: arushikesarwani94

Differential Revision: D74228467

fbshipit-source-id: ec3fe7edd31cc9713498b316d6306eaa3686398b
2025-05-07 18:58:21 -07:00
Jan Kassens a96aeab147 use difftrain version of eslint-plugin-react-hooks
Summary:
Switches to use the version imported through diff train for `eslint-plugin-react-hooks`. This should allow us to finally use component syntax in RN.

bypass-github-export-checks

Changelog: [internal]

Reviewed By: yungsters

Differential Revision: D74203162

fbshipit-source-id: d9ea17e5c6533e8df0889404a7f7798f6f5061c0
2025-05-07 14:57:36 -07:00
Joe Vilches be60aed1b0 Allow links that are entire text views to be focusable when co-opted (#51138)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51138

The co-opting logic failed to account fo the case where the entire text view as a link and therefore turns off ax. In this case I think it makes sense to re-focus that element again so the user can interact with the link.

Changelog: [Internal]

Reviewed By: jorge-cab

Differential Revision: D74262675

fbshipit-source-id: c8d11cdff76cd92170581d167d5a8df64d0dd101
2025-05-07 14:46:39 -07:00
Samuel Susla 1c312befd5 add tests for some accessibility props (#51155)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51155

changelog: [internal]

we have experienced breakages where we stopped propagating accessibility prop to the mounting layer. These tests should catch it.

Reviewed By: fabriziocucci

Differential Revision: D74317767

fbshipit-source-id: 72c6d8c788afe3a9d4d41f7cfc0aa37605b20b6a
2025-05-07 13:02:18 -07:00