279 Commits
Author SHA1 Message Date
React Native Bot c30b7f8685 Release 0.88.1
#publish-packages-to-npm&latest
2026-10-27 12:09:29 +00:00
Alan Hughes 8aea8d9bad Fix StatusBar style and visibility on iOS 27 (#58926)
Summary:
Fixes https://github.com/react/react-native/issues/58758.
In apps built with the iOS 27 SDK, `StatusBar.setBarStyle` and `StatusBar.setHidden` do nothing. `RCTStatusBarManager` uses the `UIApplication` status bar setters, and UIKit turns them into no-ops for apps linked against the iOS 27 SDK. Apps built with the iOS 26 SDK are not affected. A plain UIKit app built with the iOS 27 SDK shows that with `UIViewControllerBasedStatusBarAppearance` set to `NO`, nothing can change the status bar on iOS 27. With `YES`, the view controller methods still work.

This change moves `StatusBar` to the view controller model. The module stores the requested style, hidden state, and animation in a new `RCTStatusBarAppearance` class and calls `setNeedsStatusBarAppearanceUpdate` on the presented view controller. The default root view controller from `RCTDefaultReactNativeFactoryDelegate` and the Fabric modal controller return those values. The modal keeps the status bar that was on screen when it opened until JS changes it, so a status bar set natively (ie by react-native-screens) is not lost. With `NO`, the module still calls the `UIApplication` setters, so apps built with older SDKs keep working. When React Native is built with the iOS 27 SDK and runs on iOS 27, it also logs one warning that tells the developer to set the key to `YES`.

Apps that override `createRootViewController` need their view controller to return the `RCTStatusBarAppearance` values for `StatusBar` to work on iOS 27.

A similar change, https://github.com/react/react-native/issues/25919, landed in March 2020 and was reverted the next day

[IOS] [FIXED] - `StatusBar` style and visibility work on iOS 27 for apps built with the iOS 27 SDK when `UIViewControllerBasedStatusBarAppearance` is `YES`. Custom root view controllers must return the `RCTStatusBarAppearance` values.

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

Test Plan:
12 new XCTest cases in `RCTStatusBarAppearanceTests`. The OSS XCTest file has no internal BUCK owner and was not run locally.

Validation for the review update:
- Applied the explicit legacy-API guard to both `setStyle:animated:` and `setHidden:withAnimation:`. The appearance-state update remains unconditional; UIKit setters and warnings remain limited to apps using app-level status bar appearance.
- Meta-managed `clang-format` and `arc lint` passed for `RCTStatusBarManager.mm`.
- Built `ReactApple`, `CoreModulesApple`, `RCTFabricApple` and `RCTAppDelegateApple` for `iphonesimulator-arm64` with annotation checks enabled.
- No public headers changed, so API snapshots are unchanged.
- Diff-time CI will rerun for the updated code.

Reviewed By: javache

Differential Revision: D127555263

Pulled By: cipolleschi

fbshipit-source-id: 9a6d21236987e309917e620387b34e88e7da24c7
(cherry picked from commit bd08dafc98)
2026-10-26 16:01:49 +00:00
React Native Bot 5c35c82cf7 Release 0.88.0
#publish-packages-to-npm&latest
2026-10-15 11:38:19 +00:00
React Native Bot 1a72139b30 Release 0.88.0-rc.6
#publish-packages-to-npm&next
2026-10-14 14:54:05 +00:00
React Native Bot a3249a2e43 Release 0.88.0-rc.5
#publish-packages-to-npm&next
2026-10-12 20:22:35 +00:00
React Native Bot 62e60c3521 Release 0.88.0-rc.4
#publish-packages-to-npm&next
2026-10-05 17:21:13 +00:00
React Native Bot 0782c61fe6 Release 0.88.0-rc.3
#publish-packages-to-npm&next
2026-09-28 09:11:17 +00:00
React Native Bot 215169c51b Release 0.88.0-rc.2
#publish-packages-to-npm&next
2026-09-21 16:15:27 +00:00
Rob Hogan f2439a83cf [0.88][LOCAL] Bump Metro minimum to 0.87.1
## Summary:

Bump minimum Metro version to 0.87.1, within the same semver range, to ensure upgraders get the same version as fresh projects would.

Mostly fixes, including a couple of `Platform` inlining corrections. It also replaces the `image-size` dependency to clear CVE alerts.

Metro release notes: https://github.com/react/metro/releases/tag/v0.87.1

## Changelog:

[General] [Changed] - Bump Metro minimum to 0.87.1

## Test Plan:

```
yarn install --frozen-lockfile --ignore-scripts
yarn flow-check
yarn test packages/metro-config packages/community-cli-plugin packages/dev-middleware
```

(cherry picked from commit 18a22b1d59)
2026-09-21 10:24:24 +01:00
React Native Bot 05a41cdc67 Release 0.88.0-rc.1
#publish-packages-to-npm&next
2026-09-15 22:16:48 +00:00
Rubén Norte 0b0ce740cb React 19.3.0 sync int React Native OSS (#58446)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/58446

Sync of React 19.3.0 into React Native

Changelog: [General][Changed] - Sync React 19.3.0 into React Native

jest_e2e[run_all_tests] bypass-github-export-checks

Reviewed By: fabriziocucci

Differential Revision: D119490598

fbshipit-source-id: 4a00bd01fd1a4b1c48ffcae182f1b88cd0cf9e06
(cherry picked from commit b0b71421c1)
2026-09-14 10:15:02 +01:00
React Native Bot f065722abe Release 0.88.0-rc.0
#publish-packages-to-npm&next
2026-09-08 13:53:53 +00:00
Sam Zhou fdcce4f673 Turn on experimental.new_this_typing in xplat (#58293)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/58293

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D118513884

fbshipit-source-id: a33a81eab930ac29663410cf04163aebb87062ad
2026-09-02 13:03:29 -07:00
generatedunixname1026736676487289 2fa055f6a7 Upgrade Flow in fbsource (#58192)
Summary: Pull Request resolved: https://github.com/react/react-native/pull/58192

Reviewed By: SamChou19815

Differential Revision: D117992492

fbshipit-source-id: bc3a32b4420243b6675439e0840559b85507c3dd
2026-08-29 11:23:04 -07:00
artus9033 609bdddabf Update apps for SceneDelegate support (#57717)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57717

Update the RNTester and HelloWorld JS layers for SceneDelegate-based window resizing and app lifecycle behavior.

Changelog:
[iOS][Changed] - Update RNTester and HelloWorld for SceneDelegate lifecycle behavior

Test Plan:
- Verify Dimensions updates after resizing the RNTester window.
- Verify the HelloWorld app renders with the SceneDelegate bootstrap.
- `arc f`
- `arc lint`

Reviewed By: javache

Differential Revision: D113758227

Pulled By: cipolleschi

fbshipit-source-id: 20831f84335b1d6c7f6bf4176d1dbba98a13bdce
2026-08-25 07:58:35 -07:00
Kamil Paradowski b03652af78 ResizeObserver Web API implementation (#57723)
Summary:
> Stack 3/3 — parent: `feat/LayoutEventEmitter`. Review the two parents first.

Implements the [`ResizeObserver`](https://drafts.csswg.org/resize-observer/) Web API for the New Architecture, behind the `enableResizeObserverByDefault` flag (off by default).

The motivation is Web compatibility, and it's more capable than `onLayout`: callers pick which box to observe (`content-box`, `border-box`, `device-pixel-content-box`) and the sizes for those boxes are delivered in the notification.

The design is as follows: JS `ResizeObserver`/`ResizeObserverEntry`/`ResizeObserverSize` on top of a manager singleton and the `NativeResizeObserver` TurboModule, using the same notify + `takeRecords` pull model. In C++, `ResizeObserverManager` collects observed targets whose layout changed at commit time (via `shadowTreeDidCommit`) and then computes and delivers observations in the event loop's "update the rendering" step (`RuntimeSchedulerResizeObserverDelegate::runResizeObservations`), as the spec requires. Requires bridgeless + the modern event loop; the legacy scheduler gets a no-op delegate.

`runResizeObservations` implements the spec's depth-increasing gather/broadcast loop: each round gathers observations deeper than the shallowest target delivered in the previous round, so a callback that synchronously resizes or observes a shallower node is still delivered within the same tick.

Known deviations from the spec (each pinned by a test):
- Resizes triggered from a callback via a React state update are delivered on the next tick rather than within the current loop, because RN has no synchronous re-layout. Callbacks that resize or `observe()` synchronously do run further rounds in the same tick, and report `ResizeObserver loop completed with undelivered notifications` when an observation is left undelivered.
- The loop carries a hard cap of 100 iterations on top of the spec's depth rule. Reaching the cap reports the loop error and stops, so a pathological callback degrades to a log line instead of a frozen app.
- Re-observing a target with the same box is a no-op and does not re-deliver. This matches browsers, not the literal `observe()` algorithm.
- Callback order across observers follows first-`observe()` order rather than construction order.

## Changelog:

[INTERNAL] [ADDED] - Add the `ResizeObserver` API, behind the `enableResizeObserverByDefault` feature flag

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

Test Plan:
- Fantom `ResizeObserver-itest.js` covers many test scenarios.
 - rn-tester has `ResizeObserver` examples (box sizes, text, visibility); verified initial, resize, and animation-driven delivery there.
 - `RuntimeSchedulerTest.cpp` new test scenarios for update rendering loop.

Reviewed By: christophpurrer

Differential Revision: D114045415

Pulled By: javache

fbshipit-source-id: a561d5321ba45adb35f46ffb0cf26ad78eb3bae6
2026-08-19 02:42:37 -07:00
Dawid Małecki b7f0baf8f9 Emit a real framework for React-cxxstableapi under use_frameworks! (#57936)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57936

`react/cxxstableapi` is a header-only module — the stable API guards are pure
preprocessor headers with no compilable source. Under `use_frameworks!`,
CocoaPods emits a `PBXAggregateTarget` for a pod with no compilable sources, and
an aggregate target produces no `.framework`, so pods depending on
`React-cxxstableapi` cannot resolve the guard headers.

Add an anchor translation unit so the pod has one source and CocoaPods emits a
real framework target instead, and widen the podspec's build-from-source glob to
pick it up. The prebuilt glob stays headers-only, since prebuilt pods do not
generate frameworks. This mirrors the existing `CSSDummy.cpp` anchor for the
header-only `React-renderercss` pod.

Also register `react/cxxstableapi` as a subdirectory of the Fantom tester CMake
build so the guard headers resolve there.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D115859623

fbshipit-source-id: 47e63560e1478ad507d1f28f053b925438232ea4
2026-08-13 08:20:05 -07:00
artus9033 7bfe32fd33 Add SceneDelegate support (#57700)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57700

Add SceneDelegate lifecycle support to React Native iOS while retaining the AppDelegate path for backwards compatibility.

Update linking, window resolution, bootstrap APIs, RNTester, HelloWorld, and generated API snapshots for scene-based applications.

Changelog:
[iOS][Added] - Add SceneDelegate lifecycle support

Test Plan:
- `buck2 build --flagfile fbsource//fbobjc/mode/buck2/linux --config fbobjc.react_native_debug=development --flagfile fbsource//fbobjc/mode/iphonesimulator-arm64 --flagfile fbsource//fbobjc/mode/jest-coverage --config xplat.available_platforms=CXX,APPLE --config cxx.default_platform=iphonesimulator-arm64 --config user.sandcastle_build_mode=profile --config user.platform_flavor=iphonesimulator-arm64 //xplat/js/react-native-github/packages/rn-tester:RNTesterIOS`
- `xcodebuild -quiet -workspace RNTesterPods.xcworkspace -scheme RNTester -configuration Debug -destination "generic/platform=iOS Simulator" CODE_SIGNING_ALLOWED=NO build`
- `arc lint`
- Evaluate RNTester with the `RNTester` SceneDelegate scheme.
- Evaluate RNTester with the `RNTester (AppDelegate)` legacy scheme.
- Verify HelloWorld bootstrap and deep linking.

Reviewed By: cortinico, javache

Differential Revision: D113758228

Pulled By: cipolleschi

fbshipit-source-id: 31174c03a0936ca397fc1d061650fc0f582bdda7
2026-08-11 03:59:23 -07:00
Ruslan Lesiutin 2bb56dc94b Add enableConditionalUseWarning React feature flag (#57783)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57783

# Changelog: [Internal]

Adds the `enableConditionalUseWarning` dynamic React feature flag, which the React renderer reads from `ReactNativeInternalFeatureFlags`. The flag gates the new warning for conditional use of `use()` based on cache state: https://react.dev/warnings/conditional-use-of-use

This is a dev-only warning, I don't see any reasons to control this via gk.

Reviewed By: antonk52

Differential Revision: D114407789

fbshipit-source-id: d63dd09180e6560a82d178610c7ae24b9e31b65e
2026-08-03 05:40:14 -07:00
Sam Zhou e6fd1a3e7c Replace hermes-{parser,eslint} with flow-{parser,eslint} in OSS projects (#57772)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57772

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D114245899

fbshipit-source-id: fa42b5276a5f6fe0d22e301a4cfc438122d70e6d
2026-07-30 18:23:59 -07:00
Sam Zhou 3bdc478cb7 Switch over to flow-eslint for linting (#57771)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57771

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D114238264

fbshipit-source-id: 22a63547276fd5c1cf161cd65284d464cfeea9d5
2026-07-30 17:10:20 -07:00
Alex Hunt 97727ba67f Fix compat with extensionless scripts/* imports (#57718)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57718

**Context**

Replaces https://github.com/react/react-native/pull/57709, which identified a real bug in 0.87 from the combination of:

- https://github.com/react/react-native/pull/57276
- https://github.com/react/react-native/pull/57652

```
$ npx react-native spm add
error Cannot find module '.../node_modules/react-native/scripts/setup-apple-spm'

$ npx react-native codegen
error Cannot find module '.../node_modules/react-native/scripts/codegen/generate-artifacts-executor'
```

**This diff**

- Fix — and exclusively switch to — extensionless imports rather than requiring `.js`.
- Update in-repo consumers.

The previous single mapping is now an extension-aware mapping:
- `./scripts/*` now appends `.js`, so `react-native/scripts/foo` resolves to `foo.js`.
- `.sh` and `.rb` stay reachable via explicit `./scripts/*.sh` and `./scripts/*.rb` passthrough patterns.

**Impact**

- Explicit `react-native/scripts/*.js` specifiers no longer resolve, so JavaScript paths must be imported without an extension.
- Files under `scripts/` with extensions other than `.js`, `.sh`, or `.rb` are no longer exposed through `./scripts/*`.
    - These have no open source consumers.

Changelog:
[General][Fixed] - (RC4 only, drop for main changelog): `react-native/scripts/*` imports once again expand `.js` extensions
[General][Breaking] - Extensionless `react-native/scripts/*` imports are now **mandated**; explicit `.js` import specifiers are rejected.

Reviewed By: rubennorte

Differential Revision: D113898792

fbshipit-source-id: d72f60be2c08ab97871e336645856c9029e74ae2
2026-07-28 09:03:20 -07:00
Janic Duplessis 26769a00b2 Use asset catalog for iOS images (#30129)
Summary:
Use an asset catalog for images on iOS. At build time, `react-native-xcode.sh` has the bundler emit packager image assets into a staging asset catalog (`--asset-catalog-dest`, already in `react-native/community-cli-plugin`), compiles it with `actool` into an `RNAssets.bundle` inside the app, and the native image loader resolves images by name from that bundle's `Assets.car` with `[UIImage imageNamed:inBundle:]` instead of reading loose files.

Properties worth calling out:
- **One opt-in switch, no project changes.** The feature is gated on the `RCTUseAssetCatalog` key in the app's Info.plist, and that key is the single source of truth: the native loader reads it (a build-time constant, read once), and `react-native-xcode.sh` reads the same key to decide whether to bundle images into the catalog — so the build and the runtime cannot disagree on where image assets live. Because the script owns the catalog end to end (staged in derived files, compiled into the app's resources next to `main.jsbundle`), **migration is adding one Info.plist key** — no `.xcassets` to create, no build-phase or project changes.
- **No fallback.** The catalog path is a single lookup with no filesystem fallback — a mis-bundled asset logs an `RCTLogError` (instead of silently rendering nothing) rather than adding an `fs` stat to the hot path.
- **Parity with the CLI, OTA-safe.** The native side resolves a catalog name only for what the CLI actually emits into the catalog: png/jpg/jpeg under main-bundle `assets/…` (mirroring `isCatalogAsset`). Everything else — gif/webp packager assets, `.bundle` sub-bundles, OTA assets outside the main bundle — falls through to the existing loader. (This also adds `jpeg` to `RCTIsImageAssetsPath`, which previously listed only `png`/`jpg` — an oversight, since `.jpeg` is the same kind of bundled image; it is now treated like `png`/`jpg` regardless of the catalog.)
- **No interference with Xcode's own asset pipeline.** The app's `Images.xcassets`, asset symbol generation (`UIImage(resource:)`), and `CompileAssetCatalog` are untouched: the RN catalog never enters the Xcode project, so there are no build-phase ordering constraints and nothing to disable.

## Changelog:

[iOS] [Added] - Use asset catalog for ios images

## Performance

**What was measured:** the time to *resolve* an asset to a `UIImage` inside `RCTImageFromLocalAssetURL` — a compiled-catalog name lookup vs. the legacy `imageNamed:` search + `imageWithContentsOfFile:` on loose files. Decode is deferred in both paths (and costs the same), so this is resolve latency, not end-to-end render time. It matters because `RCTLocalAssetImageLoader` loads local assets synchronously to avoid flicker, so this time sits on the critical path once per distinct image. Setup: RNTester, Release, new arch, iOS simulator, first load of each distinct image (UIKit caches repeats — repeat loads are ~10 µs in both builds).

Raw per-load numbers (final implementation, `RNAssets.bundle`), in load order:

| # | image | catalog (µs) | filesystem (µs) |
|---|---|---:|---:|
| 1 | `searchicon` ¹ | 1,081 | 4,497 |
| 2 | `bottomnavcomponentsicondark` | 320 | 710 |
| 3 | `bottomnavplaygroundsiconlight` | 147 | 422 |
| 4 | `bottomnavapisiconlight` | 29 | 352 |
| 5 | `bottomnavcomponentsiconlight` | 320 | 1,410 |
| 6 | `uie_thumb_normal` | 67 | 667 |
| 7 | `uie_thumb_selected` | 32 | 468 |
| 8 | `uie_comment_normal` | 26 | 454 |
| 9 | `uie_comment_highlighted` | 31 | 671 |
| 10 | `verylargeimage` ² | 30 | 1,855 |
| 11 | `alphahotdog` | 171 | 592 |

¹ First load in each build pays one-time costs: mapping `Assets.car` on the catalog side, ImageIO/framework warm-up + first disk touch on the filesystem side.
² Resolve only — the large image's decode cost is unchanged, so its end-to-end win is much smaller than this row suggests.

Every image is faster from the catalog: median 67 µs vs 667 µs (**10×**; an earlier run of the same benchmark measured 47 µs vs 719 µs, ~15× — run-to-run variance, same order either way). The mechanism: the catalog is a single memory-mapped, indexed archive (one name lookup, no per-image syscalls), while the loose-file path does an `imageNamed:` search over several filename permutations plus a per-image file open.

The URL→catalog-name derivation on the native side is a single character pass with no regex; benchmarked against a straightforward regex-based implementation of the same transform it measures 4.9 µs vs 11.0 µs per call (2.2×, Debug build, including the shared URL→bundle-path resolution both share), so the name mapping is a negligible part of the lookup.

**App thinning:** verified that App Store slicing thins the `Assets.car` inside `RNAssets.bundle` exactly like the app's own catalog. Test: a fixture app with a 1x/2x/3x imageset in both its main `Images.xcassets` and an actool-compiled `RNAssets.bundle`, archived and exported with `thinning` for a 3x device — both cars were sliced to 3x-only. So unused scales are stripped per device (unlike today's loose packager files, which ship every scale to every device).

## Migration

To opt an app in, add to its `Info.plist`:

```xml
<key>RCTUseAssetCatalog</key>
<true/>
```

That's the entire migration — no `.xcassets` to create, no build-phase or project changes. Notes:
- **Do a clean build after changing the key.** Incremental builds don't remove image assets a previous build placed with the other setting (unused, but dead weight in local builds; archives are unaffected).
- The key must be a literal value in the app's source Info.plist: the build script reads it with PlistBuddy (accepting the same value forms the runtime `boolValue` check accepts), so build-setting substitution or fully generated Info.plists (`GENERATE_INFOPLIST_FILE`) aren't seen by the script and stay on the legacy path. If bundling happens outside `react-native-xcode.sh` (custom CI calling `react-native bundle` directly) while the key is enabled, the native side detects the missing `RNAssets.bundle` and logs an actionable error instead of silently rendering nothing.
- Incomplete but valid scale sets degrade gracefully: an imageset with, say, only a `2x` (no `3x`) is kept for a 3x device by App Store slicing and used at runtime — verified with a thinned export. Only a *non-integer*-only asset (e.g. an Android-density `1.5x` with no `1x`/`2x`/`3x` variant, which iOS asset catalogs cannot represent) is unsupported: `actool` drops it with an `Unknown scale value` warning in the build log and the runtime logs an error. That's a rare antipattern; a `community-cli-plugin` follow-up will turn it into a clear build-time error at the source (it has the scale and asset path), rather than this repo re-parsing actool output.
- OTA updates keep working: assets delivered outside the main bundle never resolve to the catalog and use the regular loader.
- Docs follow-up: a section on the website's Images page (`react-native-website`) and the one-line opt-in in `react-native-community/template` will be separate PRs, timed with the release that ships this.

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

Test Plan:
RNTester and `private/helloworld` both opt in (`RCTUseAssetCatalog=YES` in their Info.plists — the only change an app needs), so CI covers the catalog path on both app shapes. The new-project template lives in `react-native-community/template` and will get the same one-line opt-in in a follow-up PR there. To test locally with RNTester:

1. In Xcode, edit the RNTester scheme → set Build Configuration to Release.
2. Build & run. Local images render, served from `RNAssets.bundle/Assets.car`; the app contains no loose packager png/jpg files.

Unit coverage in `RCTURLUtilsTests` (`testAssetCatalogNameForURL`), asserting the identifiers the CLI generates: scale-suffix stripping (including non-integer `1.5x`), folder encoding, illegal-char removal, jpeg vs. non-catalog types (gif), out-of-project-root assets, query strings, non-packager paths, and nil.

Mac Catalyst: verified end-to-end by building rn-tester as a Mac Catalyst app — the catalog compiles (via the Catalyst-specific `--platform macosx --ui-framework-family uikit` actool invocation) into `RNTester.app/Contents/Resources/RNAssets.bundle` with all packager images and no loose files, and the runtime uses the same `imageNamed:inBundle:` mechanism CocoaPods resource bundles use on Catalyst. (rn-tester doesn't ship a Catalyst config, so this isn't in CI, but the build is clean.)

Reviewed By: cipolleschi

Differential Revision: D40095766

Pulled By: javache

fbshipit-source-id: 18dfcb47ae5185ef279b20dd0087de9a31e930b4
2026-07-23 03:45:02 -07:00
Alex Hunt 89300acb9c Migrate Node.js builtin imports to node: scheme (#57611)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57611

Directly follows D112733139 (Metro).

**Motivation**

- New Node builtins are *only* available under the prefix (e.g. `node:sqlite`), as this allows Node to introduce them without ecosystem-breaking changes, so this is the direction of travel and the only choice that'll allow consistency.
- Encouraging them and grouping them separately makes it easier to reason about a module's 3rd party dependencies.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D112803684

fbshipit-source-id: 40668d746a7151b3aa4800ff8af997902a18d198
2026-07-21 09:01:41 -07:00
Pieter De Baets 2bc248c535 Propage startJSSamplingProfiler error (#57587)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57587

Adds rethrow in catch blocks when `startJSSamplingProfiler()` fails, preventing the `finally` block from attempting to stop a profiler that was never started.

Changelog: [Internal]

Reviewed By: thegreatercurve

Differential Revision: D112405579

fbshipit-source-id: 4b1cc6746d8ba29df99be57e583ee06ac742c12c
2026-07-17 02:43:24 -07:00
Christoph Purrer 96d3f91124 Fix Dependabot security update for concurrent-ruby in react-native (#57355)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57355

Changelog: [INTERNAL] Fix Dependabot security update for concurrent-ruby in react-native

The Dependabot GitHub Action on `react/react-native` `main` has been failing repeatedly because of `concurrent-ruby`. A security advisory marks `concurrent-ruby < 1.3.7` as affected (patched in `1.3.7`), but all three RN Gemfiles pin `gem 'concurrent-ruby', '<= 1.3.4'`. Dependabot cannot satisfy the advisory under that pin, so it opens a security PR to bump to `1.3.7` and then, on every subsequent run, reports `pull_request_exists_for_latest_version` as a hard error — failing the check and regenerating the internal CI task.

The `<= 1.3.4` upper bound was originally added because `concurrent-ruby 1.3.5` dropped its `logger` dependency, which broke older `activesupport`/CocoaPods setups. That cause is already mitigated: every Gemfile now explicitly lists `gem 'logger'`. The upper-bound pin is therefore obsolete.

This change relaxes the constraint from `<= 1.3.4` to `>= 1.3.7` in all three Gemfiles (root, `private/helloworld`, `packages/rn-tester`) and updates the two corresponding `Gemfile.lock` files to resolve `concurrent-ruby 1.3.7`. `1.3.7` introduces no new transitive dependencies over `1.3.4`, so no other lockfile entries change. With the advisory satisfied on `main`, Dependabot stops recreating the security PR and the recurring check failure stops.

Reviewed By: javache

Differential Revision: D109967250

fbshipit-source-id: 88f702bc6677053456557591cfd703776bb6c018
2026-07-14 10:57:04 -07:00
Sam Zhou a016e94b59 Redo D111190630: Stop using prettier-plugin-hermes-parser for formatting (#57537)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57537

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D111829105

fbshipit-source-id: 3309a22e737f68aca2d8d19f49e56bad955e5377
2026-07-13 17:48:27 -07:00
generatedunixname89002005232357 65af886291 Revert D111190630: Stop using prettier-plugin-hermes-parser for formatting
Differential Revision:
D111190630

Original commit changeset: e7ed7ee6f057

Original Phabricator Diff: D111190630

fbshipit-source-id: 49e33587fa084c181d64d35ac6bcf6ab73edfa5f
2026-07-13 16:42:37 -07:00
Sam Zhou 2235b8ec3f Stop using prettier-plugin-hermes-parser for formatting (#57505)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57505

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D111190630

fbshipit-source-id: e7ed7ee6f05701fbdaad1c8fad58c47f48344487
2026-07-13 15:57:35 -07:00
Rob Hogan fe511aba7c Bump Metro to 0.87.0 (#57534)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57534

Bump Metro to 0.87.0

Changelog:
[General][Changed] Bump Metro to 0.87.0

Reviewed By: huntie

Differential Revision: D111711509

fbshipit-source-id: 800fa83127d88db77948dab20b3edb574ecb5fc0
2026-07-13 11:06:41 -07:00
Nivaldo Bondança b31ba29d2d Update ktfmt component on FBS:master
Reviewed By: cortinico

Differential Revision: D110624565

fbshipit-source-id: c18b2b2fc22a8b060a30ae9bd2bc18af862e08f2
2026-07-12 14:57:47 -07:00
Alex Hunt 0ed6c560da Consolidate package checks into one Jest test (#57509)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57509

Simplify/unify various mechanisms for the monorepo's package invariants.

These checks were previously scattered:
- `private/monorepo-tests` package (manifest field checks)
- `.github/workflow-scripts/lint_files.sh` (`.npmignore` ban)
- `react-native/eslint-plugin-monorepo` (manifest field checks — duplicated)

This folds everything into `scripts/monorepo-tests/__tests__/check-packages-test.js`. A plain Jest test is the most extensible home for future checks.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D111471313

fbshipit-source-id: ea50abd8148d92e70605dd7f809654348e3c0080
2026-07-10 12:27:14 -07:00
Riccardo Cipolleschi 7d2ef7815d Fix HelloWorld Jest preset after react-native/jest-preset removal (#57491)
Summary:
https://github.com/react/react-native/issues/57481 removed the `react-native/jest-preset.js` redirect module (and the `react-native/jest-preset` public export), but the in-repo `private/helloworld` app still referenced `preset: 'react-native'` in its Jest config. This breaks `yarn test` in the `test_ios_helloworld` CI job (which cascade-cancels the rest of the iOS matrix and turns the e2e retry `report` jobs red):

```
● Validation Error:
  Module react-native should have "jest-preset.js" or "jest-preset.json" file at the root.
```

This migrates HelloWorld to the standalone `react-native/jest-preset` package — the documented migration path (see `packages/jest-preset/README.md`).

## Changes
- `private/helloworld/jest.config.js`: `preset: 'react-native'` → `preset: 'react-native/jest-preset'`
- `private/helloworld/package.json`: add `react-native/jest-preset` devDependency (`0.87.0-main`, matching the sibling `react-native/*` packages)

## Changelog:
[Internal] [Fixed] - Fix HelloWorld Jest preset after `react-native/jest-preset` removal

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

Test Plan:
- `cd private/helloworld && yarn test` resolves the preset and runs (previously failed with the validation error above).
- CI `test_ios_helloworld` job.

Reviewed By: cortinico

Differential Revision: D111215532

Pulled By: cipolleschi

fbshipit-source-id: 2d60de619060e384b4a5b662a6f588ea3e368433
2026-07-09 02:52:03 -07:00
Rubén Norte 0df0be24ef Fix markdown formatting in react-native-fantom docs README (#57486)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57486

`prettier --list-different` (run via `yarn format-check`) flagged the react-native-fantom `__docs__/README.md` as unformatted. Re-wrap the two affected prose lines to prettier's print width so the docs pass the formatting check.

No content changes; formatting only.

Changelog: [Internal]

___

Differential Revision: D111041556

fbshipit-source-id: cab15f502e941d908503e0873fe8cba12b48686f
2026-07-08 08:48:48 -07:00
Sam Zhou 537d867316 Bump to latest prettier (#57473)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57473

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D110952668

fbshipit-source-id: a2278dbe978b42d42f57ddea10a947703a181797
2026-07-08 05:24:04 -07:00
Rubén Norte 7a5ab34451 Document Fantom convention: prefer testing through the public API (#57467)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57467

Adds a convention to the Fantom README recommending that tests exercise React Native through its public API (importing from `react-native`) whenever possible, rather than reaching into internal modules. Exercising the public surface also drives the underlying native (Fabric/TurboModules) code, so tests stay close to real usage and are more resilient to internal refactors.

Changelog:
[Internal]

Reviewed By: christophpurrer

Differential Revision: D110918650

fbshipit-source-id: b19dc4b4a380030196a4e83890aae6720a64c77f
2026-07-08 00:45:28 -07:00
Rob Hogan 2b0107e0aa Bump Metro to 0.86.0 (#57453)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57453

Metro release notes:

https://github.com/react/metro/releases/tag/v0.86.0

Changelog:
[General][Changed] Metro to 0.86.0

Reviewed By: huntie

Differential Revision: D110789092

fbshipit-source-id: 4b999bf533c3c61b7915a73366ff3ca13257c3dc
2026-07-07 02:20:23 -07:00
Alex Hunt 6cfde8f296 Move AssetRegistry implementation into main package, expose as public API (#57369)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57369

**Problem**

The separate `react-native/assets-registry` package includes a longstanding ecosystem footgun.

`registry.js` holds asset state in a module-scoped variable, which makes the package a stateful singleton: exactly one instance must exist per JS runtime, or registration and lookup diverge.

We provide no guarantee that this singleton requirement holds:

- The install layout — how the package manager dedupes packages in `node_modules` — decides how many copies exist, and `react-native`'s exact-version pin means third-party ranges never dedupe against it.

Effects:

- **Consumers silently break**: `expo-asset` and `expo-image` can land on a second copy: assets register in one, resolve as `undefined` from the other. Expo neutralizes this with a shim in `expo/cli` that redirects every registry import to a single virtual module — bare React Native + Metro has no such protection.
- **This blocks 1.0**: The ecosystem can't move from exact-version lockstep to semver ranges until stateful packages like the asset registry are safe to duplicate. Today, relaxing the pin would turn a latent footgun into a common one.

**To solve this**, move towards (but not quite yet) deleting `react-native/assets-registry`, in favour of a replacement `AssetRegistry` API offered directly by `react-native`.

**Key changes**

NOTE: **Reviewer note**: Browsing file changes on GitHub may be more focused — https://github.com/react/react-native/pull/57369/changes

NOTE: Squash of https://github.com/react/react-native/pull/57233 (D108750302) and https://github.com/react/react-native/pull/57232 (D108750303)

`'react-native'`:
- Add new `AssetRegistry` API, along with the `PackagerAsset` and `AssetDestPathResolver` root type exports in `react-native`.
- Add a new `'react-native/asset-registry'` secondary entry point — intended for Metro's `transformer.assetRegistryPath` config contract.

`react-native/assets-registry`:
- Update to source from this relocated implementation — fixing the duplicate install layout bug (where apps/frameworks enforce a single copy of `react-native`).

**Impact**

- **✅ Fixed**: Imports from either `react-native` or `react-native/assets-registry` in RN 0.87+ will be durable to duplicate package installs — Expo can remove their virtual module shim.
- **✅ Fixed**: Deep import `'react-native/Libraries/Image/AssetRegistry'` dependency removed (migrated in `react-native/metro-config`).

Changelog:
- [General][Fixed] - **assets-registry**: `react-native/assets-registry` now shares state across duplicate installs, sourcing from a relocated implementation in the `react-native` package
- [General][Added] - Add `AssetRegistry` API (replaces `react-native/assets-registry/registry`)
- [General][Breaking] - `react-native/Libraries/Image/AssetRegistry` is removed. Please use the `AssetRegistry` API (apps/library code) and/or the `react-native/asset-registry` entrypoint (Metro/build configs).

Reviewed By: robhogan

Differential Revision: D109019622

fbshipit-source-id: 75599a94a9aba084a1266f2128c448379d1596cd
2026-07-06 10:32:14 -07:00
Alex Hunt 41d52189e2 Create @react-native/asset-utils package (#57368)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57368

**Context**

This stack intends to relocate the `AssetRegistry` API from `react-native/assets-registry` into `react-native` — addressing runtime safety and public deep imports issues (1.0 and JS Stable API blockers).

**This diff**

Create a new `react-native/asset-utils` package, intended for internal/framework use (read: **will not be an end user concern**). This re-houses `react-native/assets-registry/path-support.js`.

Stacked with the next two diffs, this contributes to the 0.87 objective to delete `react-native/assets-registry` towards install-layout-safe behaviour and JS deep import removal.

- (Temporarily, this leaves two copies of `path-support.js` until I enact the package removal down the stack.)

This change also enables us to de-duplicate `assetPathUtils.js` inside `community-cli-plugin` and use one source of truth.

- Additionally, we have fbsource consumers of this util that cannot have a circular Buck dep on `react-native`, so the main package was not a suitable relocation point (secondarily to not adding an awkward new public API here).

**Changes**
- Add `react-native/asset-utils` (`packages/asset-utils/`): `src/AssetPathUtils.js` containing Android path helpers and tests.
- De-duplicate usages in `community-cli-plugin`: delete `src/commands/bundle/assetPathUtils.js`.

Changelog:
[General][Added] - Introduce `react-native/asset-utils` package (relocates Android path utils for libraries/frameworks)

Reviewed By: robhogan

Differential Revision: D110045272

fbshipit-source-id: 781e75c58ae9ce7f0fa860e66beca3b9990d26ea
2026-07-06 10:32:14 -07:00
Rubén Norte af3a6519b3 Fix Fantom REPL crash from metro default import (#57443)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57443

The Fantom REPL (`yarn fantom-cli`) crashed on startup with `TypeError: Cannot read properties of undefined (reading 'loadConfig')`. `metro` is a CommonJS module that only provides named exports, so the default import `import Metro from 'metro'` resolves to `undefined` under the Babel interop used to run the REPL, and any access such as `Metro.loadConfig` throws.

Switch to a namespace import (`import * as Metro from 'metro'`), matching how metro is already imported in the Fantom global setup.

Changelog: [Internal]

___

Reviewed By: javache

Differential Revision: D110754395

fbshipit-source-id: f1c7c415f96a6adeb6dde12919983aa9a5a819a4
2026-07-06 04:29:55 -07:00
Rubén Norte 0fae86d0c7 Remove deprecated FANTOM_ENABLE_CPP_DEBUGGING environment variable (#57401)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57401

The `FANTOM_ENABLE_CPP_DEBUGGING` environment variable was kept only as a legacy alias for `FANTOM_DEBUG_CPP`. Remove it from Fantom so `FANTOM_DEBUG_CPP` is the single supported way to enable the C++ debugger.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D110324557

fbshipit-source-id: 2cbde4736137db792b8b99d1806c146e3094ca4b
2026-07-01 08:18:34 -07:00
Rubén Norte 2bb7dbb499 Add an interactive REPL for Fantom (yarn fantom-cli) (#57387)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57387

Adds `yarn fantom-cli`, an interactive REPL that evaluates JavaScript against the same native tester binary and Hermes runtime that Fantom tests run in. State persists across lines, input goes through Metro/Babel (so `import`, JSX and Flow all work), and the environment is set up the same way tests set it up — `React`, `ReactNative` and the `Fantom` API are available globally, so you can render surfaces and drive them interactively from the prompt.

The native tester gains an `--interactive` mode that loads a warm-up bundle without running tests and then evaluates length-prefixed snippets read from stdin, reporting results, console output and errors back as newline-delimited JSON. A Node driver hosts a Metro server, builds the warm-up bundle, spawns the binary, and bridges each line of input into the live runtime (top-level declarations persist across evaluations).

Features:

- Console-style output: results are printed with an inspector similar to the Chrome DevTools / Node.js consoles (nested objects/arrays up to a depth limit, quoted strings, functions/classes, `Map`/`Set`/`RegExp`/`Date`/`Error`, class instances, circular references, multi-line wrapping), colorized by type when stdout is a terminal. Inspecting a property never aborts the result or leaks into later evaluations: a property whose getter fails renders as `[Thrown: <error>]`, including getters that fail asynchronously through the runtime's global error handler (e.g. accessing a `react-native` export backed by a TurboModule that isn't registered).
- Autocompletion: pressing Tab completes global identifiers, in-scope bindings and object properties (property names are listed without invoking getters).
- Node-like CLI: with no arguments it starts the REPL; `-e <code>` evaluates a snippet and exits; a filename runs that script and exits. In the non-interactive modes the value of a trailing expression is not printed (use `console.log`) and a thrown error exits with a non-zero status code.

Also documents the REPL in the Fantom README.

Changelog: [Internal]

Reviewed By: javache, sammy-SC

Differential Revision: D110187712

fbshipit-source-id: 3e76c498ae04b8b1ce9e0e27e5ce6b6a0cd11e09
2026-07-01 08:18:34 -07:00
Rob Hogan 014fe8b520 Refactor imports from Metro to avoid deprecated styles and prefer main package (#57378)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57378

Refactor Metro imports to:
 - Remove use of deprecated default object export, prefer named/namespace exports.
 - Prefer imports from `metro`, remove public dependencies on `metro-core` and `metro-config` from `react-native/community-cli-plugin`.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D110177050

fbshipit-source-id: f21a561d40d13f354bc56cdc50d6e6d6843877cc
2026-06-30 09:42:04 -07:00
Pieter De Baets 610192ed9b Clean up enableEagerAlternateStateNodeCleanup (#57358)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57358

The `enableEagerAlternateStateNodeCleanup` flag is no longer read by the renderer, so the feature-flag definition and the two prelude overrides that forced it on become dead code.

[Internal]

Reviewed By: lenaic

Differential Revision: D110043719

fbshipit-source-id: 24a7e2b85ec60da1cb1855f444bba5e1e6fc4288
2026-06-29 06:40:21 -07:00
Alex Hunt ae6a3afb22 Upgrade Metro to ^0.85.0 (#57335)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57335

Changelog: [Internal] - Node 22 requirement is synchronised with RN for 0.87

Reviewed By: robhogan

Differential Revision: D109699796

fbshipit-source-id: 642373a6babc37ce3e9bc83676abd0aa09f54a85
2026-06-25 10:31:30 -07:00
Rob Hogan 27e83d0a95 Stop publishing @react-native/core-cli-utils (#57288)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57288

https://github.com/facebook/react-native/pull/56922 intended to prevent this package publishing to npm but didn't - we've been continuing to publish it in nightlies.

`scripts/shared/monorepoUtils.js` filters with `packageJson.private !== true || includePrivate`, i.e. the `private` field is load-bearing, not the path. All other packages in `private/` have `package.json#private: true`.

Changelog: [Internal] - the breaking change is already noted in https://github.com/react/react-native/pull/56922 , no release / cut since.

Reviewed By: cortinico

Differential Revision: D109153641

fbshipit-source-id: f86ed921dbc7a6b020c57e7d18e6cae5c57b5f1e
2026-06-19 09:40:30 -07:00
Alan Hughes 3e8dfb1e64 Bump compileSdk and buildTools to 37 (#57284)
Summary:
Bump the `compileSdk` and `buildTools` to 37

## Changelog:
[Android][Added] - Update `compileSdk` and `buildTools` to 37

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

Test Plan: RN tester builds

Reviewed By: fabriziocucci

Differential Revision: D109144182

Pulled By: cortinico

fbshipit-source-id: 2d4da5ed971bbd578fd9c9c9dc68ff905872f831
2026-06-19 07:16:52 -07:00
Rubén Norte 2d491c0c75 Add deterministic timer mock to Fantom (#57274)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57274

Fantom could not deterministically fire delayed JS timers: the timer registry it used scheduled timers on a real background thread with real wall-clock delays, so `setTimeout(fn, 100)`/`setInterval` callbacks never fired within a synchronous test. This adds a mockable timer registry and a public Fantom API to control it from JS, similar to `installHighResTimeStampMock`.

- New `Fantom.installTimerMock()` returns a controller with `advanceTimersByTime(ms)`, `runAllTimers()`, `getPendingTimerCount()`, and `uninstall()` (jest fake-timer style). While installed, `setTimeout`/`setInterval` callbacks only fire when the virtual clock is advanced.
- New deterministic `FantomTimerRegistry` (no background thread) keyed off a virtual clock, injected via a new optional `platformTimerRegistryFactory` seam on `ReactInstanceConfig` (the default registry is unchanged for all other consumers).
- `PlatformTimerRegistry` gains a virtual `setTimerManager` (default no-op) so the registry can be wired polymorphically.
- Control flows from JS through new `NativeFantom` methods, the same way the high-res timestamp mock works.

Default (non-mock) behavior is preserved: zero-delay `setTimeout` still fires on the next work loop, and existing tests are unaffected.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D109017304

fbshipit-source-id: 8afe6fb2a39f470ae293038f6592c46535442dc2
2026-06-19 05:13:56 -07:00
Rob Hogan 0fc122c830 Add repository metadata to @react-native/core-cli-utils
Summary:
This package is published to npm, despite being under `private` - so I missed adding `repository` metadata to it as requried by trusted publish.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D109031681

fbshipit-source-id: 19ec7fbc63a50d13fbebf8e3c42f439038399ea5
2026-06-18 10:20:26 -07:00
Rubén Norte e1b0c77507 Fix Fantom dev-mode tests when the tester is built in optimized mode (#57272)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57272

Fantom integration tests declared with `fantom_mode dev` rely on debug-only native APIs (e.g. timer mocking via `installHighResTimeStampMock`) that are only compiled when the native tester is built in debug mode.

Under some build configurations the active platform pins the core build mode to optimized, so the preprocessor flag that gates those debug-only APIs is not defined and the tester is compiled in optimized mode. As a result, dev-mode tests that depend on those APIs throw at runtime (e.g. "Mocking timers is not supported in optimized builds").

A previous attempt stacked a build-mode constraint on the Hermes build mode setting, which the native preprocessor flags never read, so it had no effect. Stack the constraint on the core build mode setting that actually gates the flag instead, so the tester is compiled in the test's intended dev/opt mode.

Changelog: [Internal]

Reviewed By: ellemac123

Differential Revision: D109014401

fbshipit-source-id: a04d75d299e3d2a0d1ccabcc2629833ac7a9dbd6
2026-06-18 07:20:47 -07:00