Commit Graph
36610 Commits
Author SHA1 Message Date
Mofei ZhangandFacebook GitHub Bot af4cfbf03f repro edge cases for noEmit and module opt-outs (#33144)
Summary:
see test fixtures
 ---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33144).
* #33146
* #33145
* __->__ #33144

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

Reviewed By: jackpope

Differential Revision: D74404265

fbshipit-source-id: 8a2fc2856e2da9ca7c63d8d49191c4f9e6b015b9
2025-05-12 13:51:47 -07:00
Fabrizio CucciandFacebook GitHub Bot 4918b30f49 Kotlinify ViewManagerRegistry (#51262)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51262

As per title.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D74571782

fbshipit-source-id: 4acec9b9c0801d863074b7a91fb116780f22929a
2025-05-12 13:50:10 -07:00
Ruslan LesiutinandFacebook GitHub Bot 7430ee0b99 Define precise return types for toJs conversions, instead of generic jsi::Value (#51224)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51224

Changelog: [Internal]

We have a bunch of places where we rely on implicit conversion operators of `jsi::Value` and return some primitive type.

This doesn't work well with Bridging, because currently it doesn't take into account these implicit operator conversions: primitives won't be treated as primitivies, but rather as generic `jsi::Value`, which could be many things.

We should be explicit about return type in `toJs`, because it affects the type checking logic.

Reviewed By: javache

Differential Revision: D74478571

fbshipit-source-id: 0633159c5af3a02aafe14e2b137c133d4554a5f8
2025-05-12 12:38:58 -07:00
Ruslan LesiutinandFacebook GitHub Bot e403b510d0 Support bridging for Class methods return types (#51223)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51223

Changelog:
[General][Added] - Added support for bridging Class methods return types

Previously, this wouldn't work, unless you define your C++ implementation of the TM to have primitive return type that can be converted to JavaScript's type.

Reviewed By: javache

Differential Revision: D74478572

fbshipit-source-id: 75c7f589559394704446be1ebac245d38a5c4b2b
2025-05-12 12:38:58 -07:00
Mohamed SalamaandFacebook GitHub Bot 775c16d8b4 Revert D74567102: Migrate PromiseImpl to Kotlin
Differential Revision:
D74567102

Original commit changeset: 1a7a36a88c04

Original Phabricator Diff: D74567102

fbshipit-source-id: 30814137c711757079fdc574dd21715089b23a25
2025-05-12 10:11:02 -07:00
Pieter De BaetsandFacebook GitHub Bot 5413304530 Convert com.facebook.react.runtime.ReactHostImpl to Kotlin (#51017)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51017

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D73846053

fbshipit-source-id: 98017000e8f10df4156b232bc8b5d6e132502ea5
2025-05-12 10:02:19 -07:00
Tim YungandFacebook GitHub Bot 7e5a2663f9 RN: Simplify createAnimatedPropsHook-test.js (#51234)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51234

Since `createAnimatedPropsHook-test.js` no longer needs to override feature flags, clean up some of the extra logic.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D74535116

fbshipit-source-id: 09dd4c5085f6ee1cbf7d87ab2b7c320119e69651
2025-05-12 09:15:43 -07:00
Szymon RybczakandFacebook GitHub Bot 0925ee8545 Update Callstack description in ECOSYSTEM.md (#51226)
Summary:
Updates Callstack's description in `ECOSYSTEM.md` file.

## Changelog:

[Internal] - Updates Callstack's description in `ECOSYSTEM.md` file.

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

Test Plan: n/a

Reviewed By: NickGerleman

Differential Revision: D74483225

Pulled By: cortinico

fbshipit-source-id: baab5984b4580c0395c1a987a8890d8465e139f1
2025-05-12 08:14:45 -07:00
Rubén NorteandFacebook GitHub Bot 0766587b5d Add playground benchmark (#51259)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51259

Changelog: [internal]

We recently added `Playground-itest` as a quick way to test things with Fantom without committing them.

This does the same for benchmarks, so we can quickly answer questions like:

> is `key in obj` faster than `obj[key]`?

Without having to create a new benchmark manually.

Reviewed By: yungsters

Differential Revision: D74578297

fbshipit-source-id: d86604d459f15652d0c2e1ad16a99d011a1324ca
2025-05-12 07:59:59 -07:00
Evan BaconandFacebook GitHub Bot eedd60b9e6 chore: convert View to React 19 (#51023)
Summary:
- Convert View implementation to React 19:
  - Remove legacy `forwardRef` in favor of built-in `ref` prop.
  - Use `use` API instead of `useContext`.
  - Drop the extraneous `.Provider` for `TextAncestor` context.
  - Remove `displayName` in favor of component name. I'm not 100% sure this is a full fallback but it is valid according to `react/display-name` eslint rule—https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/display-name.md
- Based on discussion with Nicola Carti and Riccardo Cipolleschi.
- I tried using flow `component` keyword but it's not enabled in this project. Given the `react-native` package is shipped untranspiled, it's probably safer to avoid newer flow types.
- Overall matched the component style of LogBox.
- It's unclear the exact right way to type a ref since it should be optional for external users of the component but required inside the component. Erring on the side of caution and using optional types so users don't get type errors when `ref` isn't defined.

## Changelog:

[GENERAL] [BREAKING] Upgrade `View` component to React 19.

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

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

Test Plan: - Type checks should pass.

Reviewed By: rshest

Differential Revision: D74546184

Pulled By: yungsters

fbshipit-source-id: b8257e3a75477c1117b19cd3f8e0843947b092ca
2025-05-12 07:14:22 -07:00
Samuel SuslaandFacebook GitHub Bot 5d7f35cd7c add test for BaseTextProps.writingDirection (#51245)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51245

changelog: [internal]

Add test to prevent https://github.com/facebook/react-native/issues/51235 from happening in the future.

Reviewed By: cipolleschi, rubennorte

Differential Revision: D74571453

fbshipit-source-id: 49d8400543516a861c9034a8be562ee81b323c25
2025-05-12 06:14:14 -07:00
Jakub PiaseckiandFacebook GitHub Bot c9f2055097 Fix generated types in @react-native/virtualized-lists being used without opt-in (#51246)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51246

Changelog: [General][Fixed] Fix generated types in react-native/virtualized-lists being used without opt-in

D71969602 introduces `exports` field to `package.json` files in `react-native` and `virtualized-lists`. In that diff, the `types` in `virtualized-lists` by default pointed to the new generated types without requiring the opt-in.

This fixes that by requiring the opt-in before using the generated types.

Reviewed By: huntie

Differential Revision: D74573321

fbshipit-source-id: fe05b0204a7200c1c91aac2614aa786bbbced2a5
2025-05-12 04:53:20 -07:00
Mateo GuzmánandFacebook GitHub Bot 25abb0acdf Migrate PromiseImpl to Kotlin (#51241)
Summary:
Migrate com.facebook.react.bridge.PromiseImpl to Kotlin.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.bridge.PromiseImpl to Kotlin

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

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

Reviewed By: rshest

Differential Revision: D74567102

Pulled By: cortinico

fbshipit-source-id: 1a7a36a88c0499e5bc35dc37d276219aaf823c90
2025-05-12 04:48:28 -07:00
Nick LefeverandFacebook GitHub Bot a12d9f9d33 Fix image source size props in getDiffProps (#51222)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51222

The size parameters are flattened in the source object in the Android image component. This diff converts the `size` object to `width` and `height` props directly set on the source object, fixing image source setting more than one image source.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D74477884

fbshipit-source-id: f6064b4222d5eeafd5d74f9a2044babedd1e291b
2025-05-12 04:01:03 -07:00
Nick LefeverandFacebook GitHub Bot 3edc8d4e2c Add getDiffProps for Paragraph component (#51219)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51219

See title

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D74473177

fbshipit-source-id: 88d8d29a1640fd9217460ac04f172f821bb47a91
2025-05-12 04:01:03 -07:00
Nick LefeverandFacebook GitHub Bot 571a0ae7bc Add getDiffProps for Text component (#51218)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51218

See title

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D74473101

fbshipit-source-id: 7303a8b184f42e8b264a2d37c5a6570252c64d54
2025-05-12 04:01:03 -07:00
Nick LefeverandFacebook GitHub Bot 0cdf5c16b4 Add updateDiffProps to BaseTextProps (#51217)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51217

Add helper method to build the prop diffing based on the BaseTextProps which are used by the Text and Paragraph props.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D74473004

fbshipit-source-id: 0ae8c0c033ee136da3b8376bd485f8926310dcd4
2025-05-12 04:01:03 -07:00
zhongwuzwandFacebook GitHub Bot 3461e98936 Fabric: Fixes Text style prop 'writingDirection' not working on IOS New Architecture (#51238)
Summary:
Fixes https://github.com/facebook/react-native/issues/51235 .

## Changelog:

[IOS] [FIXED] - Fabric: Fixes Text style prop 'writingDirection' not working on  IOS New Architecture

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

Test Plan: Repro please see https://github.com/facebook/react-native/issues/51235

Reviewed By: sammy-SC

Differential Revision: D74564832

Pulled By: cipolleschi

fbshipit-source-id: 82702ec3b3e963c454e23a9b18543cae6f378749
2025-05-12 03:56:25 -07:00
Mateo GuzmánandFacebook GitHub Bot 77fccb73fe Make DeprecatedInNewArchitecture internal (#51201)
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.common.annotations.DeprecatedInNewArchitecture).

This class in particular is not in the ReactAndroid.api, so I have the question on whether we should leave these annotations marked as public in case we are already reducing the visibility in another way (and If that's the case, we can close this PR)

## Changelog:

[INTERNAL] - Make com.facebook.react.common.annotations.DeprecatedInNewArchitecture internal

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

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

Reviewed By: rshest

Differential Revision: D74461086

Pulled By: cortinico

fbshipit-source-id: a58aa4794c91d632ce9f21a1021de7aa23e662f8
2025-05-12 03:46:30 -07:00
Riccardo CipolleschiandFacebook GitHub Bot a3da4abb31 Remove react-native-exit-app from nightly testing (#51230)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51230

react-native-exit-app last commit is from 2 years ago.
Removing it as it is broken with our nightly integration

## Changelog:
[Internal] - Remove react-native-exit-app from nightly testing

Reviewed By: cortinico

Differential Revision: D74527792

fbshipit-source-id: 0974b2d857aa6f76c59b0411204798a5fe48cffe
2025-05-12 02:36:39 -07:00
Jakub PiaseckiandFacebook GitHub Bot 32ce95cc01 Move transforms to build-types (#50982)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50982

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D73667539

fbshipit-source-id: dc9ab6f3efef17f8ffd58a854363b39a31ec59d7
2025-05-11 22:49:43 -07:00
Tim YungandFacebook GitHub Bot 77c1eb6154 RN: Migrate VirtualView to Feature Flags (#51233)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51233

Migrates internal operational and experimental feature flags to React Native's feature flag system, in order to simplify integration of other infrastructure features (e.g. Fantom).

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D74534921

fbshipit-source-id: 1559cba4f208a554bb043a203f331062036c60de
2025-05-11 00:30:21 -07:00
Rubén NorteandFacebook GitHub Bot 996be87071 Add Playground test (#51220)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51220

Changelog: [internal]

Just a playground file to do quick tests in the Fantom environment.

For example, I just used it to know if Hermes supports `AggregateError`, which does:

```
  it('...', () => {
    console.log('AggregateError', global.AggregateError);
  });
```

{F1977824992}

Reviewed By: lenaic

Differential Revision: D74474870

fbshipit-source-id: cbe8a287738b09afe336ae479cc3105d1474e58b
2025-05-10 01:53:28 -07:00
Jan KassensandFacebook GitHub Bot 32fafdf980 cleanup shipped flag enableFabricCompleteRootInCommitPhase
Summary:
Flag was removed in {D74196673}, this cleans up the dynamic flag.

bypass-github-export-checks

Changelog: [internal]

Reviewed By: jackpope

Differential Revision: D74493584

fbshipit-source-id: 6ade542b7e1bd9c4367b7dbef4d2f1ec2d79d0df
2025-05-09 23:01:51 -07:00
Chi TsaiandFacebook GitHub Bot 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 TsaiandFacebook GitHub Bot 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 TsaiandFacebook GitHub Bot 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
generatedunixname89002005287564andFacebook GitHub Bot 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 GerlemanandFacebook GitHub Bot 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ánandFacebook GitHub Bot 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 BaetsandFacebook GitHub Bot 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 CortiandFacebook GitHub Bot 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 ZaidmanandFacebook GitHub Bot 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 NorteandFacebook GitHub Bot 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 NorteandFacebook GitHub Bot 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 NorteandFacebook GitHub Bot 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 NorteandFacebook GitHub Bot 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 FalchandFacebook GitHub Bot 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 LoriotandFacebook GitHub Bot 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 LoriotandFacebook GitHub Bot 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 NaraandFacebook GitHub Bot 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 NaraandFacebook GitHub Bot 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 NaraandFacebook GitHub Bot 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 NaraandFacebook GitHub Bot 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 GerlemanandFacebook GitHub Bot 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 GerlemanandFacebook GitHub Bot 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 GerlemanandFacebook GitHub Bot 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 FalchandFacebook GitHub Bot 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 FalchandFacebook GitHub Bot 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 FalchandFacebook GitHub Bot 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