1626 Commits
Author SHA1 Message Date
Riccardo Cipolleschi f37513595f Rename use-hermes-nightly.js to use-hermes-prebuilt.js (#56750)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56750

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

## Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D104649633

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

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

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

## Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D104649629

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

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

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

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

Reviewed By: cortinico

Differential Revision: D104380961

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

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

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

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

Reviewed By: cortinico

Differential Revision: D104244582

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

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

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D104323543

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

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

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

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

Reviewed By: sammy-SC

Differential Revision: D104044772

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

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

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

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

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

Reviewed By: cipolleschi

Differential Revision: D103865622

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

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

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

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

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D101809616

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

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

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D102145286

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

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

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D101879633

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

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

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

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

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

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

## Changelog:

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

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

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

Reviewed By: javache

Differential Revision: D101247487

Pulled By: cipolleschi

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

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

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

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D101108326

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

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

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

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D101108467

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

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

This change maintains API compatibility while resolving the compiler warning.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D101111638

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

**Summary**

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

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

 Updated Code

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

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

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D96082175

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

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

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

Two coordinated changes that balance throughput and safety:

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

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

Changelog: [Internal]

Reviewed By: andrewdacenko

Differential Revision: D101791795

fbshipit-source-id: 035c7235c32303f7b7f1eb05698b2a5cba90edc9
2026-04-21 06:01:11 -07:00
Alex Hunt 11a5432cb2 Support light/dark mode toggling via Emulation.setEmulatedMedia (#56510)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56510

Implements the `Emulation.setEmulatedMedia` CDP method in `jsinspector-modern`, scoped to `prefers-color-scheme` emulation. This allows CDP clients to toggle the app color scheme for debugging and visual verification.

**Implementation notes**

Adds a new `EmulationAgent` CDP domain agent that validates the `features` param, rejects unsupported media features/types, and delegates to `HostTargetDelegate::onSetEmulatedMedia`. Platform delegates:

- **Android**: Calls `AppCompatDelegate.setDefaultNightMode()` on the UI thread via JNI through `ReactHostImpl`.
- **iOS**: Sets `overrideUserInterfaceStyle` on the key `UIWindow`.

Both platforms trigger their existing `Appearance` change event propagation to JS automatically.

Changelog:
[General][Added] - **React Native DevTools**: Add support for light/dark mode emulation via `Emulation.setEmulatedMedia`

Reviewed By: hoxyq

Differential Revision: D101624433

fbshipit-source-id: e795bf22327142bae0a7275ee92f7f778736541f
2026-04-21 05:21:12 -07:00
Alan Hughes 70281d6d0e Skip use-hermes-nightly when hermes-compiler is already pinned (#56505)
Summary:
`use-hermes-nightly` unconditionally overwrites the `hermes-compiler` with whatever the `latest-v1` tag currently points to. On release branches, where `hermes-compiler` is pinned to a specific version, it replaces the pin. This doesn't cause an issue until the `latest-v1` tag moves off the pinned version.

Looks to have been introduced by https://github.com/facebook/react-native/issues/53837.

bypass-github-export-checks

## Changelog:

[INTERNAL] [FIXED] - Preserve pinned `hermes-compiler` version when running `use-hermes-nightly` on release branches.

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

Test Plan: With `hermes-compiler` manually set to a real version, the script returns early without modifying `package.json` or `hermes-engine/version.properties`.

Reviewed By: cortinico

Differential Revision: D101633376

Pulled By: cipolleschi

fbshipit-source-id: 666baa1a7838272b18e326b8597394d66b81343c
2026-04-21 03:58:20 -07:00
Zeya Peng e8feadea81 fix react-native-cxx-stable-api-snapshot-validation test (#56511)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56511

## Changelog:

[Internal] [Fixed] - Fix react-native-cxx-stable-api-snapshot-validation test

Reviewed By: jeffrey-beauchamp

Differential Revision: D101646907

fbshipit-source-id: 6fda6032ee3a9b1c418ea19c7fffd5aabe614fb2
2026-04-20 08:52:12 -07:00
Zeya Peng 1433e43348 Clear AnimatedPropsRegistry on surface stop (#56485)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56485

## Changelog:

[Internal] [Fixed] - Clear AnimatedPropsRegistry on surface stop

When `useSharedAnimatedBackend` is enabled, the `AnimatedPropsRegistry` accumulates
`SurfaceContext` entries (containing `shared_ptr<ShadowNodeFamily>` and `PropsSnapshot`
data) for each surface that has animated views. These entries are never cleaned up when
a surface is destroyed via `UIManager::stopSurface()`, because that method only calls
the legacy `stopSurfaceForAnimationDelegate()` — the shared backend's registry is untouched.

We also see increased `RetryableMountingLayerException` errors in production which stack trace
shows there are mount items committing to surface that no longer exists.

This change:
1. Adds `animationBackend_->clearRegistry(surfaceId)` to `UIManager::stopSurface()`
2. Changes `AnimatedPropsRegistry::clear()` to fully erase the `surfaceContexts_` map
   entry instead of just clearing its contents

Reviewed By: christophpurrer

Differential Revision: D101354994

fbshipit-source-id: c7668f728050a0d3f5c09ad5ca51e48450c1b87e
2026-04-20 07:48:25 -07:00
Jakub Piasecki 46c0177162 Change failing C++ api validation signal to blocking (#56503)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56503

Changelog: [Internal]

Changes the signals pointing out C++ api snapshot not being updated to be blocking.

Commits the new baseline snapshots

Reviewed By: cipolleschi, cortinico

Differential Revision: D101617655

fbshipit-source-id: 8836cb55292ab2e3fa0b696d289f9bd0daf46dec
2026-04-20 06:03:05 -07:00
Zeya Peng 22477787e4 Android bitmap snapshot capture and display (#56460)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56460

## Changelog:

[Internal] [Added] - Android bitmap snapshot capture and display

Implement the Android side of view transition bitmap snapshots.

**`ViewTransitionSnapshotManager`** (new Kotlin class):
Manages the full snapshot lifecycle as a `UIManagerListener`. Captures bitmaps
on the UI thread, maps them from source to target pseudo-element tags,
re-applies after mount cycles (since views may be recreated), and self-cleans
when views are deleted.

**JNI bridge:**
`FabricUIManagerBinding` → `FabricMountingManager` → `FabricUIManager` JNI
delegates to the snapshot manager.

**`SurfaceMountingManager.applyViewSnapshot`:** sets bitmap as view background
using the KTX `Bitmap.toDrawable` extension.

Reviewed By: sammy-SC, NickGerleman

Differential Revision: D99173446

fbshipit-source-id: 5efdd0d9ef064f24222bbbc07e5b32b6aac19d0b
2026-04-16 08:53:31 -07:00
Zeya Peng 39ac6542bb Add bitmap snapshot capture/display delegate plumbing (#56458)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56458

## Changelog:

[Internal] [Added] - Add bitmap snapshot capture/display delegate plumbing

Wire view transition bitmap snapshot capture and display through the C++
delegate chain so platforms can implement snapshotting old-element views.

**ViewTransitionModule.cpp**: Call `uiManagerDidCaptureViewSnapshot(tag,
surfaceId)` in `applyViewTransitionName` to capture a bitmap of the old view
while it is still mounted, and `uiManagerDidSetViewSnapshot(sourceTag,
targetTag, surfaceId)` in `applySnapshotsOnPseudoElementShadowNodes` to map
captured bitmaps onto pseudo-element views.

**UIManagerDelegate / SchedulerDelegate**: Add pure virtual
`captureViewSnapshot` and `setViewSnapshot` methods.

**Scheduler**: Forward `UIManagerDelegate` calls to `SchedulerDelegate`.

**Platform stubs**: Empty implementations for iOS (`RCTScheduler.mm`),
CxxPlatform (`SchedulerDelegateImpl`), and Android JNI
(`FabricUIManagerBinding`) — Android implementation follows in D99173446.

Reviewed By: NickGerleman

Differential Revision: D98354659

fbshipit-source-id: 239268bc10fba5f751856f66911e15feb3f1868e
2026-04-16 08:53:31 -07:00
Rubén Norte fc331f3883 Strip computed properties in build-types transform (#56450)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56450

Changelog: [internal]

Update the `stripPrivateProperties` Flow transform to also remove
computed properties and methods from type definitions. These are
implementation details that should not be part of the public API.

Previously only underscore-prefixed identifiers were stripped. Now
`PropertyDefinition` and `MethodDefinition` nodes with
`node.computed === true` are also removed.

Reviewed By: huntie

Differential Revision: D100969511

fbshipit-source-id: 7eb1dfde99b56e9c460d83f6b12b7c31c3b04c92
2026-04-15 04:30:40 -07:00
Nedunchezhiyan-M d823f5b1cc Fix incorrect package name and filename in scripts/js-api/README.md (#56362)
Summary:
Two documentation errors in `scripts/js-api/README.md`:

1. **Wrong link text** (line 22): The link for the Flow-to-TypeScript converter reads `[flow-api-extractor](https://www.npmjs.com/package/flow-api-translator)` but the package name is `flow-api-translator`, not `flow-api-extractor`. The link URL was correct but the visible text was misleading.

2. **Wrong filename** (line 76): The Public API snapshot section refers to the file as `ReactNative.d.ts`, while the actual file committed to the repo is `ReactNativeApi.d.ts`. The correct name is already used earlier in the same document (line 16 and line 41).

Fixes https://github.com/facebook/react-native/issues/55667
Fixes https://github.com/facebook/react-native/issues/55668

## Changelog:

[General] [Fixed] - Fix incorrect package name and output filename in scripts/js-api/README.md

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

Test Plan: Documentation-only change. Verified the link URL and the actual file name at `packages/react-native/ReactNativeApi.d.ts`.

Reviewed By: huntie

Differential Revision: D100761759

Pulled By: cortinico

fbshipit-source-id: 8a30ca1a5f35c9491c2ad4c94ae20da4621cb5a7
2026-04-15 04:29:37 -07:00
Rubén Norte 4ff4836a0f Automatically set --runInBand when running benchmarks
Summary:
When `--benchmarks` is passed to `yarn fantom`, automatically append
`--runInBand` to the Jest arguments. This ensures benchmarks run
sequentially in the same process, avoiding parallel test execution that
would introduce noise in performance measurements.

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D100796022

fbshipit-source-id: b78aa44d65ef8618eec6fb08680b5b455cf2470b
2026-04-15 02:39:57 -07:00
Bartlomiej Bloniarz e4f0509973 Add pushAnimationMutations to the AnimationBackend (#56401)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56401

Add `pushAnimationMutations(Callback)` to the AnimationBackend as a targeted alternative to `trigger()`.

The existing `trigger()` method has two problems:

1. **Blast radius**: It calls `onAnimationFrame()` which invokes ALL registered callbacks. When one animation frontend (e.g. Animated) calls `trigger()` in response to an event, every other frontend (e.g. Reanimated) also spins up unnecessarily.

2. **Broken timestamp on iOS**: `trigger()` uses `std::chrono::steady_clock` which on iOS maps to a different kernel clock than what `CADisplayLink` uses for vsync timestamps. These clocks have different baselines and can diverge over time (e.g. after device sleep), causing animations to see time jumps.

`pushAnimationMutations(Callback)` fixes both issues:
- Executes only the provided callback, not all registered ones
- Uses `AnimationChoreographer::now()` which delegates to `HighResTimeStamp`, providing a timestamp from the same clock as the vsync path on each platform

Also refactors `onAnimationFrame` to use `unpackMutations`/`applySurfaceUpdates` helpers, avoiding intermediate vector/set merging when accumulating mutations from multiple callbacks.

## Changelog:
[General][Added] - Add pushAnimationMutations to AnimationBackend for targeted event-driven animation updates

Reviewed By: zeyap

Differential Revision: D100164749

fbshipit-source-id: 53d36ed316614baa835707a45361ae8f3b828d26
2026-04-13 10:22:05 -07:00
Rubén Norte 7efb4b564e Run benchmarks in test mode by default instead of excluding them (#56418)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56418

Changelog: [internal]

D92150163 excluded benchmark tests by default when running `yarn fantom` without `--benchmarks`. This was incorrect because it means benchmarks could silently break without being caught.

This changes the behavior so:
1. By default (without `--benchmarks`), benchmarks run in test mode (single iteration for correctness only), ensuring they do not break.
2. With `--benchmarks`, benchmarks run in full benchmark mode (multiple iterations for performance measurement).

Also renames `FANTOM_FORCE_TEST_MODE` to `FANTOM_RUN_BENCHMARKS` and `forceTestModeForBenchmarks` to `runBenchmarks` to better reflect the intent (opt-in to full benchmarks rather than opt-in to test mode).

Reviewed By: sammy-SC

Differential Revision: D100464314

fbshipit-source-id: 822cc5a25f0cdddf035616fdddf8619d27ef436a
2026-04-13 04:31:04 -07:00
Dawid Małecki b60f0c9f04 Change parser config to accept regex in exclude symbols field. (#56367)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56367

Adds support for regex in the `exclude_symbols` field in the C++ API parser config. This enables better scoped definitions of symbols that should be matched.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D99844594

fbshipit-source-id: 0d2b4f9970c535afa6af8712c9435bdb06c50779
2026-04-09 07:04:52 -07:00
Dawid Małecki f5326c9f33 Exclude deprecated and internal categories from the ReactApple C++ snapshot. (#56351)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56351

Excludes categories marked as `Deprecated` and `Internal` from the ReactApple C++ public API snapshots.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D99838922

fbshipit-source-id: c0266d0edcd4cef4af3d856ffc55b8a7bd07a299
2026-04-09 07:04:52 -07:00
Dawid Małecki 450d75087c Exclude symbols marked as deprecated from the C++ public API snapshot (#56350)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56350

Excludes symbols  marked as `deprecated`, such as:

- viewRegistry_DEPRECATED
- DEPRECATED_sendUpdatedChildFrames
- nativeProps_DEPRECATED
- findShadowNodeByTag_DEPRECATED
- setNativeProps_DEPRECATED

from the C++ public API snapshot.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D99838523

fbshipit-source-id: d164564f41b1ac9fa58aac87e34b17fdde135528
2026-04-09 07:04:52 -07:00
Dawid Małecki 4a88cfbee7 Exclude symbols with DO_NOT_USE from the public C++ API snapshot (#56346)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56346

Excludes all symbols and members that consists of `DO_NOT_USE`, like

- findComponentViewWithTag_DO_NOT_USE_DEPRECATED
- propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN
- setPropKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN
- findComponentDescriptorByHandle_DO_NOT_USE_THIS_IS_BROKEN
- componentViewName_DO_NOT_USE_THIS_IS_BROKEN
- ensurePlaceholderIfEmpty_DO_NOT_USE

Changelog:
[Internal]

Reviewed By: cortinico

Differential Revision: D99834673

fbshipit-source-id: 3744f88fde6d9496506867190aae3f2dbea05fbe
2026-04-09 07:04:52 -07:00
Dawid Małecki 8bf151f532 Remove members that reference excluded symbols (#56341)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56341

Exclude members from .api snapshots when their types (return type, parameter types, variable type, typedef target, property type) reference excluded symbols. Previously, only compounds whose names matched exclude_symbols patterns were excluded — but members of non-excluded compounds could still reference excluded types, causing dangling type references (e.g., `facebook::yoga::ExperimentalFeature`) to appear in the snapshot.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D99434605

fbshipit-source-id: 24d304754161ca891316061dbfee8c2be08d5d40
2026-04-09 07:04:52 -07:00
Joe Vilches b1d12f5354 Allow RCTScrollViewComponentView to be subclass-able (#56319)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56319

While RCTScrollViewComponentView is overridable, its NOT a UIScrollView. It has a private property this is the scroll view and if you want to override UIScrollView behavior you have to change this.

Changelog: [Internal]

Reviewed By: sbuggay

Differential Revision: D99462381

fbshipit-source-id: fec7741248c229c301ba60b6b2b4d06bb14297de
2026-04-08 15:45:58 -07:00
Alex Hunt 77332d275d Add Page.captureScreenshot CDP support (#56307)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56307

Implement the `Page.captureScreenshot` CDP command in the inspector backend, allowing DevTools to capture an on-demand screenshot of the current app view. This is a minimal implementation supporting only the `format` (jpeg/png/webp) and `quality` (0-100, jpeg only) parameters, returning base64-encoded image data.

The feature is gated behind a new `fuseboxCaptureScreenshotEnabled` React Native feature flag, wired through `InspectorFlags` following the same pattern as frame recording.

**Motivation**

Improve agent verification / user feedback during AI sessions. We've proven that screenshots (in performance traces) are useful for understanding how components render on screen, and exposing this as an on-demand CDP method is relatively cheap today vs the larger task of modelling the DOM (Elements panel).

**Changes**

- New `fuseboxCaptureScreenshotEnabled` feature flag + `InspectorFlags` wiring (C++, Android JNI, Kotlin)
- `HostTargetDelegate::captureScreenshot()` virtual method with async callback
- C++ CDP handler in `HostAgent` — parses `format`/`quality`, delegates to platform, sends async CDP response (gated by flag)
- iOS (`RCTHost.mm`): Captures key window via `UIGraphicsImageRenderer` + `drawViewHierarchyInRect`, encodes to PNG/JPEG
- Android (`ReactHostImpl.kt`): Captures decor view via `Bitmap` + `Canvas` + `View.draw()`, encodes to PNG/JPEG/WebP
- 4 C++ tests: success, failure, param forwarding, flag-disabled rejection

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D99099930

fbshipit-source-id: d4d2ef86ba20d2ee230903e152dd21e11f29cbb8
2026-04-08 03:29:14 -07:00
Pieter De Baets 37a18419b1 Add instrumentation tests for FabricMountingManager view lifecycle (#56294)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56294

Add Android instrumentation tests that validate the Java-side and C++ registry
behavior around view preallocation, destruction, and recreation — the core
scenario fixed by D98729251.

Two layers of tests:

1. **Java-side tests** (IntBufferBatchMountItem): Construct mount item int/obj
   buffers manually and execute against MountingManager. Validates CREATE→INSERT
   and Preallocate→Delete→CREATE→INSERT sequences through the Java mount system.

2. **Native registry tests** (FabricMountingManagerTestHelper): JNI hybrid class
   that creates a real C++ FabricMountingManager and exercises the
   allocatedViewRegistry_ lifecycle. Validates that after preallocate + destroy,
   the tag is removed from the registry (the D98729251 fix), so executeMount
   would correctly emit a CREATE instruction.

The native test helper is built as a separate library (libfabricjni_test_helper.so)
under jni/react/fabric/test/, with friend access to FabricMountingManager internals.

Changelog: [Internal]

Reviewed By: Abbondanzo

Differential Revision: D98935855

fbshipit-source-id: 2c41a19e037a34d5500b396836d8f453ab34a109
2026-04-07 07:56:19 -07:00
Dawid Małecki 654d64655a Exclude TinyMap and packAnimatedProps from the public C++ API (#56292)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56292

The TinyMap is a helper class under internal directory, not referenced anywhere in the snapshot, and considered unsafe (from the comment). It is not part of any module, so it is better to remove that from the snapshot.

The `packAnimatedProps` method is used in `AnimationBackend` for translation from `AnimatedProps` to `folly::dynamic` and should not be used outside of React Native.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D98907855

fbshipit-source-id: e3a371cc088000a23f1ce1121fda808494979140
2026-04-01 04:14:29 -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
Jakub Piasecki 3b634bc520 Run the snapshot comparison on CI (#56207)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56207

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D96101927

fbshipit-source-id: 06c6dd11c145be44bcdd97f14683a222c66c96c6
2026-03-31 10:10:04 -07:00
Dawid Małecki c54d353df9 Rename --check flag to --validate in C++ public API parser (#56253)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56253

Renames flag for verifying that the C++ public API snapshot is with sync with the actual public API surface to match the JS API command.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D98484129

fbshipit-source-id: ec806353f263b00e5060d9e7f0333bcf4cced148
2026-03-31 08:32:57 -07:00
Dawid Małecki ef6777ddf3 Exclude iOS-specific symbols from the ReactAndroid C++ API snapshot (#56250)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56250

Excludes iOS-specific symbols from the ReactAndroid C++ API snapshot. The snapshot contains iOS native modules CxxSpec templates, their data structs, and bridging structs that have no relevance on Android. These symbols leaked because the Android codegen generates CxxSpec templates for ALL JavaScript module specs regardless of platform.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D98480080

fbshipit-source-id: a5990c4769456ab756095129851eb4e8dbeda912
2026-03-31 08:32:57 -07:00
Dawid Małecki 829a76afa7 Exclude InputAccessory component from the ReactAndroid C++ API snapshot (#56251)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56251

Excludes InputAccessory which is an iOS-only component with no Android support at any layer. In the `InputAccessoryView.js` there is explicit iOS guard which logs warning on Android.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D98478125

fbshipit-source-id: 871923e001024971167a7bb2eb900ca3867983a4
2026-03-31 08:32:57 -07:00
Dawid Małecki e90735b4ef Exclude Apple Switch component from the ReactAndroid C++ API snapshot (#56249)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56249

Prevents iOS Switch component leaking into the ReactAndroid snapshot by adding `*/components/switch/iosswitch/*` path to the `exclude_patterns` in the parser config.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D98473064

fbshipit-source-id: de25c4cbe839f8a065b8465e48a2b8c2a5ba81d7
2026-03-31 08:32:57 -07:00
Dawid Małecki 0642e41b9c Exclude experimental symbols from the C++ public API snapshot (#56244)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56244

Excludes symbols marked as Experimental from the C++ public API snapshots. Types with the "Experimental" prefix are explicitly not stable API — they represent features still under active development and are subject to change or removal without notice.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D98454721

fbshipit-source-id: 7f7488fab6bc94c52b94a3ae2d9a7a7914815d63
2026-03-31 08:32:57 -07:00
Dawid Małecki e78afea6d1 Exclude UnstabeLegacy symbols from stable C++ API snapshot (#56242)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56242

Excluded symbols that contain "UnstableLegacy" from public stable C++ API snapshot, that is `UnstableLegacyViewManagerAutomaticComponentDescriptor` and `UnstableLegacyViewManagerInteropComponentDescriptor`.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D98317003

fbshipit-source-id: deb4631a26ecb138007cf4958dbabb57ef3739cc
2026-03-31 08:32:57 -07:00
Dawid Małecki 22b5d25c88 Remove feature flags from the C++ public API snapshots (#56245)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56245

Removes feature flags from the C++ public API snapshots as they are considered private. This greatly reduces snapshots size.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D98312529

fbshipit-source-id: e6aad9d930c7c77300329c25668dc2fc3a4686f2
2026-03-31 08:32:57 -07:00
Dawid Małecki fd150efa29 Exclude Android specific symbols from the ReactApple snapshot (#56243)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56243

Modifies C++ API parser config to accept `exclude_symbols` at the platform level and sets `Android` symbols to be excluded from the ReactApple snapshot.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D98298766

fbshipit-source-id: 70b39fe4935e6791701c173e7c9e12532c2817a5
2026-03-31 08:32:57 -07:00
Dawid Małecki 77b69a9983 Exclude Fantom symbols from the C++ public API snapshot (#56241)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56241

Strips remaining Fantom symbols from the public API snapshots generated by codegen.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D98295521

fbshipit-source-id: 24568b825b2aaa062e2b11dc77a018e403c68ddd
2026-03-31 08:32:57 -07:00
Dawid Małecki d513096133 Add exclude_symbols to the cxx-api parser config (#56240)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56240

There are cases in which we want to strip particular symbols from the snapshot. This diff adds `exclude_symbols` to the parser config to enable definitions of symbol patterns that should be excluded from the snapshot.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D98295409

fbshipit-source-id: 47414c1e5060a01dce76d1fc4fdd8ea355bb8d37
2026-03-31 08:32:57 -07:00
Dawid Małecki 9bc2050a79 Fix return type for Bridging::fromJs (#56246)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56246

Fixes return type to receive correct generic types.

Before:
```
static std::pair<T1, T1>
  fromJs(facebook::jsi::Runtime &rt, const jsi::Array &array, const std::shared_ptr<CallInvoker> &jsInvoker)
```

After:
```
static std::pair<T1, T2>
  fromJs(facebook::jsi::Runtime &rt, const jsi::Array &array, const std::shared_ptr<CallInvoker> &jsInvoker)
```

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D98292820

fbshipit-source-id: bb7791ace2391240dd50ece55b2a2ce905a51115
2026-03-31 08:32:57 -07:00