1610 Commits
Author SHA1 Message Date
Eric Hartzog d53c7b52a6 Fix stale text measurement after display density change (#57084)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/57084

Changelog: [General][Fixed] - Fix text measurements being incorrectly reused across pixel density changes

Reviewed By: javache

Differential Revision: D107594582

fbshipit-source-id: 34deae36d9903fec34a18d39703c8cf901fc9acc
2026-06-05 03:45:44 -07:00
Kevin Gozali 9568de5a2d Expose the bridgeless performance logger and post RCTJavaScriptDidLoadNotification (#57083)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/57083

In bridgeless mode, `RCTInstance` records native startup timings in a per-instance `RCTPerformanceLogger`, but that logger was never reachable from app code: `RCTBridgeProxy.performanceLogger` returned nil and `RCTJavaScriptDidLoadNotification` was never posted. Startup-perf consumers that follow the long-standing pattern of reading `[bridge performanceLogger]` on `RCTJavaScriptDidLoadNotification` were therefore silently inert under bridgeless, dropping all native startup timings.

This restores that pattern for bridgeless:
- `RCTBridgeProxy` now holds a real `performanceLogger` property, injected by `RCTInstance`, instead of returning nil.
- `RCTInstance` posts `RCTJavaScriptDidLoadNotification` (on the main thread, with the bridge proxy in `userInfo[@"bridge"]`) once the JS bundle has loaded, mirroring the legacy bridge.

No change to the legacy bridge path.

Changelog:
[iOS][Fixed] - Expose the bridgeless performance logger via `RCTBridgeProxy` and post `RCTJavaScriptDidLoadNotification`, so native startup-perf consumers work in bridgeless

Reviewed By: christophpurrer

Differential Revision: D107542363

fbshipit-source-id: e1b539dfec9e337c5d32c2f8d720e04e795dc538
2026-06-04 20:53:26 -07:00
Evan Jacobs 87184c8fba feat(android): honor textDecorationStyle on Text decorations (#56768)
Summary:
`textDecorationStyle` is declared on `TextStyleAndroid` in the public types but `TA_KEY_TEXT_DECORATION_STYLE` was a no-op handler: every value silently rendered as a solid line, and `wavy` was additionally rejected at the Fabric C++ enum boundary with an `Unsupported value` log. This PR wires the prop through the existing C++ → Kotlin pipeline and implements `solid`, `double`, `dotted`, `dashed`, and `wavy` for both underlines and strikethroughs.

Android's `Layout.draw` paints the underline produced by `setUnderlineText(true)` using `paint.color` only and offers no native way to draw a dotted / dashed / wavy decoration. `ReactUnderlineSpan` and `ReactStrikethroughSpan` now extend `CanvasEffectSpan` and paint the decoration themselves in `onDraw` via `Canvas.drawLine` / `Canvas.drawPath`, dispatching by style. As a side effect this also makes `textDecorationColor` reach the paint, closing the separate long-standing gap filed as https://github.com/facebook/react-native/issues/4579 in 2015 — the companion color-focused PR https://github.com/facebook/react-native/issues/56767 isolates that fix for reviewers who only want the color change.

`TextDecorationStyle::Wavy` is added to the Fabric C++ primitives / conversions so the `wavy` JS value flows through; the same enum is shared with iOS (see companion iOS PR https://github.com/facebook/react-native/issues/56769).

The wavy curve uses Chromium/Blink's formula from `decoration_line_painter.cc` (`wavelength = 1 + 2 * round(2 * thickness + 0.5)`, `controlPointDistance = 0.5 + round(3 * thickness + 0.5)`, one cubic Bezier per wavelength with both control points at the midpoint, one above and one below the y-axis). The minimum stroke thickness is density-aware (1.5 dp) so decorations read consistently across display densities. The drawing loop iterates `while x < x2` so the final cycle continues through the last character (including trailing punctuation that would otherwise be visually uncovered when the run width is not an integer multiple of the wavelength).

`ReactTextView.onDraw` invokes `CanvasEffectSpan.onDraw` after `super.onDraw`, mirroring what `PreparedLayoutTextView.onDraw` already did. Without this, the new spans have no effect on the older view class, which is what some Text components on the new architecture still route through.

Companion PRs (independent, also targeting `main`):
- https://github.com/facebook/react-native/issues/56767 — fix(android): textDecorationColor on underlines + strikethroughs. Resolves https://github.com/facebook/react-native/issues/4579.
- https://github.com/facebook/react-native/issues/56769 — feat(ios): textDecorationStyle wavy/dotted/dashed via custom CG paths. Shares the `TextDecorationStyle::Wavy` enum addition; whichever lands first leaves the other with a trivial conflict to resolve.

## Changelog:

[GENERAL] [ADDED] - `textDecorationStyle: 'wavy'` for `<Text>` (see corresponding iOS PR for the iOS counterpart)
[ANDROID] [ADDED] - Text decorations honor `textDecorationStyle` (`solid`, `double`, `dotted`, `dashed`, `wavy`)

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

Test Plan:
Rendered `<Text>` components with `textDecorationLine` set to `"underline"` or `"line-through"` and `textDecorationStyle` cycling through `solid` / `double` / `dotted` / `dashed` / `wavy`. On stock 0.85.2 every value renders as a solid line and `wavy` logs an `Unsupported value` warning; with this patch each style renders with the requested stroke geometry. Verified single-line and wrapped multi-line cases on an Android API 36 emulator: each visual line within a wrapped block receives its own correctly-styled decoration that starts and ends at the line's content boundaries.

```tsx
<Text style={{
  color: 'black',
  textDecorationLine: 'underline',
  textDecorationStyle: 'wavy',
}}>
  Hello
</Text>
```

Unit tests added for `TextDecorationStyle.fromString()` covering all five styles plus null, empty, and unknown inputs. Run with `buck2 test //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views:views_text_TextDecorationStyleTestAndroid` — all 8 tests pass.

Fantom integration tests added to `Text-itest.js` verifying all five `textDecorationStyle` values propagate through the Fabric pipeline for both underline, strikethrough, and multi-line wrapped text.

Installed RNTester on a Pixel 8 Pro (Android API 36) and verified all five `textDecorationStyle` values render correctly for both underline and line-through decorations, including multi-line text with inline decoration spanning line breaks. Screenshot: https://pxl.cl/b3c4f

jest-e2e screenshot test updated with new Android screenshot hashes reflecting the updated decoration rendering.

Reviewed By: javache

Differential Revision: D104680895

Pulled By: cortinico

fbshipit-source-id: 7d057326af3809869fdd8394d51aa50ff328ed6f
2026-06-04 15:58:29 -07:00
Christoph Purrer ad9936faf6 Remove depracted legacy architecture @protocol APIs (#57069)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/57069

## Changelog:
[IOS][Breaking]  Remove depracted legacy architecture protocol APIs

Reviewed By: andrewdacenko

Differential Revision: D107422407

fbshipit-source-id: 442f232981a4c6504c7c64e88ba1f8e99d1c5a5b
2026-06-04 09:25:18 -07:00
Christoph Purrer 75eaff4c03 RCTReactNativeFactory remove RCTBridge methods and bridge property (#57067)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/57067

Removes `RCTBridge`-related functions from `RCTReactNativeFactory` protocol and default delegate implementation as part of cleaning up legacy architecture APIs.

Removes `createBridgeWithDelegate:launchOptions:`, `createRootViewWithBridge:moduleName:initProps:`, and the `bridge` property. The `bridgeAdapter` property is preserved as it returns `RCTSurfacePresenterBridgeAdapter`, not `RCTBridge`. Updates documentation in `RCTAppDelegate.h` to reflect the removed overridable methods.

## Changelog:
[iOS][Breaking] Remove RCTBridge Functions from RCTReactNativeFactory Header

Reviewed By: andrewdacenko

Differential Revision: D107417684

fbshipit-source-id: 2f6f66a49502250c15c5c62d9abbbdfe10884d55
2026-06-04 08:06:20 -07:00
Gang Zhao bd250e63e1 Promote event loop control JSI interface out of UNSTABLE (#57005)
Summary:
X-link: https://github.com/facebook/hermes/pull/2037

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

Promote `IEventLoopControl` and `ISetEventLoopControl` out of `JSI_UNSTABLE` and make `HermesRuntimeImpl` always implement the setter interface. Keep unrelated unstable APIs such as serialization, tracing helpers, and Worker installation behind `JSI_UNSTABLE`.

Other hermes branches do not implement `ISetEventLoopControl`, for now.

Changelog: [Internal]

Reviewed By: tmikov

Differential Revision: D106744174

fbshipit-source-id: 0cf88de7c067f091b19238fce7171300b9777c98
2026-06-03 17:12:45 -07:00
Christoph Purrer cb74b82309 Remove unused bridge-based RCTTurboModuleManager initializer (#57065)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/57065

## Changelog:
[iOS][Breaking] Remove unused bridge-based RCTTurboModuleManager initializer

`RCTTurboModuleManager` declared three initializers, but only the bridgeless (`RCTBridgeProxy`-based) ones are used. The bridge-based `initWithBridge:delegate:jsInvoker:` initializer was the only path that ever set a non-nil bridge, leaving a large amount of bridge-only code permanently dead under the surviving initializers.

This removes that initializer along with the now-dead bridge-mode code: the `_bridge` ivar, the `decorateNativeMethodCallInvoker:` decoration, the `RCTModuleData`/`registerModuleForFrameUpdates:` registration, the `performanceLogger` setup markers, and the bridge invalidation notification observers and handlers. `initWithBridgeProxy:bridgeModuleDecorator:delegate:jsInvoker:devMenuConfigurationDecorator:` becomes the designated initializer, and the shorter `RCTBridgeProxy` initializer now forwards to it. The `RCTDidInitializeModuleNotification` post is preserved with a nil bridge, matching the existing runtime behaviour of the bridgeless initializers.

Reviewed By: philIip

Differential Revision: D107409088

fbshipit-source-id: 81022c5e864d3d0897170eea000f4c29d8fe3529
2026-06-03 14:06:47 -07:00
Christoph Purrer 2148f15db5 RNTester / RCTReactNativeFactory remove unused new architecture flags and RCTArchConfiguratorProtocol (#57054)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/57054

## Changelog:
[iOS][Breaking]  RNTester / RCTReactNativeFactory remove unused new architecture flags and RCTArchConfiguratorProtocol

Values are already `true`/YES

```
      [[RCTRootViewFactoryConfiguration alloc] initWithBundleURLBlock:bundleUrlBlock
                                                       newArchEnabled:YES
                                                   turboModuleEnabled:YES
                                                    bridgelessEnabled:YES];
```

Reviewed By: cipolleschi

Differential Revision: D107305248

fbshipit-source-id: bd09d12cf1d22ec6bb435333c05004b73fce98c5
2026-06-03 09:47:57 -07:00
Aditya Sharat b766986387 Spec-correct CSS Flexbox §4.5 auto-min-size opt-in on YGConfig (re-land) (#57057)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/57057

X-link: https://github.com/facebook/yoga/pull/1968

Re-land of D105720159, originally reverted (revert: 0e642b96c7e2) due to a latent NPE in `ReactProgressBarViewManager.kt` and Instagram-internal `ReactSwitchManager.kt` — both fixed in the prior diffs in this stack. Crash and broken e2e tests reported in T273821098 / P2359486686.

This re-land additionally fixes a correctness gap in the original D105720159 design: it claimed "Default configs carry the bit (preserves today's behaviour); existing trees see no change" — but `LayoutConformance::Strict` in `YogaLayoutableShadowNode::resolveErrata` returned `YGErrataNone`, which clears every errata bit *including* the new `MinSizeUndefinedInsteadOfAuto` (bit 8). Since `react-strict-dom` sets `experimental_layoutConformance="strict"` on every native View, this implicitly opts every RSD-using surface into the new auto-min probe. That's the exact path Airwave's tests took to hit the original NPE.

Change: `LayoutConformance::Strict` now returns `YGErrataMinSizeUndefinedInsteadOfAuto` instead of `YGErrataNone`. Strict mode keeps every other CSS conformance behavior intact; only the new auto-min feature stays opt-in via explicit `YGConfig` setup. This matches the design pattern Litho uses in the child diff (`ComponentsConfiguration.useAutoMinSize` flag, gated independently of any strict-mode plumbing).

Original summary follows:

X-link: https://github.com/facebook/yoga/pull/1966

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

Implements CSS Flexbox §4.5 automatic minimum sizing in Yoga. When opted in on a `YGConfig`, every flex item whose main-axis `min-{width,height}` is undefined receives a content-derived floor — `min(min-content, specified-size, max-size)` plus any aspect-ratio-transferred lower bound — so it cannot shrink below the size CSS browsers would honor.

How to opt in: clear the new `YGErrataMinSizeUndefinedInsteadOfAuto` errata bit on the config. Default configs carry the bit (preserves today's behaviour); existing trees see no change. The bit is added to `YGErrataClassic` so consumers using that constant continue to get the same default. **`LayoutConformance::Strict` also keeps the bit set** — the new feature is strictly opt-in, not inferred from strict-mode CSS conformance.

See D105720159 for full details on precedence rules, container recursion semantics, and per-item opt-outs.

Changelog:
[General][Added] - Add CSS Flexbox §4.5 automatic minimum sizing. Opt in by clearing the new `YGErrataMinSizeUndefinedInsteadOfAuto` errata bit on `YGConfig`.

Reviewed By: javache, aashay-gaikwad

Differential Revision: D107183851

fbshipit-source-id: 451b86347e24da5504649ba575fb27ae0d2f9853
2026-06-03 08:12:26 -07:00
Sam Zhou e0ed406590 Redo modern syntax rollout in react-native (#57034)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/57034

With D107165685, it should work this time.

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D107111468

fbshipit-source-id: 326b2911088d7c87c3564a578125eeaab9d0b8cc
2026-06-03 07:21:54 -07:00
Alex Hunt d56683842c Hide runtime-managed class constructors from public API (#57028)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/57028

Mark `ReactNativeElement` and `ReadOnlyNode` as non-user-constructible in the generated TypeScript definitions by emitting `protected constructor()`.

**Motivation**

- Correctness — like web DOM elements (`HTMLElement`, etc.), `ReactNativeElement` instances are created by the React Native runtime, not in user space. See also D107227212.
- Reduce public API surface (in particular, since this is also aliased to the `HostInstance` type).

**Changes**

- Adds a new `build-types protected-constructor` directive and corresponding `build-types` post-transform.
- Applies directive to `ReactNativeElement` and `ReadOnlyNode`.
- Also extracts shared `build-types` directive helpers into `transforms/typescript/utils/buildDirectives.js`.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D107119545

fbshipit-source-id: 8320780db12475b00910745d4b8cee8c9f22d547
2026-06-02 09:19:15 -07:00
generatedunixname89002005232357 d659203db2 Revert D105720159: Spec-correct CSS Flexbox §4.5 auto-min-size opt-in on YGConfig
Differential Revision:
D105720159

Original commit changeset: 57a14408b105

Original Phabricator Diff: D105720159

fbshipit-source-id: 0e642b96c7e21077af1b6778e306c355ef80441a
2026-06-01 15:55:58 -07:00
Christoph Purrer 86350ab988 Remove legacy architecture code guarded by RCT_REMOVE_LEGACY_ARCH from RN iOS (#56831)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56831

Changelog: [iOS][Breaking] Remove legacy architecture code guarded by RCT_REMOVE_LEGACY_ARCH from RN iOS

Reviewed By: cortinico, cipolleschi

Differential Revision: D104495793

fbshipit-source-id: 05ecd2d2b8942e1c72df90fcc92fb455f055e015
2026-06-01 12:24:37 -07:00
Aditya Sharat 7f396d1116 Spec-correct CSS Flexbox §4.5 auto-min-size opt-in on YGConfig (#57015)
Summary:
X-link: https://github.com/facebook/yoga/pull/1966

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

Implements CSS Flexbox §4.5 automatic minimum sizing in Yoga. When opted in on a `YGConfig`, every flex item whose main-axis `min-{width,height}` is undefined receives a content-derived floor — `min(min-content, specified-size, max-size)` plus any aspect-ratio-transferred lower bound — so it cannot shrink below the size CSS browsers would honor.

How to opt in: clear the new `YGErrataMinSizeUndefinedInsteadOfAuto` errata bit on the config. Default configs carry the bit (preserves today's behaviour); existing trees see no change. The bit is added to `YGErrataClassic` so consumers using that constant continue to get the same default.

Three ways for a node to declare its min-content size along an axis, in this precedence order:

1. **Static per-axis value** via `YGNodeSetMinContentWidth/Height(node, value)`. Pass `YGUndefined` to clear. When set, the §4.5 probe short-circuits at this node — skipping both the dynamic callback and any container recursion. Use for known constants (e.g., images returning 0 per CSS-Images; scroll containers returning 0 on their scroll axis).

2. **Dynamic callback** via `YGNodeSetMinContentMeasureFunc(node, fn)`. Mirrors `YGMeasureFunc`'s shape. The algorithm invokes it for measure-func leaves when no static value is set.

3. **Default fallback**: the existing `YGMeasureFunc` invoked with `AtMost 0`, which text measurers naturally answer with their longest-word width.

For container nodes without a static value, the algorithm walks children directly — sum on the container's own main axis, max on the cross axis — mirroring RenderCore FlexLayout's `computeMinContentSize`. This replaces the previous `calculateLayoutInternal(performLayout=false)` re-entry and skips cross-axis sizing, padding/border resolution, alignment, and baseline machinery that the probe doesn't need.

Per-item opt-outs follow the CSS spec: explicit `min-{width,height}` (including 0), `display: none`, and `overflow != visible`.

Cost when off (default): a single errata-bit check per flex line plus one `FloatOptional` short-circuit per `boundAxisWithAutoMin` call. Sub-microsecond.

Cost when on: one min-content probe per opted-in flex item per layout pass. Static values short-circuit in ~30 ns; measure-func leaves cost one extra `measure()` call; container subtrees do one recursive sum/max walk over in-flow descendants.

Reference: https://www.w3.org/TR/css-flexbox-1/#min-size-auto. Modeled after `xplat/flexlayout/`'s `MinSizeUndefinedInsteadOfAuto` errata path.

Changelog:
[General][Added] - Add CSS Flexbox §4.5 automatic minimum sizing. Opt in by clearing the new `YGErrataMinSizeUndefinedInsteadOfAuto` errata bit on `YGConfig`. Adds `YGNodeSetMinContentWidth/Height` for static contributions and `YGMinContentMeasureFunc` for dynamic ones.'

GH pull request
https://github.com/facebook/react-native/pull/57015
https://github.com/facebook/yoga/pull/1966

Reviewed By: fbcbl

Differential Revision: D105720159

fbshipit-source-id: 57a14408b10535fd84623b4d99ae9b5fba7b35ba
2026-06-01 10:05:39 -07:00
Zeya Peng ee43ce7dba Revisit timing to capture old/new nodes (#56877)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56877

## Changelog:

[Internal] [Changed] - Revisit timing to capture old/new nodes

Previously, when `applyViewTransitionName` is called from react reconciler, if there is active viewtransition, we decide it's applying to new node. This was incorrect because `applyViewTransitionName(old)` for next transition can be called when the previous transition is still ongoing. In fact `applyViewTransitionName(old)` is guaranteed to be called before mutationCallback in a transition while `applyViewTransitionName(new)` is inside mutationCallback. So that is a better criteria to separate old and new cases. Given mutationCallback is synchronous on JS thread we can just use a boolean flag to tell the timing.

Given this interleaved situation, when we clean up resources (for new/old nodes) of a transition at its end, we should also avoid removing those for a pending transition. Introducing transitionId for this case.

Reviewed By: Abbondanzo

Differential Revision: D105214322

fbshipit-source-id: 6c719964921db2e76421e9917151076c97d1d623
2026-05-29 14:21:17 -07:00
Rubén Norte 833144fcec Revert recent Flow syntax codemods in react-native-github (#56998)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56998

Reverts the recent Flow syntax codemods applied across `packages/`, `private/`, and `scripts/` in react-native-github. Specifically restores the previous form for:

- `+T` / `+Instance` style variance annotations on generic type parameters that had been converted to the newer `out T` / `in T` keyword form.
- `+field:` covariant object/interface properties that had been converted to the `readonly field:` modifier form.
- `+[K in keyof T]:` mapped-type covariance that had been converted to `readonly [K in keyof T]:`.

These are purely Flow type-annotation changes with no runtime behavior impact, restoring the form that the rest of the toolchain (in particular Fantom) already supports.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D106813102

fbshipit-source-id: 6bf915d530e130eba9c9d96a2b6c3dc8853594d1
2026-05-29 14:09:58 -07:00
SJLIM 5b16cdff9d Generated from a GitHub Pull Request. Run 'jf sync' on this diff to load the correct commit data. (#56985)
Summary:
Remove duplicated words from comments in a release script, a dev middleware test helper, the Gradle plugin JDK utility, and the virtual view render state.

## Changelog:
[INTERNAL] [FIXED] - Fix duplicated words in source comments.

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

Test Plan: Comments.

Reviewed By: cortinico

Differential Revision: D106615714

Pulled By: fabriziocucci

fbshipit-source-id: cbb08abc5c0e6fbcfe2299c00aa05e67901b9f4c
2026-05-29 12:47:25 -07:00
Samuel Susla 5fbcc6bf89 Downgrade offscreen Fabric image requests to prefetch (#56976)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56976

changelog: [internal]

Use Fabric layout data to classify image shadow nodes as visible or offscreen on Apple platforms. Offscreen image requests now use `ImageRequestPriority::Prefetch`, which is bridged to the existing `RCTImageLoaderPriorityPrefetch` API, while visible images stay at `Immediate`. The new React Native feature flag defaults to `false` until app-specific gating wires it up.

Reviewed By: javache

Differential Revision: D106074485

fbshipit-source-id: 80ece75cf0d639be1fdbfdd5f19b838b7b64aba6
2026-05-27 07:09:25 -07:00
Marco Wang 09fc0432d1 Fix a few readonly 10/n (#56948)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56948

```
js1 flow-runner codemod flow/transformAllVariance --variance readonly --format-files=false
```

drop-conflicts

landed-with-radar-review

Reviewed By: SamChou19815

Differential Revision: D106144499

fbshipit-source-id: 85493334eae630d3dec7e5920633c076f8f09729
2026-05-22 22:27:46 -07:00
Alex Hunt 9c3fddf9cd Move core-cli-utils to private/ as a reference implementation (#56922)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56922

Move `react-native/core-cli-utils` from `packages/` to `private/`, stop publishing it to npm, and reframe it as a reference implementation of React Native CLI tooling.

The package has no known external consumers and is only used internally by `private/helloworld/` and `packages/rn-tester/`. Publishing it to npm creates a maintenance surface for a package that serves no external users.

See https://github.com/react-native-community/discussions-and-proposals/pull/1002.

#### Changes

- Move `packages/core-cli-utils/` to `private/core-cli-utils/`.
- Convert all source files to CJS (require/module.exports) with Flow comment syntax (/*:: */), eliminating the runtime Babel dependency.
 - Remove from the JS build pipeline (`scripts/build/config.js`).
 - Remove the defunct `patchCoreCLIUtilsPackageJSON()` runtime patching from both `helloworld/cli.js` and `rn-tester/cli.js`, and delete both `monorepo.js` files that contained it.
  - Add as `devDependency` to `rn-tester` and `helloworld`.
  - Skip `"*"` version deps in `_prepareHelloWorld()` so they aren't rewritten to the Verdaccio-published version.
  - Remove redundant desktop import ignore entry (`private/**` already covers it).
  - Rewrite README as reference implementation documentation.

Changelog:
[General][Breaking] - The `react-native/core-cli-utils` package is no longer published. It remains available in the React Native repo as a reference implementation.

Reviewed By: cortinico

Differential Revision: D105959855

fbshipit-source-id: 42e439a45273bdeca76029eff306cdf2451308e2
2026-05-22 12:36:57 -07:00
Samuel Susla 58012fb445 Ship useUnorderedMapInDifferentiator (#56918)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56918

changelog: [internal]

the experiment was neutral, let's ship it to simplify code

Reviewed By: javache

Differential Revision: D105943424

fbshipit-source-id: 3ff2ed1dbcb85f640305c4fcb2485db0a8a312fc
2026-05-22 08:57:50 -07:00
Jakub Piasecki b4966128af Fix percentage-based border radius (#56915)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56915

Changelog: [IOS][FIXED] Fixed percentage-based border radius

`isUniform` checks if all corners are equal, which is fine in most cases. When it comes to setting broderRadius, it also needs to be checked whether the corner is circular or not.

Reviewed By: jorge-cab, javache

Differential Revision: D105926696

fbshipit-source-id: f2d1cc7e7e2fc4a12b7964c7e06235f5a0d66bf7
2026-05-22 07:53:41 -07:00
Kamil Paradowski 226ef2e7c5 ArrayBuffer support to C++ TurboModules (#56729)
Summary:
Adds `ArrayBuffer` support to C++ TurboModules. This includes:

- Codegen support for `ArrayBufferTypeAnnotation` in module specs
- `AsyncArrayBuffer` — a move-only bridging type for holding ArrayBuffer data off the JS thread
- `Bridging<AsyncArrayBuffer>::toJs` for resolving promises with native-backed or owned-bytes buffers

iOS and Android support will follow in separate PRs. The new codegen type is currently restricted to C++ TurboModules via `excludedPlatforms: ['iOS', 'android']`.

## Changelog:

[GENERAL] [ADDED] - Add `ArrayBuffer` support to C++ TurboModules

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

Test Plan:
- JS parser/generators tests added.
 - New bridging unit tests in `BridgingTest.cpp` cover `AsyncArrayBuffer` construction and JS bridging.
 - `rn-tester`: `getArrayBuffer`, `processAsyncBuffer`, and `getAsyncBuffer` methods added to `NativeCxxModuleExample` in demo app.

```
[chpurrer@54913.od /data/sandcastle/boxes/fbsource (a00a9a84e7)]$ buck test //xplat/js/react-native-github/packages/react-native/ReactCommon/react/bridging:tests
↷ Skip: fbsource//xplat/js/react-native-github/packages/react-native/ReactCommon/react/bridging:tests - BridgingTest.asyncArrayBufferBorrowNativeBackedTest (0.0s)
Note: Google Test filter = BridgingTest.asyncArrayBufferBorrowNativeBackedTest
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from BridgingTest
[ RUN      ] BridgingTest.asyncArrayBufferBorrowNativeBackedTest
xplat/js/react-native-github/packages/react-native/ReactCommon/react/bridging/tests/BridgingTest.cpp:865: Skipped
Runtime does not expose tryGetMutableBuffer; borrow always throws

[  SKIPPED ] BridgingTest.asyncArrayBufferBorrowNativeBackedTest (7 ms)
[----------] 1 test from BridgingTest (7 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (7 ms total)
[  PASSED  ] 0 tests.
[  SKIPPED ] 1 test, listed below:
[  SKIPPED ] BridgingTest.asyncArrayBufferBorrowNativeBackedTest

Buck UI: https://www.internalfb.com/buck2/4a7fa180-4ce6-4dcf-b685-45d183bd4091
Test UI: https://www.internalfb.com/intern/testinfra/testrun/30680772470375729
Network: Up: 0B  Down: 0B  (reSessionID-9a7e839f-b20c-4d94-944f-8d1720e694f8)
Command: test.
Time elapsed: 3.0s
Buck UI: https://www.internalfb.com/buck2/4a7fa180-4ce6-4dcf-b685-45d183bd4091
Tests finished: Pass 31. Fail 0. Timeout 0. Fatal 0. Skip 1. Omit 0. Infra Failure 0. Build failure 0
[chpurrer@54913.od /data/sandcastle/boxes/fbsource (a00a9a84e7)]$
```

## RNTester-ios
```
buck install -r rntester-ios
```
 https://pxl.cl/9TgTf

Reviewed By: javache

Differential Revision: D105629442

Pulled By: christophpurrer

fbshipit-source-id: 91f6e3d16f69ba792469e02d6e539794e70b7101
2026-05-21 10:29:49 -07:00
Adrian Cotfas 60d8b282ea feat(Pressable): add support for PlatformColor and alpha (#56395)
Summary:
`android_ripple` on `Pressable` (and `TouchableNativeFeedback.Ripple()`) only
accepted numeric (pre-processed ARGB int) colors. Passing a `PlatformColor`
would throw an invariant in JS, making theme-aware ripple colors impossible.

This PR removes those guards and wires up the full color pipeline:

1. **JS** (`useAndroidRippleForView.js`, `TouchableNativeFeedback.js`):
   removed the `invariant` that rejected non-numeric processed colors.
   `TouchableNativeFeedback.Ripple()` now accepts `ColorValue` instead of
   `string`.
2. **C++** (`NativeDrawable.h`, `HostPlatformViewProps.cpp`): `color`
   changed from `int32_t` to `SharedColor` + a separate `colorResourcePaths`
   field for `PlatformColor` resource paths. The `fromRawValue` pipeline now
   resolves both plain colors and `PlatformColor` objects.
3. **Kotlin** (`ReactDrawableHelper.kt`): `getColor()` now handles both
   numeric and `PlatformColor` map values via `ColorPropConverter.getColor()`,
   catching `JSApplicationCausedNativeException` to fall back gracefully
   instead of crashing.
4. **Theme change support** (`ReactViewGroup.kt`): the raw drawable
   description maps are retained on the view, and `onConfigurationChanged`
   re-applies them so ripple colors update automatically on light/dark mode
   switch.

A new `alpha: number` (0–1) field is also added so users can apply opacity to
a `PlatformColor` whose value is fully opaque and can't have alpha embedded at
the JS level. It is applied by multiplying into the resolved color's alpha
channel.

Unresolvable `PlatformColor` resources are handled gracefully: on New Arch,
C++ omits the `color` key so Kotlin falls back to `colorControlHighlight`; on
Old Arch, `ReactDrawableHelper` catches the `JSApplicationCausedNativeException`
and falls back to `colorControlHighlight` instead of crashing.

## Changelog:

[ANDROID] [ADDED] - `android_ripple` now accepts `PlatformColor` for
theme-aware ripple colors, and a new `alpha` (0–1) parameter for controlling
ripple opacity independently of the color value.

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

Test Plan:
**Automated:**
- Existing Pressable snapshot tests pass unchanged.
- Updated snapshot for `PlatformColor + alpha` to use `?attr/colorAccent`
  (matching the RNTester example).
- Added snapshot test `should not crash with an unresolvable PlatformColor`
  verifying the component renders at the JS level without throwing.

**Manual (RNTester → Pressable → "Pressable with PlatformColor ripple and alpha"):**
1. `PlatformColor('?attr/colorAccent'), no alpha` → full-opacity accent ripple
2. `PlatformColor('?attr/colorAccent'), alpha=0.3` → 30% opacity accent ripple
3. `#FF0000, no alpha` → full red ripple (regression check)
4. `#FF0000, alpha=0.5` → 50% opacity red ripple
5. Toggle system light/dark mode → ripple color updates automatically
6. Pass an intentionally invalid attribute (e.g. `?attr/doesNotExist`) → no
   crash, ripple falls back to default `colorControlHighlight` grey

[Screen_recording_20260410_091000.webm](https://github.com/user-attachments/assets/5607d267-8cf1-4bbe-bad1-a80aac82d027)

> [!NOTE]
This is required in [React Native Paper](https://github.com/callstack/react-native-paper) to be able to fully support the Material Design specs but also useful as a general purpose feature for providing more flexibility when customizing ripple color.

Reviewed By: javache

Differential Revision: D105819708

Pulled By: fabriziocucci

fbshipit-source-id: d27c43e0b4e619b6af1c8de0cdb2882db05ee33c
2026-05-20 08:25:33 -07:00
Dawid Małecki f5bd86c311 Add snapshots with new arch only. (#56888)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56888

Adds new variant of snapshots called `newarch` with the `RCT_REMOVE_LEGACY_ARCH` flag set to `true`. This covers changes related to moving legacy code behind the ifndef, causing modifications to the API surface when the flag is enabled.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D105686175

fbshipit-source-id: 9e24fe728ee386fb3ee7f5398fa3c55c39a8df0d
2026-05-19 05:13:57 -07:00
Pieter De Baets 3b764745c4 Remove RCTCxxMethod (#56830)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56830

This is part of the legacy arch, and the last usage of it in RCTCxxModule was removed in D81294192

Changelog: [iOS][Removed] Legacy arch removal: RCTCxxMethod and DispatchMessageQueueThread

Reviewed By: christophpurrer

Differential Revision: D105168516

fbshipit-source-id: 5eda230bb9f25eab96b2088b6ac0185e7ddc7cbf
2026-05-18 07:20:10 -07:00
Alex Hunt db89600b56 Convert select component types to interface in TS typegen (#56809)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56809

#### Motivation

Adds (preserves) compatibility of Nativewind and Expo Web type augmentations with the Strict TypeScript API.

- These libraries rely on key React Native component types being defined as `interface`, not `type`, since TS module augmentation only supports `interface` declarations.
- Previously, our opt-in generated TypeScript types (Strict TypeScript API) emitted all props types as `type Foo = Readonly<...>` ), matching Flow source. However, this API change vs our manual types (which predominantly used `interface` on props) breaks library compatibility in these cases.
- This is very awkward to otherwise solve in user space — so opt for backwards compatibility in our new types.

#### Primer

TypeScript module augmentation lets a library extend an existing module's types without modifying the source.

e.g. In Nativewind ([source](https://www.nativewind.dev/docs/guides/third-party-components)):

```ts
declare module 'react-native' {
  interface ScrollViewProps extends ViewProps, ScrollViewPropsIOS, ScrollViewPropsAndroid, Touchable {
    contentContainerClassName?: string;
    indicatorClassName?: string;
  }
  interface FlatListProps<ItemT> extends VirtualizedListProps<ItemT> {
    columnWrapperClassName?: string;
  }
  interface ViewProps {
    className?: string;
  }
}
```

Expo's `react-native-web.d.ts` ([source](https://unpkg.com/expo@54.0.31/types/react-native-web.d.ts)) also follows the same pattern across several component props types.

#### Changes

Add new `build-types` transform, implementing an opt-in `/** build-types emit-as-interface */` annotation, converting eligible `type` aliases to `interface` declarations.

- Changing the Flow source files directly isn't viable — Flow doesn't support `interface extends Omit<>`, and several of these types use `Omit<>` in their composition. The post-transform operates on the TypeScript output where `interface extends Readonly<Omit<...>>` is valid.

The following emitted types are updated:

| Type | Augmented by | Source |
|---|---|---|
| `ViewProps` | `className?` | [Nativewind](https://www.nativewind.dev/docs/guides/third-party-components), [Expo](https://unpkg.com/expo@54.0.31/types/react-native-web.d.ts) |
| `ScrollViewProps` | `contentContainerClassName?`, `indicatorClassName?` | [Nativewind](https://www.nativewind.dev/docs/guides/third-party-components) |
| `ImagePropsBase` | `className?` | [Expo](https://unpkg.com/expo@54.0.31/types/react-native-web.d.ts) |
| `SwitchProps` | `className?` | [Expo](https://unpkg.com/expo@54.0.31/types/react-native-web.d.ts) |
| `TouchableWithoutFeedbackProps` | `className?` | [Expo](https://unpkg.com/expo@54.0.31/types/react-native-web.d.ts) |
| `InputAccessoryViewProps` | `className?` | [Expo](https://unpkg.com/expo@54.0.31/types/react-native-web.d.ts) |

`FlatListProps` is not included in this PR: its bare intersection (no `Readonly<>` wrapper) has a conflicting `fadingEdgeLength` property across constituent types that cannot be expressed as a single `extends` clause without hitting TS2320. This will be addressed in a follow-up.

`VirtualizedListWithoutRenderItemProps<T>` in `react-native/virtualized-lists` is separately owned and not changed here.

Changelog:
[General][Changed] - **Strict TypeScript API**: Select component props types are now `interface` declarations, enabling module augmentation by libraries like NativeWind and Expo (preserve compatibility)

Reviewed By: robhogan

Differential Revision: D104808984

fbshipit-source-id: 69c74fde1180a21c7241be53f010702710672638
2026-05-18 03:39:22 -07:00
Alex Hunt 0b9969f7f5 Prune no-op Omit keys from generated types (#56824)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56824

Update the `simplifyTypes` transform (Flow → TS generation) to prune non-overlapping keys from `Omit<>` helpers in TypeScript `interface` unions.

This greatly reduces API snapshot churn/inflation in the next two diffs, which convert a number of `type` declarations (trivial unions) to `interface` (`Omit<>` required for correct union).

#### In detail

`flow-api-translator` emits `Omit<ParentType, keys>` to faithfully translate Flow's object spread override semantics to TypeScript.

```
// Flow
type Base = {x: string, y: number};
type Child = {...Base, x: boolean}; // Later properties in an object spread override earlier ones

// TypeScript
type Base = {x: string; y: number};
type Child = Omit<Base, "x" | "y"> & {x: boolean};  // Later properties in an object spread *merge*, rather than override. So we must use Omit<> for matched keys.
```

For `interface` type unions with overlapping keys, this can result in a number of unnecessary lines in the API snapshot, with little/no human readable value.

This diff extends existing `Omit<>` handling by `simplifyTypes` to recursively resolve all property keys reachable from a type, and prune keys that don't exist on the parent type.

```
// TypeScript
type Child = Omit<Base, "x"> & {x: boolean};  // Only "x" matched - strip `| "y"`
type ChildTwo = Base & {z: string};  // No property collision - strip entire `Omit<>`
```

- See changes to `ReactNativeApi.d.ts`, [P2325468482](https://www.internalfb.com/phabricator/paste/view/P2325468482?view=diff) for examples.
- **Decision point**: This diff opts to preserve correctness in TS — even though the snapshot isn't/isn't intended to be read directly/programatically, vs the conciseness tradeoff if we dropped all `Omit<>`s (human readable but ambiguous to the typechecker).

Changelog: [Internal] - JS API snapshot changes are a simplification refactor only

Reviewed By: robhogan

Differential Revision: D105150070

fbshipit-source-id: 43b0ef517164332a5cfaee7a5de5747749ac5e7c
2026-05-14 04:16:19 -07:00
Alex Hunt a9be1b12c6 Add --watch mode to build-types script (#56808)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56808

Adds a `--watch` flag to `yarn build-types`. Helpful when debugging output TS types end-to-end.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D104815967

fbshipit-source-id: 23ca53bffd5b0508272a5fad8bd4ca4314bb9d06
2026-05-14 04:16:19 -07:00
Alex Hunt 37be9351c8 Update react-native-devtools-frontend URLs (#56812)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56812

Update load-bearing `react/react-native-devtools-frontend` URLs following repo move. In particular, the `sync-and-build` script.

URLs in code comments are preserved (rely on redirect / avoid churn).

Changelog: [Internal]

___

overriding_review_checks_triggers_an_audit_and_retroactive_review
Oncall Short Name: react_native_iroc

Differential Revision: D105033074

fbshipit-source-id: 78545cb92d9623d9a115d1a940ba7efc78a5a6d8
2026-05-13 11:13:55 -07:00
Alex Hunt 2991a97731 Upgrade TypeScript to ^6.0.3 (#56772)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56772

Upgrades to TypeScript 6.0.3 and updates `typescript-eslint/*` for TS 6.0 compatibility across `react-native` and `metro`.

#### Motivation

TypeScript 6.0 (Mar 2026) will resolve https://github.com/facebook/react-native/issues/53565. Before updating in the React Native CLI template, align in RN and Metro source for consistency.

This is an internal change since:
- This upgrade only applies to TS analysis of these repos' source code.
- Edits to `react-native/typescript-config/tsconfig.json` (which *is* distributed) maintain backwards compatibility.

#### Changes

**react-native**

- Bump `typescript` from `^5.8.3` to `^6.0.3`
- Bump `typescript-eslint/*` from `^8.24.0` to `^8.59.2`
- Replace deprecated `moduleResolution: "node"` with `"node16"` and `target: "es5"` with `"es2015"` in codegen-typescript-test
- Add explicit `types: ["jest", "node"]` where needed (TS 6.0 defaults `types` to `[]`)
- Set `strict: false` in configs that only enable specific strict flags (TS 6.0 defaults `strict` to `true`)
- Update `ModuleResolutionKind.NodeJs` to `Node16` in build config

**metro**

- Bump `typescript` from `5.8.3` to `^6.0.3`
- Bump `typescript-eslint/*` from `^8.36.0` to `^8.59.2`
- No tsconfig changes needed (`tsconfig/node20` preset is already TS 6.0 compatible)

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D104658690

fbshipit-source-id: 9a2feeb257d5783431941a911b17065fcd0389a5
2026-05-12 17:53:54 -07:00
Andrew Datsenko ab8b40df81 Add TextEffect component and registry for custom text span effects (#56720)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56720

Introduces a generic TextEffect system that lets apps register custom text
span effects without modifying React Native core. This can serve for use cases like `react-native-live-markdown`, or product specific effects.

The implementation is pretty dumb right now. It's just a marker, where we can add some JSON serializable data, to be serialized during Spannable creation on JS side MapBuffer.

**JS API:**
```js
import requireNativeTextEffect from 'react-native/Libraries/Text/requireNativeTextEffect';
const Spoiler = requireNativeTextEffect<{}>('RCTSpoiler');

<Text>Normal <Spoiler>hidden text</Spoiler></Text>
```

**Android registration** (via FabricUIManager):
```kotlin
val fabricUIManager = UIManagerHelper.getUIManager(
    context, UIManagerType.FABRIC) as? FabricUIManager
fabricUIManager?.textEffectRegistry?.register("RCTSpoiler") { props ->
    MyCustomSpan()
}
```

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D98812222

fbshipit-source-id: 7000a0452b7592cdc2b26e7eaa37ec95736efce4
2026-05-11 13:17:34 -07:00
Riccardo Cipolleschi e2936cbee4 Remove old hermes nightly script files (#56752)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56752

Delete the old script files that were renamed in prior commits:
- scripts/releases/use-hermes-nightly.js (renamed to use-hermes-prebuilt.js)
- scripts/try-set-nightly-hermes-compiler.js (renamed to try-set-hermes-compiler-prebuilt.js)

These deletions were accidentally omitted from their respective rename commits.

## Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D104650744

fbshipit-source-id: a0f1e3279622f792a0e79d011d942539e5168eaf
2026-05-11 12:55:12 -07:00
Riccardo Cipolleschi ac48b56a1a Rename try-set-nightly-hermes-compiler.js (#56758)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56758

Rename scripts/try-set-nightly-hermes-compiler.js to
scripts/try-set-hermes-compiler-prebuilt.js. The script sets the hermes-compiler
version to the latest prebuilt (latest-v1 on npm), not a nightly build.
Update the preinstall script reference in the root package.json.

## Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D104649635

fbshipit-source-id: 8375d0518ea8c9ca99a59fd65366210eeea91e50
2026-05-11 12:55:12 -07:00
Riccardo Cipolleschi f37513595f Rename use-hermes-nightly.js to use-hermes-prebuilt.js (#56750)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56750

Rename scripts/releases/use-hermes-nightly.js to scripts/releases/use-hermes-prebuilt.js.
The script fetches the latest prebuilt Hermes from the 'latest-v1' npm dist-tag, not a
true 'nightly' build. Update:
- Script name: use-hermes-nightly.js -> use-hermes-prebuilt.js
- Internal log message: 'nightly update' -> 'prebuilt update'
- Import: updateHermesVersionsToNightly -> updateHermesVersionsToPrebuilt
- CI step names: 'Set nightly Hermes versions' -> 'Set Hermes prebuilt version'
- Script path references in test-all.yml, test-ios-helloworld/action.yml,
  test-ios-rntester/action.yml

## Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D104649633

fbshipit-source-id: ea74dbdba5a7f31aa58e5f581249e384581e6620
2026-05-11 12:55:12 -07:00
Riccardo Cipolleschi 041b6d5f9e Rename 'nightly' functions to 'prebuilt' in release scripts (#56753)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56753

The functions getLatestHermesNightlyVersion() and updateHermesVersionsToNightly() were
misleadingly named: they actually fetch from the 'latest-v1' npm dist-tag, not a 'nightly'
tag. Rename them to better reflect what they do:
- getLatestHermesNightlyVersion -> getLatestHermesVersion
- updateHermesVersionsToNightly -> updateHermesVersionsToPrebuilt

Update all call sites in publish-npm.js and publish-npm-test.js.

## Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D104649629

fbshipit-source-id: b1d60b9bb48ef51946e99877a73d5760db585a4c
2026-05-11 12:55:12 -07:00
Riccardo Cipolleschi d49aac6b65 Consolidate Hermes version files and simplify JS release scripts (#56737)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56737

  - Remove `sdks/.hermesversion` from `package.json` files array — only `.hermesv1version` remains
  - Simplify `hermes-utils.js`: remove `readHermesTag()`, `HERMES_TAG_FILE_PATH`; `setHermesTag()` takes single argument
  - Simplify `scripts/releases/utils/hermes-utils.js`: single version in `getLatestHermesNightlyVersion()` and `updateHermesRuntimeDependenciesVersions()`
  - Simplify `bump-hermes-version.js`: remove `--tag` and `--hermes-version` CLI options
  - Simplify `release-hermes-for-branch-cut.js`: remove legacy branch/workflow/PR logic, keep only single Hermes branch

## Changelog:
[General][Changed] - Simplified build JS Hermes infrastructure for the Release

  ## Test plan
  - [x] JS tests: `yarn jest --no-watchman hermes-utils-test.js` — 5/5 tests pass

Reviewed By: cortinico

Differential Revision: D104380961

fbshipit-source-id: b9658d88624001a820b9838c84f1775995e9bc52
2026-05-11 12:55:12 -07:00
Riccardo Cipolleschi 0a5c8c6b4b Remove hermesV1Enabled Gradle property and simplify Hermes version resolution (#56733)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56733

  - Remove `hermesV1Enabled` / `react.hermesV1Enabled` Gradle property and all branching it controls
  - Rename `HERMES_V1_VERSION_NAME` to `HERMES_VERSION_NAME` in `version.properties`
  - Remove `hermesV1Enabled` from `PrivateReactExtension`, `ProjectUtils`, `PropertyUtils`, `ReactPlugin`
  - Simplify `DependencyUtils.Coordinates` to single Hermes version
  - Make `-DHERMESVM_HEAP_HV_MODE=HEAP_HV_PREFER32` CMake flag unconditional
  - Remove `-DHERMES_V1_ENABLED=1` CMake argument from `ReactAndroid` and Fantom builds
  - Delete `hermesV1Enabled=true` from `gradle.properties`
  - Update all Gradle plugin tests

## Changelog:
[Android][Removed] - Remove hermesV1Enabled and simplify the code

  ## Test plan
  - [x] Gradle plugin: `./gradlew -p packages/gradle-plugin build` — BUILD SUCCESSFUL, all tests pass
  - [x] Android: `./gradlew :packages:rn-tester:android:app:assembleDebug` — BUILD SUCCESSFUL

Reviewed By: cortinico

Differential Revision: D104244582

fbshipit-source-id: 7d12af5b934aac9d431e89d9a2eac41213c997a1
2026-05-11 12:55:12 -07:00
Christoph Purrer 734f5c180d Migrate NativeSampleTurboModule to codegen integration - RFC (#56723)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56723

Replace hand-written spec files for `NativeSampleTurboModule` with proper codegen integration by removing exclusion rules and configuring the module in `package.json`. This eliminates ~1600 lines of manual boilerplate (Java, C++, Objective-C) across Android, iOS, and macOS platforms, allowing the codegen system to generate these files automatically from the JavaScript spec.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D104323543

fbshipit-source-id: 241f256d03a4ff0f914179c5ee2842d29fad5554
2026-05-11 11:24:46 -07:00
Pieter De Baets 9f4513c751 Cleanup useLISAlgorithmInDifferentiator flag (#56715)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56715

Remove the useLISAlgorithmInDifferentiator feature flag and all associated code. This flag was an experimentation flag for using the Longest Increasing Subsequence algorithm in the Differentiator to minimize REMOVE/INSERT mutations during child list reconciliation. The experiment is not being shipped (default was false), so all references are being cleaned up.

Changes include:
- Remove flag from ReactNativeFeatureFlags.config.js and all generated files (C++, Kotlin, JNI, JS)
- Remove the LIS algorithm code path from Differentiator.cpp, keeping only the existing greedy algorithm
- Delete LongestIncreasingSubsequence.h helper and its unit tests
- Update ShadowTreeLifeCycleTest.cpp to remove LIS parameterization (now greedy-only)
- Update Mounting-itest.js and View-benchmark-itest.js to remove LIS flag references and conditional branches
- Remove Facebook Android/iOS overrides and mobile config entries
- Update C++ API snapshots to remove longestIncreasingSubsequence symbol

Changelog:
[General][Removed] - Remove unused `useLISAlgorithmInDifferentiator` feature flag and LIS algorithm code from the Differentiator

Reviewed By: sammy-SC

Differential Revision: D104044772

fbshipit-source-id: 08857d23edba72ec2cf7bdeea876335087b9da8d
2026-05-07 09:43:02 -07:00
Alex Hunt ef6463c25d Align nullable types across Appearance API (#56687)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56687

Simplify and align nullable values in the `Appearance` API.

| API | Flow / Strict TS API | Manual `.d.ts` |
|---|---|---|
| `getColorScheme()` | `ColorSchemeName | null` (narrowed) | `ColorSchemeName | null` |
| `useColorScheme()` | `ColorSchemeName | null` (narrowed) | `ColorSchemeName | null` (fixed) |

At the native spec level, nullability is removed entirely — the module always returns a valid color scheme, and the module-level `?Spec` already covers the "module absent" case.

Changelog:
[General][Breaking] - Fix return type of `useColorScheme()` hook (now  `ColorSchemeName | null`)
- Release Crew note: This is a net fix/extension of D102527387

Reviewed By: cipolleschi

Differential Revision: D103865622

fbshipit-source-id: a6391cfd86a634ea660734735614169d0601a830
2026-05-07 01:54:35 -07:00
Pieter De Baets 86dbb3b985 Fix TSAN data races in InspectorFlags and InspectorPackagerConnection (#56534)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56534

Fix two ThreadSanitizer data races caught by the messenger_demo integration test under dev-tsan mode.

**InspectorFlags**: `loadFlagsAndAssertUnchanged()` reads and writes `cachedValues_` without synchronization. The main thread calls it via `getIsProfilingBuild()` while the JS thread calls it via `getNetworkInspectionEnabled()`, racing on the shared `optional<Values>`. Add a `std::mutex` to protect `cachedValues_` access. The lock is taken after computing `newValues` from feature flags, so flag reads stay outside the critical section. `dangerouslyResetFlags()` also acquires the lock to avoid racing with concurrent flag reads.

**Inspector**: `Inspector::connectDebugger()` is called from the main thread but creates and uses `packagerConnection_` which is also accessed on the inspector thread. Dispatch the body of `connectDebugger()` to the task dispatch thread via `invokeElsePost()`, matching the pattern other Inspector methods already use. This ensures `InspectorPackagerConnection::connect()` is called on the correct thread as its API requires.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D101809616

fbshipit-source-id: 92eac22ca9ab364daafc403a0fdbb39394bd0f63
2026-05-01 06:13:34 -07:00
Pieter De Baets f4f4b95abe Migrate RCTBlobManager to RCTTurboModuleWithJSIBindings (#56575)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56575

Migrates RCTBlobManager on iOS from using private API (RCTBridge+Private.h / RCTCxxBridge) to using the standardized RCTTurboModuleWithJSIBindings protocol for installing JSI bindings. This aligns with the Android implementation and removes dependency on private React API.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D102145286

fbshipit-source-id: 9907f5a2f64ae55741e25d9b96ae42e94e7e5385
2026-04-24 04:50:18 -07:00
Gang Zhao a78d6f4d0e Exclude metainternal from C++ API snapshots (#56545)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56545

Add */metainternal/* to top-level exclude_patterns in the C++ API snapshot config.
This directory may contain internal headers that are not part of the public React Native
C++ API surface.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D101879633

fbshipit-source-id: a0118c146ba6eca667671bd572cd39c59e339469
2026-04-22 10:02:40 -07:00
Riccardo Cipolleschi 45ceacc08f Use Hermes V1 by default (#56476)
Summary:
The recent introduction of the `IRuntime` JSI interface moved `ScopeState` from `Runtime` to `IRuntime`, changing the C++ ABI (mangled symbol names). The Android build was still consuming a legacy Hermes nightly (`hermes-compiler@nightly`) that was built against the old JSI headers, causing an `UnsatisfiedLinkError` crash at startup:

```
dlopen failed: cannot locate symbol "_ZN8facebook3jsi7Runtime8popScopeEPNS1_10ScopeStateE" referenced by "libhermesvm.so"
```

This PR aligns Android with how iOS already handles Hermes V1:

1. **`scripts/try-set-nightly-hermes-compiler.js`** — The `yarn install` preinstall hook now installs `hermes-compiler@latest-v1` instead of `hermes-compiler@nightly`. This is the same npm dist-tag that iOS uses in `scripts/ios-prebuild/hermes.js`.

2. **`build.gradle.kts`** — When `hermesV1Enabled=true`, the Hermes version from `package.json` is used as-is (no `-SNAPSHOT` suffix), since V1 stable releases are published as regular Maven artifacts, not snapshots.

3. **`version.properties`** — Bumps `HERMES_V1_VERSION_NAME` from `250829098.0.11` to `250829098.0.12` for release builds and iOS podspec.

## Changelog:

[ANDROID] [FIXED] - Use Hermes V1 stable release instead of legacy nightly to fix startup crash caused by JSI ABI mismatch

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

Test Plan:
- Run `yarn install` from the repo root and verify `hermes-compiler` in `packages/react-native/package.json` is set to the `latest-v1` version (currently `250829098.0.12`)
- Run `yarn android` from `packages/rn-tester` and verify the app launches without crashing
- Verify CI `build_android` job passes

Reviewed By: javache

Differential Revision: D101247487

Pulled By: cipolleschi

fbshipit-source-id: c006e76969bb1bc27a9305ea97d5cff4b504ff1f
2026-04-22 02:58:55 -07:00
Christoph Purrer 16edd89dd0 Fix unused parameter warnings in graphicsConversions.h (#56520)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56520

Fixed clang-diagnostic-unused-parameter warnings in graphicsConversions.h by commenting out unused `context` parameters in 4 fromRawValue() functions.

The `context` parameter is part of the fromRawValue interface but is not used in the Point, Size, EdgeInsets, and CornerInsets implementations. Used the comment-out approach (/* context */) to maintain API compatibility while fixing the warnings.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D101108326

fbshipit-source-id: b245c466223b6da9efa91ed3c3686fc967bde254
2026-04-21 19:14:01 -07:00
Christoph Purrer 19a23e7914 Fix unused parameter warnings in ShadowNode.h (#56519)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56519

Fixed clang-diagnostic-unused-parameter warnings in ShadowNode.h by commenting out unused parameter names in the completeClone method. This addresses warnings for parameters `sourceShadowNode` and `fragment` that were declared but not used in the function body.

Also applied lint patch to remove redundant `virtual` keyword from the destructor declaration.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D101108467

fbshipit-source-id: 3c717f27df362e68f308b0e0f119b0fe43e82818
2026-04-21 18:42:17 -07:00
Christoph Purrer d65511474f Fix unused parameter warning in propsConversions.h (#56500)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56500

Fixed clang-diagnostic-unused-parameter warning in React Native's propsConversions.h by commenting out the unused `context` parameter in the `fromRawValue` template function.

This change maintains API compatibility while resolving the compiler warning.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D101111638

fbshipit-source-id: dd842db66917fe68878ddcc9d364ba3f7455a641
2026-04-21 18:00:32 -07:00
Christoph Purrer 5b9cefcf90 Remove double-conversion dependency and also DoubleConversions.cpp and replace it with DebugStringConvertible (#56110)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56110

**Summary**

Removes the `double-conversion` dependency from `DoubleConversions.cpp` in the React Native repository.

- Removed Dependencies: `double-conversion/double-conversion.h`

 Updated Code

* Modified `DoubleConversions.cpp` to use standard C++ library headers (`cmath` and `cstdio`) instead of `double-conversion`.

This change aims to reduce dependencies and simplify the codebase. The removed dependency was previously used for string conversion, which has been replaced with standard C++ library functions.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D96082175

fbshipit-source-id: abfb09d1175eba33e1a1694191f11534b4e7a00e
2026-04-21 13:29:46 -07:00
Rubén Norte 0f9b8e4a62 Cap maxWorkers and bump heap to bound Fantom Metro memory (#56529)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56529

Fantom runs every test through a single shared Metro server (started in
`globalSetup`). Jest's default `maxWorkers` is `numCpus - 1`, so on a
high-core box (e.g. 176 CPUs) ~175 workers fire bundle requests at Metro
concurrently. Each in-flight request makes Metro materialize a full
dependency `Graph` (transformed modules, source maps, inverse-deps,
file-watcher subscription), which is hundreds of MB.

The per-test `DELETE` eviction added in D101652820 only releases that
memory after the bundle response completes, so the simultaneous in-flight
set still blows past the previous Node `--max-old-space-size=8192` ceiling
in `scripts/fantom.sh` — the Metro process aborts with
`FATAL ERROR: Ineffective mark-compacts near heap limit` after just a
handful of test suites.

Two coordinated changes that balance throughput and safety:

- `scripts/fantom.sh`: bump the Node heap from 8 GB to 16 GB so we have
  headroom over the observed steady-state peak.
- `private/react-native-fantom/config/jest.config.js`: cap `maxWorkers`
  at `min(numCpus - 1, 16)`. With 8 workers the heap peaked at ~3 GB
  (~400 MB / worker), so 16 workers fits comfortably under a 16 GB cap
  with ~40% headroom.

This is intentionally a balance rather than a hard worker cap — bumping
the heap alone would still leave 100+ in-flight graphs racing GC, and
capping workers alone leaves throughput on the table on big machines.

Changelog: [Internal]

Reviewed By: andrewdacenko

Differential Revision: D101791795

fbshipit-source-id: 035c7235c32303f7b7f1eb05698b2a5cba90edc9
2026-04-21 06:01:11 -07:00