117 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
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
React Native Bot 05a41cdc67 Release 0.88.0-rc.1
#publish-packages-to-npm&next
2026-09-15 22:16:48 +00:00
Fabrizio Cucci ad7b17d8ee Fix cache-key test on release branches
getCacheKey only hashes package contents when the version ends in -main;
published releases short-circuit to the version string. The test asserted
only the main-build property, so it failed on every release branch.
Assert the correct property for each case.
2026-09-15 20:26:15 +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
Oskar Eichler 0d64c9a13a Run codegen for formatted native component calls (#58257)
Summary:
The source-optimized preset enables native component codegen only when `codegenNativeComponent` is immediately followed by `<`. Valid Flow syntax permits comments or whitespace before the type arguments, so `codegenNativeComponent /* comment */ <NativeProps>(...)` bypasses codegen and emits an ordinary runtime call instead of the generated `__INTERNAL_VIEW_CONFIG` produced by the full preset path.

Use the stable `codegenNativeComponent` identifier token as the cheap source prefilter while retaining the existing null/undefined full-scan path. Formatting no longer changes build output; false-positive tokens only enable the codegen visitor, which remains a no-op without a matching call.

## Changelog:

[GENERAL] [FIXED] - Run native component codegen when Flow type arguments are separated by trivia.

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

Test Plan:
- Added a valid Flow native-component spec containing a comment before `<NativeProps>`.
- Exact optimized baseline emits the ordinary call without `__INTERNAL_VIEW_CONFIG`; the fixed transform generates the static view config.
- Full preset Jest passes: 4/4 suites, 111/111 tests, 16 snapshots.
- Fresh Flow check reports 0 errors.
- Targeted no-ignore ESLint, Prettier, and `git diff --check` pass.

No public API or breaking behavior change; optimized and full preset paths now agree for valid formatting.

Reviewed By: GijsWeterings

Differential Revision: D118266389

Pulled By: javache

fbshipit-source-id: 0b4279eed9f831e1e8f4669bd522645023dfdeac
2026-09-04 06:09:06 -07:00
Oskar Eichler 0c0e9f0840 Guard private syntax preservation by transform profile (#58253)
Summary:
`customTransformOptions.unstable_preserveClassPrivate` currently disables private-field and private-method transforms for every profile. With `hermes-legacy`, the preset still lowers the surrounding class syntax, and Babel then aborts because its class transform requires the private transforms.

Only preserve private syntax when the selected profile also preserves class syntax. Stable and canary Hermes profiles keep their existing experimental behavior; legacy profiles continue lowering private fields and methods together with classes instead of crashing.

## Changelog:

[GENERAL] [FIXED] - Keep private class transforms enabled for profiles that lower classes.

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

Test Plan:
- Added a focused `hermes-legacy` regression containing both a private field and private method with the preservation option enabled.
- Exact baseline throws Babel's private-method transform error; the fixed preset compiles and emits the normal private-field helpers.
- Full preset Jest passes: 4/4 suites, 111/111 tests, 16 snapshots.
- Fresh Flow check reports 0 errors.
- Targeted no-ignore ESLint, Prettier, and `git diff --check` pass.

No breaking change: stable/canary preservation is unchanged, while an invalid legacy configuration now compiles correctly.

Reviewed By: javache

Differential Revision: D118438778

Pulled By: vzaidman

fbshipit-source-id: 650a70d8759b135cb06f9bd3f2b45b0ee766762b
2026-09-03 04:52:49 -07:00
Oskar Eichler bbdeb7dc1d Inline the last duplicate Platform.select key (#58249)
Summary:
The React Native Babel preset statically replaces `Platform.select({...})` for the target platform. Its property scan currently stops at the first matching key, while JavaScript object-literal evaluation keeps the last duplicate definition. For example, `Platform.select({ios: 1, ios: 2})` runs as `2` but the preset compiles it to `1`.

Scan the already-validated static properties from the end so compiled output matches runtime semantics while preserving O(n), allocation-free lookup. Metro has a parallel transform that can run first; companion [Metro PR https://github.com/react/react-native/issues/1889](https://github.com/react/metro/pull/1889) applies the same correction so output remains transform-order independent.

## Changelog:

[GENERAL] [FIXED] - Inline the last duplicate key from static Platform.select object literals.

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

Test Plan:
- Added a focused preset regression; pristine main emits `const value=1`, while the fix emits `const value=2`.
- Full preset Jest passes: 4/4 suites, 111/111 tests, 16 snapshots.
- Fresh Flow check reports 0 errors.
- Targeted no-ignore ESLint, Prettier, and `git diff --check` pass.

No behavior changes for object literals without duplicate static keys; no UI change.

Reviewed By: christophpurrer

Differential Revision: D118499490

Pulled By: vzaidman

fbshipit-source-id: 3bd58c44c70415c57ed02266a5af2eea242471e4
2026-09-03 03:35:10 -07:00
Dui Rapeeporn Pimup bdce09d494 Revert D118563281: Revert D118438065: [react-native][PR] Apply preset defaults without a Babel API
Differential Revision:
D118563281

Original commit changeset: 78cab65f148d

Original Phabricator Diff: D118438065

fbshipit-source-id: b748a2566173b4d9ac4597062a208d157680cd5a
2026-09-02 17:30:39 -07:00
Anusha Pachunuri 6306c4abd9 Revert D118438065: Apply preset defaults without a Babel API
Differential Revision:
D118438065

Original commit changeset: e952eece7266

Original Phabricator Diff: D118438065

fbshipit-source-id: 78cab65f148d8e3290a19ced1e00a1b59b739062
2026-09-02 17:17:44 -07:00
Oskar Eichler 9c6efa25c1 Include preset dependencies in main cache keys (#58251)
Summary:
Development `-main` builds compute the Babel preset transformer cache key from preset JavaScript sources, but omit `package.json`. React Native regularly updates parser and Babel plugin dependencies without changing those source files, so a dependency-only update can preserve the cache key and reuse transforms produced by an older dependency set.

Include the preset package metadata bytes in the existing MD5 input. This adds one small file read only to the memoized `-main` slow path; published releases remain keyed directly by their immutable package version.

## Changelog:

[INTERNAL] [FIXED] - Invalidate React Native Babel preset development caches when dependency metadata changes.

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

Test Plan:
- Added an isolated-module regression that supplies two package metadata contents with identical preset source contents; pristine main returns the same key, while the fix returns different keys.
- Full preset Jest passes: 5/5 suites, 111/111 tests, 16 snapshots.
- Fresh Flow check reports 0 errors.
- Targeted no-ignore ESLint, Prettier, and `git diff --check` pass.

No transform output, public API, published-release cache behavior, or UI changes.

Reviewed By: christophpurrer

Differential Revision: D118440621

Pulled By: vzaidman

fbshipit-source-id: 21d4df2d5bc0428d6cf2138b2f5230d777b7ddb0
2026-09-02 14:32:29 -07:00
Oskar Eichler 9ad8c830bd Apply preset defaults without a Babel API (#58254)
Summary:
The preset's Babel-API accesses are optional, but invoking it without the Babel API still has two incomplete fallback paths: `preset()` can read properties from an undefined options object, and `getPreset(code, {dev: false})` receives no transform profile and silently falls back to legacy class transforms instead of the normal `hermes-stable` default.

Default options to an empty object, consistently rely on that non-null invariant throughout the configuration builder, and apply `hermes-stable` when neither explicit options nor `babel.caller` provides a profile. Explicit options and caller-provided profiles retain precedence.

## Changelog:

[GENERAL] [FIXED] - Apply normal preset defaults when invoked without a Babel API or options object.

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

Test Plan:
- Added a regression proving `preset()` builds without options or a Babel API.
- Added a transform regression proving no-API invocation preserves classes under the default `hermes-stable` profile; exact baseline lowers the class to helpers.
- Full preset Jest passes: 4/4 suites, 112/112 tests, 16 snapshots.
- Fresh Flow check reports 0 errors.
- Targeted no-ignore ESLint, Prettier, and `git diff --check` pass.

No breaking change: explicit profiles/caller behavior are unchanged, while standalone invocation now matches the preset's documented default path.

Reviewed By: javache

Differential Revision: D118438065

Pulled By: vzaidman

fbshipit-source-id: e952eece72664dfa9d60d25d26955655e057f388
2026-09-02 13:47:10 -07:00
Oskar Eichler 619c8aed24 Detect formatted React.createClass calls (#58256)
Summary:
The source-optimized preset enables React's display-name transform only when the exact bytes `React.createClass` are present. Valid comments or whitespace around the member access, such as `React /* comment */ . createClass(...)`, bypass the transform and omit the inferred component `displayName`, unlike the full preset path.

Use the stable `createClass` identifier token as the cheap source probe while retaining the separate `createReactClass` probe. Formatting no longer changes output; unrelated token matches only enable an otherwise no-op Babel visitor.

## Changelog:

[GENERAL] [FIXED] - Detect trivia-separated React.createClass calls in optimized preset configuration.

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

Test Plan:
- Added an optimized-source regression with comment/whitespace-separated member access.
- Exact baseline omits `displayName`; the fixed transform emits `displayName: "Component"`.
- Full preset Jest passes: 4/4 suites, 111/111 tests, 16 snapshots.
- Fresh Flow check reports 0 errors.
- Targeted no-ignore ESLint, Prettier, and `git diff --check` pass.

No public API or breaking behavior change; optimized and full preset paths now agree for valid formatting.

Reviewed By: GijsWeterings

Differential Revision: D118266439

Pulled By: javache

fbshipit-source-id: 802fe1c8cadda18931384cd5a7f6e88a63e87bad
2026-09-02 03:22:21 -07:00
Rob Hogan f63b2a1cb5 Babel preset: Make Platform inlining opt-in via inlinePlatform (default on via @react-native/metro-babel-transformer) (#57973)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57973

`react-native/babel-preset` inlines `Platform.OS` and `Platform.select(...)` whenever it is handed a `platform` (since yesterday - https://github.com/react/react-native/pull/57848 ), but this is over-zealous - `platform` is a pre-existing transform option whose intent is to set the transform target. In some cases (eg, to allow `Platform` mocking from tests), we don't want `Platform` inlining, even though `platform` may already be passed for other reasons.

Gate the inlining behind a separate `inlinePlatform` opt-in, resolved as `options.inlinePlatform ?? babel.caller(...) ?? false`, mirroring how `platform` and `unstable_transformProfile` are already resolved. Metro already models this as a distinct transform option, so both Babel transformers pass it straight through. The caller channel covers the case where the preset is named in a `babel.config.js` and so receives no preset options at all.

Bundling is unaffected: Metro sets `inlinePlatform` on every transform, so `Platform` continues to be inlined through `react-native/metro-babel-transformer`.

Changelog:
[General][Changed] - `Platform.OS` and `Platform.select(...)` inlining in `react-native/babel-preset` now requires the `inlinePlatform` option in addition to `platform`

Reviewed By: GijsWeterings

Differential Revision: D116281656

fbshipit-source-id: 0230cd74f38661862396391da62cf81b34773b85
2026-08-17 04:38:28 -07:00
Rob Hogan 40c06121a1 Inline Platform within RN’s Babel preset (#57848)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57848

Adds a React Native-owned Babel plugin that inlines `Platform.OS` and
`Platform.select(...)`, from
`react-native/babel-preset`  at the front of the preset's plugin list (importantly, before
the preset lowers ES modules to CommonJS).

Metro already inlines `Platform`, but its matcher (`metro-transform-plugins`'
`inline-plugin` via `createInlinePlatformChecks`) runs *after* ESM has been
lowered to CommonJS. By then a genuine `import {Platform} from 'react-native'`
has become `_reactNative.Platform.OS` and provenance is obscured and fragile to track. Metro compensates by matching on the local
identifier spelling - so `Platform.OS` inlines whether or not `Platform` is
actually React Native's, and a genuine deep or RN-relative import may be missed entirely.

`Platform` inlining is in any case much more of an RN concern than a Metro one - it has to be aware of RN APIs and module names, and even the module’s path.

This plugin recognises:

- `import {Platform} from 'react-native'` (including aliased imports)
- `import * as RN from 'react-native'`, uses of `RN.Platform`
- `import P from 'react-native/Libraries/Utilities/Platform'`
- the equivalent `require` forms, plus destructuring and immutable aliases
- RN's internal relative imports, e.g. `../../Utilities/Platform`

…and deliberately does *not* recognise anything it cannot prove - a bare
`Platform.OS` global, `React.Platform.OS`, or a same-named import from another
package.

Metro's late matcher is left fully enabled and remains responsible for
those historical forms, so this change is purely additive: it inlines genuine
imports Metro was missing, and changes nothing Metro already handled. Metro’s plugin will be deprecated and removed in future.

Notable details:

- Relative RN imports are resolved lexically, with no filesystem access and no
  platform-extension resolution — the identity we need is the extension-less
  module `<rn-root>/Libraries/Utilities/Platform`, and Metro picks
  `Platform.ios.js` / `Platform.android.js` later. The RN package root is
  identified by directory name, which covers `node_modules/react-native`,
  `packages/react-native` and pnpm layouts alike, and rejects
  `react-native-web` and friends (who would be expected to adjust the paths in their forks)
- Imports are left in place. Removing them would change dependency collection,
  so it is handled separately.
- A no-platform build (`null`, or the empty string that RN's Jest preprocessor
  passes) is a no-op — inlining `Platform.OS` to `""` would be wrong.
- The plugin source is added to the preset's `getCacheKey` so edits invalidate Metro's transform cache.

Changelog:
[General][Changed] - Inline `Platform.OS` and `Platform.select(...)` for
React Native `Platform` imports during the Babel preset, covering some cases that were previously left un-inlined.

Reviewed By: huntie

Differential Revision: D114647943

fbshipit-source-id: b44f38bd22970abba6e7d75c00fdbb27159c17a6
2026-08-16 06:36:58 -07:00
Sam Zhou 88043334e3 Remove unused babel-plugin-syntax-hermes-parser (#57958)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57958

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D115933669

fbshipit-source-id: beb16a462472effcdcc2f9aea3d1baae5fd075b8
2026-08-13 17:58:27 -07:00
Sam Zhou 704c2b1954 Bump flow-{estree,parser,eslint,transform,api-translator} to latest (#57932)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57932

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D115802149

fbshipit-source-id: aa4c730e47ab9b362f7a6e1a16c8127117b09c08
2026-08-13 12:21:06 -07:00
Rob Hogan fc365f6e72 Flow: Prefer imported types from @babel/types over global BabelNode* types (#57752)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57752

## Rationale
Flow lib defs that declare global types (available anywhere, without an `import`) must be referenced in `.flowconfig` and can't be maintained incrementally.  That's not too bad for very stable APIs and it's necessary for environment/runtime globals, but for 3P libraries it makes the lib defs much more difficult to maintain for little benefit (we have to import the runtime APIs anyway). Secondarily, it's a problem for generating TypeScript types, as TS doesn't declare any 3P library globally.

Babel is one of few cases where a library declares Flow globals - every one has an importable equivalent.

## This diff
Replaces usages of Babel global types across xplat/js with their `babel/types` equivalents

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D113574665

fbshipit-source-id: be668d968345a60e76a3515d19d8eaa002d53274
2026-07-31 09:13:21 -07:00
Sam Zhou 7b5d1bc971 Switch over to flow-parser/babel-plugin for compilation (#57770)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57770

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D114240152

fbshipit-source-id: 7d292d33f75cf548b89e6427684fc3a5994c4b3f
2026-07-30 17:10:20 -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
Sam Zhou 30d9593c7b Update hermes-parser and related packages in fbsource to 0.37.0 (#57567)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57567

Bump hermes-parser and related packages to [0.37.0](https://github.com/facebook/hermes/blob/static_h/tools/hermes-parser/js/CHANGELOG.md).

Changelog: [internal]

Reviewed By: panagosg7

Differential Revision: D112000723

fbshipit-source-id: e2851d8c48d19c4f64e8f9ea278fcb31654cdcd1
2026-07-15 08:57:22 -07:00
Alex Hunt bfa679f0ea Expose 'react-native/setup-env' to replace InitializeCore (#57475)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57475

NOTE: Resubmission of D110890810.

Replace `'react-native/Libraries/Core/InitializeCore'` with an explicit `'react-native/setup-env'` secondary export.

This was previously a special-case path excluded from our ESLint warnings. It is now formalised.

**Changes**

- Add new `src/setup-env.js` entry point and `package.json` mapping.
- Replace references in `packages/metro-config/` and `packages/community-cli-plugin/`.
- Update `warn-on-deep-imports` ESLint rule.

Changelog:
[General][Added] - Add `'react-native/setup-env'` entry point. This replaces the previous side-effectful `'react-native/Libraries/Core/InitializeCore'`.
[General][Deprecated] - Deprecate `'react-native/Libraries/Core/InitializeCore'`. Use `'react-native/setup-env'` instead.

Reviewed By: rubennorte

Differential Revision: D111022546

fbshipit-source-id: c9081997468b55b02c8a89544c7cb2026d625ad3
2026-07-08 09:33:30 -07:00
Emerson Berlik 904f0aeb66 Revert D110890810: Expose 'react-native/setup-env' to replace InitializeCore
Differential Revision:
D110890810

Original commit changeset: 3afe25efa455

Original Phabricator Diff: D110890810

fbshipit-source-id: 551c04d1e6c66e1d29938be3c2a7a57db475d589
2026-07-07 12:55:32 -07:00
Alex Hunt 554baba159 Expose 'react-native/setup-env' to replace InitializeCore (#57461)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57461

Replace `'react-native/Libraries/Core/InitializeCore'` with an explicit `'react-native/setup-env'` secondary export.

This was previously a special-case path excluded from our ESLint warnings. It is now formalised.

**Changes**

- Add new `src/setup-env.js` entry point and `package.json` mapping.
- Replace references in `packages/metro-config/` and `packages/community-cli-plugin/`.
- Update `warn-on-deep-imports` ESLint rule.

Changelog:
[General][Added] - Add `'react-native/setup-env'` entry point. This replaces the previous side-effectful `'react-native/Libraries/Core/InitializeCore'`.
[General][Deprecated] - Deprecate `'react-native/Libraries/Core/InitializeCore'`. Use `'react-native/setup-env'` instead.

Reviewed By: rubennorte

Differential Revision: D110890810

fbshipit-source-id: 3afe25efa45548d593a1b09c436e36038350b4c5
2026-07-07 10:43:04 -07:00
Davyd NRB a2cd37f828 Change default transform profile to 'hermes-stable' (#57208)
Summary:
Issue: https://github.com/react/react-native/issues/57174

## Changelog:

[GENERAL] [CHANGED] - Change default transform profile to 'hermes-stable'

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

Test Plan:
```
js1 jest react-native-babel-preset
Determining test suites to run...
 PASS   rn-oss  xplat/js/react-native-github/packages/react-native-babel-preset/src/__tests__/plugin-warn-on-deep-imports-test.js
 PASS   rn-oss  xplat/js/react-native-github/packages/react-native-babel-preset/src/__tests__/transform-snapshot-test.js

Test Suites: 2 passed, 2 total
Tests:       55 passed, 55 total
Snapshots:   6 passed, 6 total
Time:        7.13 s
Ran all test suites matching /react-native-babel-preset/i.
```

Reviewed By: javache

Differential Revision: D110766109

Pulled By: robhogan

fbshipit-source-id: 2964283239c44128e310400e1cd2b0321f0403be
2026-07-06 09:27:48 -07:00
leo1987820 59f26aa8fb Use HTTPS repository URL for react-native-babel-preset (#57334)
Summary:
Update `react-native/babel-preset` package metadata to use a `git+https` repository URL instead of the SSH-style URL. This avoids requiring SSH credentials for tooling that reads npm repository metadata.

## Changelog:

[INTERNAL]

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

Test Plan: Parsed `packages/react-native-babel-preset/package.json` as JSON after the metadata update.

Reviewed By: christophpurrer

Differential Revision: D109713034

Pulled By: fabriziocucci

fbshipit-source-id: cf7119a032b96024babfa9238adc4d8e45347da7
2026-06-25 11:31:36 -07:00
Alex Hunt ffe3f79495 Standardize secondary package READMEs (#57273)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57273

**Motivation**

A README is the first thing an npm visitor sees on each package; internal-repo boilerplate like the "Testing" sections and the "We're using yarn…" note doesn't belong on a published package page.

**Changes**

- Standardize every README: a `# react-native/<name>` heading, a user-facing description, and a blue version badge plus a green monthly-downloads badge.
- Keep the "internal dependency" prelude only on `community-cli-plugin`, `virtualized-lists`, and `js-polyfills`.
- Drop the monorepo-template "Testing" sections and yarn note.
- Rework `metro-config` around the Configuring Metro guide; add missing READMEs for `metro-babel-transformer` and `popup-menu-android`.

Changelog: [Internal]

Reviewed By: emily8rown

Differential Revision: D109017270

fbshipit-source-id: 6208294c4ad2e6235a6605ae54f22d730f0476e7
2026-06-18 07:04:44 -07:00
Rob Hogan dcbd8608a6 Update package.json references to GitHub org "facebook" -> "react" (#57258)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57258

Reflecting the move to https://github.com/react/react-native , update references in first-party `package.json`s

The `repository.url` field in particular is load-bearing for Trusted Publish.

Changelog: [Internal]

___

Reviewed By: fabriziocucci

Differential Revision: D108986410

fbshipit-source-id: 78513ffefc32ddf417dc1479a4834ebc44240080
2026-06-18 02:00:52 -07:00
Alex Hunt a0d39e7a9c Bump minimum Node.js version to 22 (#56887)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56887

Drop support for Node.js 20. The minimum supported version is now `^22.13.0 || ^24.3.0 || >= 26.0.0`.

Node.js 20 reached end-of-life in April 2026 and is no longer actively maintained. This aligns React Native with the upcoming Metro requirement.

Changelog:
[General][Breaking] - Require Node.js >= 22.13.0

Reviewed By: christophpurrer, cortinico

Differential Revision: D105685641

fbshipit-source-id: f490e5a13e4289daba98c4d56dd8fdd341aef0db
2026-05-19 11:53:54 -07:00
Rob Hogan 44a9566bf6 Babel preset: Add unstable_preserveDestructuring to experiment with disabling destructuring transform for SH (#56829)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56829

Disable `babel/plugin-transform-destructuring` when `customTransformOptions.unstable_preserveDestructuring` is truthy. This allows us to experiment with native destructuring support in Static Hermes.

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D93013925

fbshipit-source-id: bfc2b1cb8e04c28d2ae71b596bf759e3dc0e5701
2026-05-18 11:14:40 -07:00
Ivor Zhou ef38dbb28d Update hermes-parser and related packages in fbsource to 0.36.1 (#56806)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56806

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

Bump hermes-parser and related packages to 0.36.1.

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D104122338

fbshipit-source-id: 7e938ec114355cf517ff2e76ffbb941f6352d213
2026-05-14 22:13:53 -07:00
Rob Hogan e4cb767653 Babel preset: Add unstable_preserveBlockScoping to experiment with disabling block-scoping transform for SH (#56825)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56825

Disable `babel/plugin-transform-block-scoping` when `customTransformOptions.unstable_preserveBlockScoping` is truthy. This allows us to experiment with native let/const block scoping support in Static Hermes.

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D93013927

fbshipit-source-id: 6e2c1274426943fcf1ce5a8c09d677e1d0afb35f
2026-05-14 06:21:07 -07:00
Riccardo Cipolleschi 26040d8d54 Remove isHermesV1 from Babel preset (#56754)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56754

Hermes V1 (Static Hermes) is now always enabled. Remove the isHermesV1 variable and inline its effects:
- enableRegenerator is always based on dev mode (was isHermesV1 && dev)
- preserveClasses is always true (was isHermesV1)

Also update the comments to drop the 'V1' framing.

## Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D104649639

fbshipit-source-id: 70d4cbc0ad365df551b744e3cc16e880ce41c90c
2026-05-11 12:55:12 -07:00
Rob Hogan 783f45746e Bump packages to 0.87.0-main following 0.86 cut (#56716)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56716

Now that we've cut 0.86, bump all versions on `main` ready for the 0.87 cut.

Changelog: [Internal]

Reviewed By: cortinico, fabriziocucci

Differential Revision: D104219534

fbshipit-source-id: 86f2ebe5b44f67608a7a9495bf9840f2cdd52e5b
2026-05-07 07:23:06 -07:00
Marco Wang 0b3df3f382 Update hermes-parser and related packages in fbsource to 0.36.0 (#56662)
Summary:
X-link: https://github.com/facebook/hermes/pull/2003

X-link: https://github.com/facebook/relay/pull/5265

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

X-link: https://github.com/facebook/flow/pull/9405

Bump hermes-parser and related packages to [0.36.0](https://github.com/facebook/hermes/blob/static_h/tools/hermes-parser/js/CHANGELOG.md).

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D103172778

fbshipit-source-id: 81bb5f18da6f46d07955956fb0b721f74cceca47
2026-04-30 15:26:55 -07:00
Marco Wang 50768cbb15 Update hermes-parser and related packages in fbsource to 0.35.0 (#56408)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56408

X-link: https://github.com/facebook/relay/pull/5238

X-link: https://github.com/facebook/hermes/pull/1978

X-link: https://github.com/facebook/flow/pull/9396

Bump hermes-parser and related packages to [0.35.0](https://github.com/facebook/hermes/blob/static_h/tools/hermes-parser/js/CHANGELOG.md).

Changelog: [internal]

Reviewed By: bherila

Differential Revision: D100198457

fbshipit-source-id: 06dcada56d61ae359c1d7a8362f80fdfb4e2d5b5
2026-04-09 22:17:51 -07:00
Sam Zhou 82bffce573 Cleanup legacy flow types in react-native (#56300)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56300

Changelog: [Internal]

Reviewed By: marcoww6

Differential Revision: D99004126

fbshipit-source-id: dfedc13c867cb768777e2ba65256a2c40ffb1d08
2026-03-31 19:25:25 -07:00
Rob Hogan a92bea818a Babel preset: Add unstable_preserveAsync to experiment with disabling async transforms for SH (#56254)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56254

Disable `babel/plugin-transform-async-to-generator` and `babel/plugin-transform-async-generator-functions` when `customTransformOptions.unstable_preserveAsync` is truthy. This allows us to experiment with native async/await support in Static Hermes.

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D93013928

fbshipit-source-id: 3a4bc5bad1a9ff5e7292961111524fef56cbcde7
2026-03-27 11:30:45 -07:00
Rob Hogan fa6576623e Babel preset: Add unstable_preserveClassPrivate to experiment with disabling private class transforms for SH (#55880)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55880

Disable `babel/plugin-transform-private-methods` and `babel/plugin-transform-private-property-in-object` when `customTransformOptions.unstable_preserveClassPrivate` is truthy. This allows us to experiment with native private class field and method support in Static Hermes.

Changelog: [Internal]

Reviewed By: vzaidman, javache

Differential Revision: D93010263

fbshipit-source-id: 25c48c8561b7c9b4f8d9984e47c5ca8b14007360
2026-03-17 17:28:14 -07:00
George Zahariev cd0dbf5bc5 Update hermes-parser and related packages in xplat to 0.34.0 (#56107)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56107

Bump hermes-parser and related packages to [0.34.0](https://github.com/facebook/hermes/blob/static_h/tools/hermes-parser/js/CHANGELOG.md).

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D96556729

fbshipit-source-id: fd6568de0efa43851c45584bba5a2c4ef49bfabe
2026-03-16 12:41:13 -07:00
Alan Lee bbaabe6a16 Bump packages for next release (#55946)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55946

Follows the recent `0.85-stable` branch cut.

Changelog: [Internal] - Bump all packages to `0.86.0-main`

Reviewed By: cortinico

Differential Revision: D95410323

fbshipit-source-id: dacfee00f1111dbf57ef2e608963a4bffa669884
2026-03-10 00:35:59 -07:00
Marco Wang f596bb3d1a transformTypeParamBound codemod 8/9 (#55949)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55949

js1 flow-runner codemod flow/transformTypeParamBound --format-files=false xplat/js

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D95429359

fbshipit-source-id: fc5bfa68cd5267ec5e74358592eace97c9a6f662
2026-03-06 11:24:12 -08:00
On Saint Tiong 63796a9160 Prevent Crashes by Guarding babel.env Access in RN Babel Preset (#55918)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55918

To prevent crashes when a Babel plugin or preset is invoked without a Babel API object, ensure that any access to Babel-specific properties (such as babel.env) is guarded. Some build tools or environments may call Babel plugins without providing the full Babel API instance, leading to runtime errors if the code assumes its presence. By using optional chaining and providing safe fallbacks, you can maintain compatibility across different build systems (such as Metro and others) without introducing breaking changes.

Changelog:
[General][Fixed] Prevent errorrs by handling contexts where the Babel API object is not provided

Reviewed By: robhogan, rubennorte

Differential Revision: D94952379

fbshipit-source-id: 65e69c0510bc66930ee3b5f28e20df32d732f990
2026-03-04 11:07:31 -08:00
Rob Hogan c5a38ab285 Babel preset: don't override dev based on omission of obsolete withDevTools, infer from env() instead. (#55805)
Summary:
Pull request resolved: https://github.com/facebook/react-native/pull/55805

Currently the RN Babel preset has this surprising bit of behaviour:

```js
module.exports = (options, babel) => {
  if (options.withDevTools == null) {
    const env = process.env.BABEL_ENV || process.env.NODE_ENV;
    if (!env || env === 'development') {
      return getPreset(null, {...options, dev: true}, babel);
    }
  }
  return getPreset(null, options, babel);
};
```

If the (undocumented, otherwise unused) `withDevTools` option is set (to anything), we will override any given value of `dev` to `true` if `BABEL_ENV` || `NODE_ENV || 'development' === 'development'`.

To put that another way, with `NODE_ENV=development` and `BABEL_ENV` unset, we would always produce a dev bundle even if `{ dev: false }`

Expo sets `withDevTools: false` to stop this happening, and always set `dev` (so this diff means **no observable change under Expo**):

https://github.com/expo/expo/blob/4a46dbff7a5a77d9fe06d30a70d7fab38cfc7f9a/packages/babel-preset-expo/build/index.js#L235-L236

This odd-looking override was introduced in 2017 in https://github.com/facebook/react-native/commit/bc22a4da7ea74d17cd701717268c8e50f001d614 / D5237158 as a way to gate `babel/plugin-transform-react-jsx-source`, *before the preset accepted any other options* - it was never intended to override `dev`. Now, we gate that same plugin under `options.dev`.

## Inferring `dev` when unspecified

The one potentially load-bearing piece of this is that, when a consumer specifies neither `withDevTools` nor `dev` (or maybe no options at all), this code serves to infer it from `process.env.BABEL_ENV || process.env.NODE_ENV`, which is reasonable and actually closer to the way typical plugins/presets work, but a better mechanism compatible with Babel's cache is to use the `env()` API (which defaults to `process.env.BABEL_ENV || process.env.NODE_ENV`, so preserves behaviour).

https://babeljs.io/docs/config-files#apienv

## This change
 - Removes the obsolete use of `withDevToolss`, and never overrides the explicitly-passed `dev`
 - Where `dev` is not specified, falls back to the Babel environment.

Changelog:
[General][Fixed] Babel-preset: Don't override explicitly-passed `dev` config if obsolete `withDevTools` is missing

Reviewed By: huntie

Differential Revision: D94660480

fbshipit-source-id: 5dfae8fb704e6881b03120cd14510795382a98ba
2026-02-28 05:00:43 -08:00
Phil Pluckthun c4ae05534a Split out Jest preset to @react-native/jest-preset (#55169)
Summary:
This implements the proposal to split the Jest preset (and dependencies) out into a separate package: https://github.com/react-native-community/discussions-and-proposals/pull/926

- `react-native` has an optional peer dependency on `react-native/jest-preset`
- `react-native/jest-preset.js` throws when `react-native/jest-preset` isn't installed and instructs the user to add it to migrate
- `react-native/jest-preset` may be used directly as a Jest preset

## Changelog:

[General][Breaking] - Move Jest preset to new `react-native/jest-preset` package

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

Test Plan:
The jest preset is used, with some modifications, in `facebook/react-native` itself and CI should confirm that the changes work. Running `jest` on the repo similarly validates that the preset still works.

Otherwise, nothing has changed and the easiest way to test this is to use the preset in an existing project and try both `preset` set to the current value and `preset` set to `"react-native/jest-preset"`

Reviewed By: cipolleschi

Differential Revision: D91700684

Pulled By: huntie

fbshipit-source-id: ee4a7d3ceb4934a3d0f7558d93dc601ea4b8dfa8
2026-02-18 09:32:10 -08:00