1227 Commits
Author SHA1 Message Date
Lazizbek Ergashev ebc180e0ae Stop naming C++ TurboModule invokers with reserved identifiers
## Summary:

The C++ spec header generated for a C++ TurboModule names each method's static invoker `__<method>` and registers it under that name in `methodMap_`. Names starting with a double underscore are reserved in C++, so a library that builds with `-Wreserved-identifier` under `-Werror` can't include its own generated `<Module>JSI.h`. The invokers are now named `invoke_<method>`. They are private to the spec class, and the `methodMap_` keys, arity and calls into the module stay the same.

Fixes #59843

## Changelog:

[GENERAL] [FIXED] - C++ TurboModule codegen no longer names method invokers with reserved identifiers

## Test Plan:

Updated the `GenerateModuleH` snapshots; `jest packages/react-native-codegen` passes. clang++ with `-Werror -Wreserved-identifier` rejects `__add` and accepts `invoke_add`.

Differential Revision: D132179193

Pull Request resolved: https://github.com/react/react-native/pull/59844
2026-11-18 02:03:22 +00:00
Alex Hunt fbb5319fea Add LICENSE file to all published packages (#60010) 2026-11-17 17:39:58 +00:00
George Zahariev 0d8a1b1047 Upgrade formatting to Prettier 3.10.0 (#60005)
Summary:

X-link: https://github.com/react/metro/pull/2226

Upgrade non-WWW formatter dependencies, canonical installed payloads and retained locks to Prettier 3.10.0, together with the exported-source compatibility and formatting changes required by those owners. Preserve runtime behavior, Flow types, and parser/style policy.

Changelog: [Internal]

Reviewed By: panagosg7, jcperez-ch

Differential Revision: D131782725

Pull Request resolved: https://github.com/react/react-native/pull/60005
2026-11-16 12:41:52 +00:00
George Zahariev 3f54cc20ed Upgrade the Flow parser tooling to 0.340.0
Summary:
X-link: https://github.com/react/metro/pull/2224

@public
Upgrade `flow-parser`, `flow-estree`, `flow-eslint`, `flow-transform` and `flow-api-translator` to 0.340.0, and adapt the code generators, codemods, lint rules and parser adapters that read the ESTree output those releases produce.

Four shapes moved since the versions in use, and each one silently changed behavior rather than failing loudly:

- Generic type annotations carry their arguments in `typeArguments` instead of `typeParameters`, so consumers that still read the old field dropped every type argument. Readers now take the canonical field whenever the node carries it, including when it is `null`, and fall back to the previous field otherwise, so the same source keeps working with the older releases that remain installed elsewhere.
- Enum declarations expose a single `EnumBody` carrying an explicit type instead of one node type per value kind. Enum readers accept both and resolve the value kind the same way, so the supported enums and the existing rejection of boolean and symbol enums are unchanged.
- `JSXAttribute.name` widened to also allow a namespaced name, so transforms that compare an attribute name against a list now match only plain identifiers and leave namespaced attributes alone, which is what they already did at runtime.
- Object type properties, array elements, import phases and several other fields are now nullable or newly required. Readers guard them and report the existing unsupported-input errors instead of failing on a missing property, and import declarations are built from constant parser-owned templates so one source satisfies both the old and the new builder.

The lint rules, the declaration generators and the `jscodeshift`/recast boundary are adapted the same way, and the published type mirrors for the lint and transform packages are refreshed.

Changelog: [Internal]

Reviewed By: SamChou19815, panagosg7

Differential Revision: D131489493

Pull Request resolved: https://github.com/react/react-native/pull/59983
2026-11-13 11:55:16 +00:00
Sam Zhou de05579ee0 Label dictionary keys in react-native (#59818)
Summary:

Labels unlabeled dictionary keys: `{[string]: T}` becomes `{[key: string]: T}`. In TypeScript, `{[string]: T}` is a computed property, not an index signature, so this prepares the code for `experimental.require_dictionary_key_label`, which requires the label. The label is documentation only and does not change any type.

Generated by the `flow/nameIndexerKeys` codemod, run only on the keys that the flag reports, so computed keys like `{['a']: T}` are left alone. Keys inside comment types, and files whose formatting the codemod's printer would change, were labeled with a plain text insertion instead.

Changelog: [Internal]

Differential Revision: D130071787

Pull Request resolved: https://github.com/react/react-native/pull/59818
2026-11-06 15:50:46 +00:00
Sam Zhou 25d63d471a Make the conversions of parseInt and isNaN explicit
Summary:
TypeScript declares `parseInt(string: string, radix?: number)` and `isNaN(number: number)`, and Flow is adopting the same signatures. Calls that pass another type rely on the function's implicit conversion and start to error.

Wrap each such argument in `String(...)` (`parseInt`) or `Number(...)` (`isNaN`), the conversion the function already applies, so behavior doesn't change. The calls were found from Flow's errors and rewritten by a codemod. 8 arguments in 6 files in React Native and Metro.

Changelog: [Internal]

Differential Revision: D129644365

Pull Request resolved: https://github.com/react/react-native/pull/59799
2026-11-04 23:43:39 +00:00
Sam Zhou 38f6e192c8 Name unnamed parameters in function type annotations (#59790)
Summary:

Gives every unnamed parameter in a Flow function type annotation a name: `v` for a lone parameter, `v<index>` otherwise, and `rest` for a rest parameter. Type-only change with no runtime behavior change.

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D129441819

Pull Request resolved: https://github.com/react/react-native/pull/59790
2026-11-04 19:50:16 +00:00
Pieter De Baets 3d3a339012 Default invalid pointerEvents values to auto
Summary:
Invalid Android pointerEvents values fall back to `AUTO` and log a warning instead of throwing. Null still resets the default silently, and valid case/hyphen variants retain their existing behaviour.

Changelog:
[Android][Fixed] - Default invalid pointerEvents values to auto with a warning

Differential Revision: D129603915

Pull Request resolved: https://github.com/react/react-native/pull/59794
2026-11-04 15:36:26 +00:00
Gregory Moskaliuk f78bdd4aea Follow-up to #59414: cache each Java TurboModule method's ID with its signature, by name
## Summary:

This is a follow-up to #59414, suggested by @javache in [its review](https://github.com/facebook/react-native/pull/59414#discussion_r4399176566): keep a method's `jmethodID` in the same per-module cache as its parsed JNI signature, and index that cache by method name, instead of having two caches.

Before this change, a Java TurboModule method's ID was cached by its caller: every generated host function kept a `static jmethodID cachedMethodId` and passed it to `invokeJavaMethod` by reference, and `JavaInteropTurboModule` kept a `methodIDs_` vector for the same purpose. `JavaTurboModule` then used that ID as the key of its `MethodInfo` cache (#59414).

With this change:

- `JavaTurboModule::MethodInfo` also holds the method's `jmethodID`, and `methodInfos_` is keyed by the method name (a `std::string`, looked up through a `std::string_view` without allocating). On a method's first call, `getMethodInfo` looks the method up with `GetMethodID` and parses its signature. A signature that doesn't match still turns into a JS error (redbox) before anything is called, and nothing is cached for it.
- `invokeJavaMethod` gets an overload that takes the method name and JNI signature as C strings and no `cachedMethodID`. Generated code passes string literals, so a call no longer builds two `std::string`s; the JNI signature is usually longer than the small-string buffer, so that was a heap allocation on every call.
- The previous overload (`const std::string&` name and signature, `jmethodID&`) is kept, for code generated by earlier codegen versions and for modules that call it directly, and marked `[[deprecated]]`. It forwards to the new one; `cachedMethodID` is no longer read or written. Libraries that ship pre-generated JNI code build it with `-Wall -Werror` (the codegen CMake template applies `target_compile_reactnative_options`), so their builds will fail on the deprecation warning until they regenerate that code.
- The codegen template for Java module JNI files (`GenerateModuleJniCpp`) no longer emits `static jmethodID cachedMethodId`, and `JavaInteropTurboModule` drops `methodIDs_`.

Besides one cache instead of two, every generated host function gets smaller: RNTester's `libreactnative.so` (which includes `FBReactNativeSpec`) is 61 KB smaller and its `libappmodules.so` 9.4 KB smaller.

## Changelog:

[ANDROID] [CHANGED] - Java TurboModules cache each method's ID with its parsed signature, by name, instead of in every generated host function

[ANDROID] [DEPRECATED] - `JavaTurboModule::invokeJavaMethod` with a `cachedMethodID` argument; use the overload without it

## Test Plan:

- `yarn jest packages/react-native-codegen` passes (64 suites, 3,130 tests); the `GenerateModuleJniCpp` snapshots are updated for the template change.
- `node scripts/clang-format.js --check` reports no changes for the touched C++ files.
- C++ API snapshots: the new `invokeJavaMethod` overload is added to the four `ReactAndroid*Cxx.api` snapshots by hand, where the generator sorts it; `scripts/cxx-api` can't run on current `main` locally (its codegen step fails with `SyntaxError: Unexpected token '{'` while processing `FBReactNativeSpec`, without this change too).
- `./gradlew :packages:rn-tester:android:app:assembleRelease -PreactNativeArchitectures=arm64-v8a` succeeds with this change; RNTester's generated `FBReactNativeSpec` and app module code use the new overload.
- **On a device.** Two RNTester release APKs built from the same local checkout (`main` at f7de20301c with local benchmark screens), without and with this change, installed alternately on a moto g57 power (Android 16), three installs each with two launches. A Playground screen times synchronous calls to `NativeSampleTurboModule` (20,000 calls each, 5,000 for void, callback and promise calls), median of the six launches:

| Call (JNI signature) | before | this PR | change |
|---|--:|--:|--:|
| `getBool` (`(Z)Z`) | 1.10 µs | 1.15 µs | +4% |
| `getNumber` (`(D)D`) | 1.46 µs | 1.53 µs | +5%, ranges overlap |
| `getString` (`(Ljava/lang/String;)Ljava/lang/String;`) | 2.05 µs | 1.92 µs | −6% |
| `getArray`, 3 items | 10.34 µs | 10.06 µs | −3% |
| `getObject`, 3 keys | 9.90 µs | 9.58 µs | −3% |
| `getObject`, 20 keys | 35.67 µs | 35.28 µs | −1% |
| `getValue(number, string, object)` | 13.94 µs | 14.21 µs | +2%, within noise |
| `voidFunc` | 4.55 µs | 4.59 µs | within noise |
| `getValueWithCallback` | 8.54 µs | 7.99 µs | −6.5% |
| `getValueWithPromise` | 18.26 µs | 17.38 µs | −5% |

  Calls whose JNI signature is longer than the small-string buffer no longer allocate it, and are 5–6% cheaper. The cheapest calls, whose short signatures never allocated, now hash the method name instead of a pointer, about 50 ns more. Native library sizes are from the same two APKs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Differential Revision: D128349302

Pull Request resolved: https://github.com/react/react-native/pull/59619
2026-10-30 12:34:06 +00:00
Rob Hogan a96b0e424c Don't rely on inline requires to apply mocks in JS tests (#59307)
Summary:
Test only change. RN's own Jest transform (`jest/preprocessor.js`, for this repo's own tests, not public) doesn't include `babel-plugin-jest-hoist`, so `jest.mock` calls run where they're written. Several tests only saw their mocks because inline requires deferred the `require` of the module under test (or of its dependencies) until first use.

That only works for destructured requires like `const {foo} = require('./foo')` while the Babel preset lowers destructuring, which in this config it currently does only as a side effect of lowering generators with regenerator. https://github.com/react/react-native/pull/59303 removes that, and 114 tests across these 16 suites fail.

This makes the tests install their mocks before the modules under test load, so they pass either way, without diverging Jest's transform from the app's:

- Require modules under test after the `jest.mock` calls that affect them.
- Use mock factories instead of spies or automocks where the code under test binds a function when it loads, or loads an ESM-only package (`octokit/rest`).
- Re-require modules after `jest.resetModules()` where tests reset the registry (`publish-npm`, `Animated`).

The release script tests in particular are dangerous when their mocks silently stop applying - locally, they ran the real version bump against the checkout.

## Changelog:

[INTERNAL] [CHANGED] - Don't rely on inline requires to apply mocks in JS tests

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

Test Plan: The full Jest suite passes on this PR (6,284 tests), and with https://github.com/react/react-native/pull/59303 applied on top (6,285), both under Node 24 with `--no-cache`. Without this PR, https://github.com/react/react-native/issues/59303 fails 114 tests in 16 suites, matching its CI.

Reviewed By: christophpurrer

Differential Revision: D126757286

Pulled By: javache

fbshipit-source-id: ce39217579aa9805f74786ee9b669bf411e97191
2026-10-22 02:26:19 -07:00
George Zahariev 800f35073f Tooling 0.336.0 (#59164)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/59164

X-link: https://github.com/react/metro/pull/2075

Upgrade `flow-parser`, `flow-estree`, `flow-eslint`, `flow-transform`, and `flow-api-translator` across the xplat and AR/VR JavaScript tooling consumers. Refresh dependency locks, installed runtime payloads, and shared offline archives while preserving the independently pinned Fox toolchains and locally maintained type shims.

Build on D125751591's `flow-remove-types` upgrade. Keep Gauntlet in its own child because it has an independent release boundary.

Support reviewed, exact-root Yarn installation options in the upgrade policy. Recharts' forced macOS `fsevents` resolution needs platform checking disabled and optional packages omitted on Linux; no other installation roots or dependency-verification checks are exempted.

The installation-policy correction is an intentional prerequisite for executing the supplied playbook on Linux, not a separate feature rollout. The unchanged 0.335 Recharts dependency installation reproduced the forced macOS fsevents failure, including with --ignore-optional alone; the exact-root --ignore-platform/--ignore-optional combination passes without changing the manifest or lock. Keeping this tested, allowlisted exception in source makes the upgrade reproducible while preserving dependency/version checks and the other installation roots.

Changelog: [internal] Upgrade xplat and AR/VR Flow JavaScript tooling to 0.336.0.

Reviewed By: SamChou19815

Differential Revision: D125765307

fbshipit-source-id: 39a67c3f295bce809af89d1ee53bc51876214870
2026-10-19 23:15:26 -07:00
Sam Zhou 80ca42ea96 Replace Object/Function annotations with any (#59094)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/59094

With `experimental.function_and_object_type_is_no_longer_any`, Flow resolves `Object` and `Function` to the builtin class types instead of `any`.

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D125312021

fbshipit-source-id: 1646441aa3c2728313cf56b347d04e62d69712e4
2026-10-14 17:09:46 -07:00
Sam Zhou 6671827cda Add LegacyObject to keep Flow Object as Object in the TypeScript API (#59086)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/59086

Flow will soon give `Object` the same meaning as TypeScript's `Object`, rather than treating it as `any`. React Native sources that use `Object` as an untyped escape hatch need to move off it. But the generated TypeScript API (`ReactNativeApi.d.ts`) relies on Flow `Object` mapping to TS `Object`, and it should keep emitting `Object`.

This adds a `LegacyObject` global type to bridge the two:
- Flow: `flow/LegacyObject.js` declares `LegacyObject` as `any`, next to `Stringish`.
- TypeScript: build-types replaces `LegacyObject` with `Object` before translation, via a new `replaceLegacyObjectWithObject` pre-transform that mirrors `replaceStringishWithString`.
- Codegen: native module specs accept `LegacyObject` as a generic object, like `Object` and `UnsafeObject`.

`CodegenTypes.UnsafeObject`, the event object types in `EventEmitter` and `NativeEventEmitter`, `PushNotificationIOS`, and the native module specs that used bare `Object` now use `LegacyObject`. Neither the generated TypeScript API nor the codegen schema changes. The codegen parser's internal AST aliases (`PropAST`, `ASTNode`) switch to plain `any`.

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D125245815

fbshipit-source-id: 98d9ded6523186a7efbcb8e6d1b25b0c6369307b
2026-10-14 14:46:44 -07:00
George Zahariev 15896bb519 Upgrade JS parser tooling to 0.335.0 (#59051)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/59051

X-link: https://github.com/react/metro/pull/2063

Upgrade `flow-parser`, `flow-estree`, `flow-eslint`, `flow-transform`, and `flow-api-translator` to 0.335.0 across `xplat/js` and `arvr/js`.

(Excluding the Fox toolchains in `tools/fox`, `tools/fox-haas-bundler`, and `tools/react-fox`).

Refresh 39 dependency manifests, 18 Yarn lockfiles, the recharts npm lockfile, checked-in runtime packages, Flow type mirrors, and the five shared offline archives.

Gauntlet's upgrade is kept in the stacked diff D125076658 because its framework has an independent release system.

Use canonical Yarn's hoisted root parser instead of redundant nested rpc/jscodeshift copies. Repair the legacy codegen lock's missing `nullthrows@^1.1.1` entry for its existing dependency declaration, without changing that declaration. Bootstrap GazeHands' declared build dependencies before CI validates its generated outputs, matching the existing build script.

Teach license lint to recognize the existing MIT headers in imported Flow type mirrors rather than rewriting them as internal headers; add narrow path assertions.

Changelog: [Internal]

Reviewed By: SamChou19815, panagosg7

Differential Revision: D125071452

fbshipit-source-id: 85cccf5242913fc559030d7e43f9a7266a54425a
2026-10-14 11:44:13 -07:00
Jakub Piasecki 095e563fb3 Emit umbrella header includes from codegen (#58730)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/58730

Codegen output is compiled in consumer targets, so it now includes React Native through module umbrella headers (`<React/RendererCore.h>`, `<React/Graphics.h>`, `<React/NativeModuleCore.h>`, etc.) instead of fine-grained paths, which hard-error under `RN_STRICT_API`.

The one exception is `<react/renderer/debug/debugStringConvertibleUtils.h>`, which `Props.cpp` still includes directly alongside `<React/RendererDebug.h>`. It is a private header not re-exported by any umbrella, but it is only emitted together with the `getDebugProps` implementation, which is generated solely for React Native's own core components library (`FBReactNativeSpec`). That library is built as part of React Native (`RN_BUILDING`), so the private-header guard does not apply.

Changelog:
[General][Changed] - Codegen-generated C++ includes React Native through module umbrella headers

Reviewed By: cortinico

Differential Revision: D122317911

fbshipit-source-id: 53b3275acf148c665c27470a929cd0397bdce6d9
2026-10-02 02:15:49 -07:00
Rob Hogan a7f81c841e Bump flow-{api-translator,eslint,parser} to 0.333.0, declare @babel/parser (#58762)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/58762

This bumps the Flow tooling packages from 0.331.0 to 0.333.0, matching `flow-bin`. From 0.332.0, `flow-api-translator` translates `declare module.exports` to TypeScript's `export =` (https://github.com/facebook/flow/pull/9491), which https://github.com/react/metro/pull/1996 uses to generate definitions for CommonJS modules.

It also declares `babel/parser` as a root dev dependency. The API snapshot script has imported it since https://github.com/react/metro/pull/1988, but it only resolved because other packages hoist it. The range matches theirs, so it doesn't change the lockfile.

Changelog: [Internal]

X-link: https://github.com/react/metro/pull/1998

Test Plan: Generated `.d.ts` (gitignored) and all 14 API snapshots are unchanged on the new versions.

Reviewed By: javache

Differential Revision: D122383746

Pulled By: vzaidman

fbshipit-source-id: f9d47c8e8fb60b10302b7ce5f8378db6ba59b786
2026-10-01 08:08:37 -07:00
Rubén Norte f156ef2b02 Consolidate generated view config imports (#58651)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/58651

Generated view configs currently emit repeated property accesses from React Native entry-point requires and route commands through a renderer namespace. Consolidate imports by source and expose `dispatchCommand` directly from the unstable internals entry point, reducing generated Hermes bytecode while preserving existing stable root exports. Metro's inline-require transform would otherwise expand the consolidated unstable-internals binding back into repeated `require(...)` calls, so keep that dependency non-inlined while leaving other generated imports eligible for lazy loading. Make the unstable `HMRClient` export follow React Native's normal development/production selection so production consumers receive `HMRClientProdShim` instead of including HMR tooling.

Changelog:
[General][Fixed] - Reduce generated native component bundle overhead

Reviewed By: javache

Differential Revision: D121383217

fbshipit-source-id: 3b81db620bcff172d43d0493dd4ca22b30f305d6
2026-09-24 09:23:32 -07:00
Rob Hogan c33c241c98 Bump @babel/parser to ^7.29.9, @babel/types to ^7.29.8 (#58641)
Summary:
X-link: https://github.com/react/metro/pull/1962

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

This picks up https://github.com/babel/babel/pull/18241, fixing parsing of arrow function params inside ternaries with Flow (eg `cond ? async (...args) => {} : null`).

(I remember hitting this one internally and not realising where it came from - IIRC it also applies to arrows within conditional types)

The update brings `babel/types` 7.29.7 -> 7.29.8, requiring regeneration of generated flow types. ~~**The `xplat/js/yarn.lock` version will likely need updating to match, or the Babel types sync test will fail**~~ - I've updated specifiers to bring everyone onto that version.

Changelog: [Internal]

X-link: https://github.com/react/metro/pull/1958

Test Plan: CI

Reviewed By: javache

Differential Revision: D121188416

Pulled By: vzaidman

fbshipit-source-id: 60f9c3514b5d6018825423644c47e66b3610b652
2026-09-24 09:18:50 -07:00
Rubén Norte e0a6a9f465 Remove deep imports from generated Codegen modules (#58603)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/58603

Generate view configs and Codegen fixtures using supported React Native entry points or values derived from their exports. Generated view config modules can be emitted into arbitrary consumer package locations, so they cannot use a package-relative path back into React Native. Keep `ConditionallyIgnoredEventHandlers` centralized and expose it from the explicitly unstable compatibility entry point instead of duplicating its platform-specific semantics in generated output.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D120717571

fbshipit-source-id: 9f3ea06d393eb8702bbb3ef2767c2d7c5fde1315
2026-09-21 11:31:38 -07:00
Dawid Małecki 8de8e08db0 Reland Bridging umbrella in generated modules (#58558)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/58558

Generate TurboModule interfaces using the public Bridging C++ entry point so generated consumers remain compatible with the strict API boundary.

Export the bridging module include root from its CMake target so source-built consumers can resolve <React/Bridging.h>.

Changelog:
[Internal]

Reviewed By: cortinico

Differential Revision: D120357994

fbshipit-source-id: 072d67197daf19acffbb66c110833a10a7094cfb
2026-09-21 02:52:40 -07:00
Rubén Norte ffbca04c3e Use public imports in Codegen fixtures (#58572)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/58572

Migrate Codegen and compatibility fixtures from React Native deep imports to the public `react-native` entry point. Reference codegen-only types through the exported `CodegenTypes` namespace.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D120537584

fbshipit-source-id: f97ee85fb5f16d23a998d25c1544134ee08bc3cc
2026-09-18 07:27:28 -07:00
Dawid Małecki 54f9cdfd20 Use View umbrella in generated components (#58539)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/58539

Update Fabric component codegen to consume the public View module through <React/View.h> for generated props, event emitters, shadow nodes, and dimension conversions. Refresh generated snapshots and checked-in popup-menu bindings, and add strict consumer compile coverage that does not use RN_BUILDING.

Make the View umbrella compatible with force-CXX platform configurations discovered by the broader generated-header coverage. On Android, gate the ViewPropsInterpolation rawProps workaround on both ANDROID and RN_SERIALIZABLE_STATE, since rawProps only exists when serializable state is enabled; this preserves existing Android behavior without enabling the runtime/ABI feature globally. For Android, macOS, and Windows platform types, rely on the Buck-selected HostPlatformViewProps and HostPlatformViewEventEmitter headers instead of compiler platform macros: the native implementations already expose NativeDrawable, HostPlatformViewEvents, KeyEvent, MouseEvent, and WindowsViewEvents, while force-CXX builds intentionally do not export those platform-only headers.

Changelog:
[Internal].

Reviewed By: cipolleschi

Differential Revision: D119490247

fbshipit-source-id: 7266baa57f5629e56134b65f2a6b591cb1e0b155
2026-09-18 04:45:07 -07:00
Dawid Małecki 271111c2bb Use ComponentRegistry umbrella in generated descriptors (#58554)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/58554

Generate component descriptor headers through the public <React/ComponentRegistry.h> umbrella instead of directly including ComponentDescriptorProviderRegistry.h. Refresh codegen snapshots and the checked-in popup-menu binding, and export the ComponentRegistry dependency needed by that public generated header.

Changelog:
[Internal].

Reviewed By: cipolleschi

Differential Revision: D120317127

fbshipit-source-id: fedea53bbe65e22ae53ed00a7fde787b2581bfab
2026-09-17 12:06:33 -07:00
Nicola Corti 0d47e122ae Revert D119658518: Use Bridging umbrella in generated modules
Differential Revision:
D119658518

Original commit changeset: 42b2c23c8a1c

Original Phabricator Diff: D119658518

fbshipit-source-id: 2eb569dd6da3e0eebadebac23f669f6e236e8e86
2026-09-16 07:42:57 -07:00
Dawid Małecki faa7aa0166 Use Bridging umbrella in generated modules (#58486)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/58486

Generate TurboModule interfaces using the public Bridging C++ entry point so generated consumers remain compatible with the strict API boundary.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D119658518

fbshipit-source-id: 42b2c23c8a1c4264704a916b0c4e19660110a86d
2026-09-16 04:18:25 -07:00
Rob Hogan 9a49fc2a99 Bump flow-{api-translator,eslint,parser} to 0.331.0 (#58391)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/58391

Regenerate API snapshots after the bump. `flow-api-translator` picks up the fix in https://github.com/facebook/flow/pull/9486, which stops treating `async` functions with no explicit return annotation as `void` — updating `DependencyGraph#end` and `MetroServer#end` to their correct `Promise<void>` return type in `packages/metro/API.md`.

Changelog: [Internal]

Changelog: **[Types]**: `DependencyGraph#end` and `MetroServer#end` are now correctly declared as returning `Promise<void>` rather than `void`

X-link: https://github.com/react/metro/pull/1909

Test Plan:
```
yarn typecheck
yarn lint
yarn build
yarn run verify-api-snapshots
```
All pass.

Reviewed By: mweststrate

Differential Revision: D119090467

Pulled By: javache

fbshipit-source-id: 21b65f90ed511e0cb035917eaf1b0ca399ece855
2026-09-08 07:17:37 -07:00
Christoph Purrer ab2ea649e6 Align TurboModule EventEmitter payload types across platforms (#58063)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/58063

Codegen's `EventEmitter<T>` support for TurboModules diverged between platforms
in two ways:

- The explicit number types `Double`, `Float` and `Int32` worked as emitter
  payloads on Android and C++, but iOS rejected them at codegen time (plain
  `number` worked). iOS now maps all of them to `NSNumber *_Nonnull`, matching
  how plain `number` is already emitted.
- `ArrayBuffer` was rejected on Android and iOS, but the C++ generator silently
  accepted it and produced a `jsi::ArrayBuffer` emitter. `ArrayBuffer` is not
  emittable on any platform — Android emitters always carry a `folly::dynamic`
  payload, which cannot hold raw bytes — and the schema type
  `NativeModuleEventEmitterBaseTypeAnnotation` already excluded it. It is now
  rejected everywhere.

`ArrayBuffer` payloads are rejected in the shared parser, so Flow and TypeScript
specs produce the same error, and the three generators keep an equivalent guard
so schemas that are constructed without going through the parser fail the same
way. `ArrayBuffer` remains supported as a method argument and as a synchronous
return value.

Changelog:
[iOS][Added] - Support `Double`, `Float` and `Int32` payloads for TurboModule `EventEmitter`s
[General][Breaking] - Reject `ArrayBuffer` as a TurboModule `EventEmitter` payload on all platforms

Reviewed By: GijsWeterings

Differential Revision: D116952150

fbshipit-source-id: e148a394c4916b3ebfbd3f559b190a5910b29de1
2026-08-24 09:55:31 -07:00
Mad Dinh 2c4278d83b Fix Double prop defaults losing precision in generated Android delegates (#58070)
Summary:
`GeneratePropsJavaDelegate` emits the default value for an optional `DoubleTypeAnnotation` prop with an `f` (float) suffix, but the setter it calls takes a `double`:

```js
// GeneratePropsJavaDelegate.js
case 'DoubleTypeAnnotation':
  if (prop.optional) {
    return `value == null ? ${typeAnnotation.default}f : ((Double) value).doubleValue()`;
  }
```

```js
// GeneratePropsJavaInterface.js — the setter this is passed to
case 'DoubleTypeAnnotation':
  return 'double value';
```

The `f` literal is parsed as a `float`, then widened back to `double` at the call site, so the default silently arrives rounded to float precision. It compiles without a warning, which is why it has gone unnoticed.

This is visible in the repo's own snapshots today. Same fixture, same prop, two platforms:

| Generator | Output for `blurRadius3?: WithDefault<Double, 2.1>` |
| --- | --- |
| `GeneratePropsH` (C++) | `double blurRadius3{2.1};` |
| `GeneratePropsJavaDelegate` | `value == null ? 2.1f : ((Double) value).doubleValue()` |

So a component using the C++ renderer gets `2.1` and the same component on the Android delegate path gets `2.0999999046325684`.

Compiling the generated shape confirms it:

```java
static void setBlurRadius3(double value) { System.out.println(value); }

setBlurRadius3(value == null ? 2.1f : ...);        // 2.0999999046325684
setBlurRadius3(value == null ? 123456789f : ...);  // 1.23456792E8
```

The integer case is the clearest damage: any `Double` default above 2^24 is not representable as a `float`, so `123456789` arrives as `123456792`. Fractional defaults are wrong from the first value that is not a dyadic rational — `0.1`, `2.1`, and the fixture's own `0.001` all shift.

`FloatTypeAnnotation` on the line below is correct — it targets a `float` setter, so `f` is right there. Only the `Double` branch has the wrong suffix, which is consistent with it having been copied from the `Float` branch.

Changed to a `d` suffix, mirroring the existing `f` for float rather than dropping the suffix entirely, so the literal's type is stated rather than left to numeric promotion.

`DoubleTypeAnnotation` is never boxed by codegen (it is always a primitive `double`, defaulting to `Double.NaN` when non-optional), so there is no nullable-double path to consider.

## Changelog:

[ANDROID] [FIXED] - Fix `Double` prop defaults being rounded to float precision in generated `ViewManager` delegates

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

Test Plan:
The generator is snapshot-tested, so the snapshot is the test. Updating it changes only the `Double` component and leaves the `Float` component untouched:

```diff
  public class DoublePropNativeComponentManagerDelegate<T extends View, U extends ...
       case "blurRadius2":
-        mViewManager.setBlurRadius2(view, value == null ? 0.001f : ((Double) value).doubleValue());
+        mViewManager.setBlurRadius2(view, value == null ? 0.001d : ((Double) value).doubleValue());
       case "blurRadius3":
-        mViewManager.setBlurRadius3(view, value == null ? 2.1f : ((Double) value).doubleValue());
+        mViewManager.setBlurRadius3(view, value == null ? 2.1d : ((Double) value).doubleValue());
       case "blurRadius4":
-        mViewManager.setBlurRadius4(view, value == null ? 0f : ((Double) value).doubleValue());
+        mViewManager.setBlurRadius4(view, value == null ? 0d : ((Double) value).doubleValue());
       case "blurRadius5":
-        mViewManager.setBlurRadius5(view, value == null ? 1f : ((Double) value).doubleValue());
+        mViewManager.setBlurRadius5(view, value == null ? 1d : ((Double) value).doubleValue());
       case "blurRadius6":
-        mViewManager.setBlurRadius6(view, value == null ? 0f : ((Double) value).doubleValue());
+        mViewManager.setBlurRadius6(view, value == null ? 0d : ((Double) value).doubleValue());
```

```
$ yarn jest packages/react-native-codegen
Test Suites: 64 passed, 64 total
Tests:       3122 passed, 3122 total
Snapshots:   1277 passed, 1277 total

$ yarn flow-check
Found 0 errors

$ npx eslint packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js
(no output)
```

`0d`, `1d` and `2.1d` are valid Java double literals; the proof snippet above compiles and runs under `java Proof.java`.

No committed generated sources carry the old output — `grep -rn "f : ((Double) value).doubleValue()" --include='*.java' --include='*.kt'` returns nothing outside the snapshot.

Reviewed By: christophpurrer

Differential Revision: D117082006

Pulled By: fabriziocucci

fbshipit-source-id: 7b61b16d36eea0dcedb9c2b047bf57d23c0132ca
2026-08-24 09:42:24 -07:00
Ahmed Sbai 42be7452d5 fix(codegen): infinite loop on type aliases that shadow CodegenTypes member names (#57986)
Summary:
Fixes https://github.com/react/react-native/issues/57956.

A spec containing a type alias whose name matches the aliased `CodegenTypes` member hangs codegen forever:

```js
import type {CodegenTypes} from 'react-native';

type Double = CodegenTypes.Double;
```

`getResolvedTypeAnnotation` resolves `Double` to the alias's RHS (`CodegenTypes.Double`), but `getTypeAnnotationName` strips the namespace qualifier before the local-alias lookup — so the RHS resolves straight back to the same alias, forever. This hangs the Node process of anything driving the parser, most visibly ESLint via `react-native/eslint-plugin-specs`. Contrary to the issue's initial isolation, **both** the Flow and the TypeScript parsers hang (verified with a subprocess-timeout harness against both).

Two guards in each parser's resolution loop:

1. A qualified name (`CodegenTypes.Double` / `TSQualifiedName`) names a namespace member, never a local alias — stop local resolution there. Downstream translation already handles qualified names, so the alias now resolves to the correct primitive (`DoubleTypeAnnotation`).
2. Track resolved alias names, so genuinely cyclic aliases (`type A = B; type B = A;`) stop resolving and fail through the existing `UnsupportedGenericParserError` (`Unrecognized generic type 'A'`) instead of hanging.

## Changelog:

[GENERAL] [FIXED] - Codegen no longer hangs on type aliases that shadow CodegenTypes member names

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

Test Plan:
- New `NAMESPACED_NATIVE_MODULE_WITH_LOCAL_TYPE_ALIASES` fixture in both the Flow and TypeScript module snapshot suites — before the fix these hang the test runner; after it they produce the correct schema (aliased `Double`/`Float` resolve to `DoubleTypeAnnotation`/`FloatTypeAnnotation`, snapshots included, cross-parser consistency suite passes).
- `jest packages/react-native-codegen/src/parsers`: 13 suites, 1965 tests, 186 snapshots — all passing.
- `jest packages/eslint-plugin-specs`: passing.
- Verified `type A = B; type B = A;` now throws `UnsupportedGenericParserError` instead of hanging.

Reviewed By: javache

Differential Revision: D116386584

Pulled By: christophpurrer

fbshipit-source-id: edbf04c8531d4dc35655318d6245918080ae55b7
2026-08-18 09:43:27 -07:00
Kamil Paradowski 11f9a7f449 RCTArrayBuffer zero-copy class for ObjC TM (#57879)
Summary:
iOS TurboModules mapped a JS `ArrayBuffer` to `NSData` on arguments and `NSMutableData` on returns, so every crossing copied — and `NSMutableData` cannot alias foreign memory, so there was no way to express "these bytes live somewhere else".

This adds `RCTArrayBuffer` (`packages/react-native/React/Base/`) as the ObjC representation of an `ArrayBuffer`. It carries an `isOwningBytes` flag: an owning buffer can be stored and read from any thread, a non-owning one aliases bytes valid only for the synchronous call that produced it.

Codegen now emits `RCTArrayBuffer *` for `ArrayBufferTypeAnnotation` params (was `NSData *`) and returns (was `NSMutableData *`).

## Changelog:

[IOS] [BREAKING] - Add `RCTArrayBuffer`, the ObjC representation of a JS `ArrayBuffer` for TurboModules, with an explicit byte-ownership contract

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

Test Plan:
- `RCTTurboModuleArrayBufferTests` — 9 tests over the sync in-place path, `isOwningBytes` on a sync argument, returning one's own argument, the void/Promise copy paths, nesting, and a zero-length round trip.
 - `RCTTurboModuleTests.mm` adds `testNativeBackedArrayBufferIsAliasedAndKeepsBackingStoreAlive`.
 -  `RCTSampleTurboModule` doubles its argument in place and returns the same buffer, covering the path end to end.
 - Codegen and C++ API snapshots regenerated.

Reviewed By: cipolleschi

Differential Revision: D115629409

Pulled By: christophpurrer

fbshipit-source-id: a7ee6eadf99fd5f9f82fd2a95b0d3ff1369f4ddf
2026-08-17 17:57:28 -07:00
Kamil Paradowski 5bb9639594 JArrayBuffer zero-copy class for Java TM (#57897)
Summary:
Android TurboModules mapped a JS `ArrayBuffer` to `java.nio.ByteBuffer`, copying every argument into a direct buffer — and `ByteBuffer` carries no ownership contract, so there was no way to express aliased or borrowed bytes for synchronous in-place access.

This adds `ArrayBuffer` (`packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ArrayBuffer.kt`) as the Java representation of an `ArrayBuffer`. It carries an `isOwningBytes` flag: an owning buffer can be stored and returned to JS, a non-owning one aliases bytes valid only for the synchronous call that produced it.

Codegen now emits `ArrayBuffer` for `ArrayBufferTypeAnnotation` params (was `ByteBuffer`) and returns (was `ByteBuffer`).

## Changelog:

[ANDROID] [ADDED] - Add `ArrayBuffer`, the Java representation of a JS `ArrayBuffer` for TurboModules, with an explicit byte-ownership contract

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

Test Plan:
- Codegen Java spec and JNI C++ snapshot tests updated for `ArrayBuffer` param/return signatures.
- `SampleTurboModule` doubles its sync argument in place and returns the same buffer, covering the zero-copy path end to end; `createNativeBuffer` allocates via `ArrayBuffer`.
- C++ API snapshots regenerated.

Reviewed By: javache

Differential Revision: D115755247

Pulled By: christophpurrer

fbshipit-source-id: de067789ad145b7202da721a02f838358c82f4d8
2026-08-17 15:48:23 -07:00
Christoph Purrer 4bf5575490 Make codegen'd TurboModule event emitters no-op when the emitter callback is absent (#57893)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57893

The codegen'd TurboModule `emitOn<Event>` methods invoked their `EventEmitterCallback` without checking it was set. That callback is installed by the generated `*SpecJSI` constructor, which runs when JS first looks the module up — so a native module that emits before that point invoked an empty `std::function` on iOS (`std::bad_function_call`) or a null field on Android (NPE). Native code commonly holds the module instance and pushes events well before any JS surface mounts, so call sites had to wrap every emit in a try/catch to stay crash-free.

Both generators now read the callback into a local and no-op when it is absent:

- ObjC++ (`serializeEventEmitter.js`): copies `_eventEmitterCallback`, calls it only if non-empty.
- Java (`GenerateModuleJavaSpec.js`): copies the `Nullable CxxCallbackImpl` field and null-checks it.

The local is for readability, not synchronization: the callback is installed once and never cleared, and Java reference reads are already atomic.

The `setEventEmitterCallback` lambdas had a separate lifetime bug: they captured `eventEmitterMap_` by reference and looked events up with `operator[]`. The Java/ObjC module owns the callback and can outlive the C++ `*SpecJSI` that installed it, so a stale callback dereferenced a dangling map; and `operator[]` silently default-inserted a null `shared_ptr` for an unknown event name, which the next line dereferenced. They now capture a copy of the map and use a checked `find` (`serializeModule.js`, `JavaTurboModule.cpp`). Every emitter is registered before the callback is installed, so the copy is complete.

Note the scope of the guarantee: it covers the ObjC++ and Java generators, which route through an `EventEmitterCallback`. A C++-only TurboModule (`<Module>CxxSpec`, from `GenerateModuleH.js`) has no callback to check — it emits through `eventEmitterMap_` entries its own constructor registers — so the "emit unconditionally" guidance is about the callback, not about emitting before construction finishes.

Changelog:
[General][Fixed] - TurboModule event emitters no longer throw when an event is emitted before the emitter callback is installed

Reviewed By: javache

Differential Revision: D115130767

fbshipit-source-id: 7d7b9a706b8983968e3e1207b22c66322f04a223
2026-08-17 10:41:02 -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
Sam Zhou 727e87ed26 Fully replace hermes-(estree|parser|eslint|transform) packages with flow-* counterparts in react-native (#57851)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57851

The flow-* packages have support for all latest syntax and is better maintained.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D115064040

fbshipit-source-id: 7265eb722910a460c76d0dbde0603cf962fe4e4e
2026-08-10 07:21:52 -07:00
Kamil Paradowski 5fb3ebce1a ArrayBuffer support to Java TurboModules
Summary:
Changelog:
[ANDROID] [ADDED] - Add ArrayBuffer support to Java TurboModules

- Codegen: ArrayBufferTypeAnnotation → ByteBuffer / ArrayBufferKind / Ljava/nio/ByteBuffer; in GenerateModuleJavaSpec and GenerateModuleJniCpp. Guard in Utils.js rejects Promise<ArrayBuffer> on Android at codegen time — drops async return to avoid CxxCallbackImpl.kt / JCallback / PromiseImpl.kt changes.

- Runtime: New JByteBufferMutableBuffer.h — jsi::MutableBuffer wrapping global_ref<JByteBuffer> direct ByteBuffer, holds Java object alive for JS ArrayBuffer lifetime; dtor uses ThreadScope to attach JNI thread (Hermes GC finalizes off-thread). Zero-copy native→JS return mirrors iOS NSMutableDataBuffer. Args JS→Java always copied into Java-owned direct ByteBuffer via allocateDirect+memcpy (mirrors iOS NSData copy), no sync/async branching — safe to retain/dispatch past GC.

- No changes to CxxCallbackImpl.kt, JCallback, PromiseImpl.kt. Nested ArrayBuffers still via folly::dynamic, deferred like ObjC/C++.

- Samples: NativeSampleTurboModule.js spec, SampleTurboModule.kt (getArrayBuffer/ createNativeBuffer/ processAsyncBuffer), RCTSampleTurboModule.mm. (NSData param / NSMutableData return), RNTester UI SampleTurboModuleExample.js.

X-link: https://github.com/facebook/react-native/pull/57062

Reviewed By: javache

Differential Revision: D107411163

Pulled By: christophpurrer

fbshipit-source-id: 67cc5da796a87f6918f0382debc5c5594f76661b
2026-08-06 12:28:37 -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 e6fd1a3e7c Replace hermes-{parser,eslint} with flow-{parser,eslint} in OSS projects (#57772)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57772

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D114245899

fbshipit-source-id: fa42b5276a5f6fe0d22e301a4cfc438122d70e6d
2026-07-30 18:23:59 -07:00
Sam Zhou 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
Sam Zhou 3365667479 Install flow-{estree,eslint,parser,transform} counterparts to the hermes-* packages (#57769)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57769

Eventually, we will replace the hermes ones with the `flow-{estree,eslint,parser,transform}` packages. This diff first installs the flow ones.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D114226573

fbshipit-source-id: a693cdac57d2ce77c002a8ac455aceabaadbcf20
2026-07-30 10:37:48 -07:00
Christoph Purrer 5e86c323ce Use NSData for the JS->ObjC ArrayBuffer argument path (#57596)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57596

The original implementation used `NSMutableData` for both directions of the
JSI<->ObjC ArrayBuffer conversion. That is the wrong contract on the argument
(JS -> ObjC/Native) side: an inbound buffer is owned by the caller, not the
native module, and `NSMutableData` must own a resizable backing store it can
`realloc`/`free`, so it cannot durably alias a foreign buffer.

This diff keeps `NSMutableData` for the ObjC/Native -> JS (return) path, but
switches the JS -> ObjC/Native (argument) path to the immutable `NSData`:

- Codegen: `getParamObjCType` now maps `ArrayBufferTypeAnnotation` params to
  `NSData *` (return type stays `NSMutableData *`).
- Runtime: `convertJSIArrayBufferToNSMutableData` is renamed to
  `convertJSIArrayBufferToNSData` and returns an immutable `NSData`. The bytes
  are still eagerly copied, which keeps the result safe to retain, store, or
  dispatch to another thread regardless of whether the source bytes were owned
  by JS or by a native `MutableBuffer`.
- Updated the ObjC unit tests and the codegen `GenerateModuleHObjCpp` snapshot.

Changelog: [INTERNAL]

Reviewed By: javache

Differential Revision: D112582384

fbshipit-source-id: 8ed2dfb3f23e7f39677dfb1824c5530f378705bc
2026-07-21 11:46:04 -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
Danny Povolotski 27b5f761b1 avoid copying extended file attributes when inside virtiofs (#57555)
Summary:
I'm doing CI/CD that includes React Native inside of https://tart.run/. Tart uses Apple Virtualization Framework, which in turn mounts VirtioFS volumes.

This feels like a common enough use case to contribute upstream, since I can envision many more people using Apple's virtualization features.

## Changelog:

[GENERAL] [FIXED] - react-native-codegen build.sh on AppleVirtIOFS volumes

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

Test Plan: Run `packages/react-native-codegen/scripts/oss/build.sh` inside a virtual machine that uses Apple Virtualization Framework such as Tart

Reviewed By: cipolleschi

Differential Revision: D112091671

Pulled By: cortinico

fbshipit-source-id: 800e6ac54175aaf7a9dfb4b99950cbc6da86e085
2026-07-15 07:00:18 -07:00
Sam Zhou a016e94b59 Redo D111190630: Stop using prettier-plugin-hermes-parser for formatting (#57537)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57537

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D111829105

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

Original commit changeset: e7ed7ee6f057

Original Phabricator Diff: D111190630

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

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D111190630

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

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D110952668

fbshipit-source-id: a2278dbe978b42d42f57ddea10a947703a181797
2026-07-08 05:24:04 -07:00
Kamil Paradowski 54b88d9dea ArrayBuffer support to ObjC TurboModules
Summary:
Adds ArrayBuffer support to ObjC TurboModules, following the C++ ArrayBuffer PR ([`226ef2e`](https://github.com/facebook/react-native/commit/226ef2e7c5d1928d5696dc23efc1b8950ba00e37)).

- Codegen support for `ArrayBufferTypeAnnotation` in ObjC module specs (`NSMutableData *` params/returns, new `ArrayBufferKind`)
- JSI↔ObjC conversion wraps native-backed buffers zero-copy via `-[NSMutableData initWithBytesNoCopy:length:deallocator:]`; the deallocator retains the backing store so the bytes stay valid even if the `NSMutableData` escapes the call or the source ArrayBuffer is garbage-collected
- JS-backed buffers are copied, which is safe on both the synchronous and asynchronous paths

This PR is iOS-only; Android support follows in a separate PR.

## Changelog:

[IOS] [ADDED] - Add ArrayBuffer support to ObjC TurboModules

X-link: https://github.com/facebook/react-native/pull/56986

Reviewed By: javache

Differential Revision: D106846249

Pulled By: christophpurrer

fbshipit-source-id: 3393d5d6f31a1412f5d52328c90e51205aa6b153
2026-06-27 23:41:58 -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