13926 Commits
Author SHA1 Message Date
React Native Bot a632f9efe2 Release 0.86.0
#publish-packages-to-npm&latest
2026-06-09 12:19:19 +00:00
React Native Bot 3c1595b96b [LOCAL] Bump Podfile.lock 2026-06-02 16:13:57 +00:00
React Native Bot 012be3bbbc Release 0.86.0-rc.3
#publish-packages-to-npm&next
2026-06-02 14:27:51 +00:00
Fabrizio Cucci cd5b3b5fa5 Bump Hermes V1 version to 250829098.0.14 2026-06-02 13:45:19 +01:00
React Native Bot 72cbd40e1b [LOCAL] Bump Podfile.lock 2026-05-25 13:23:01 +00:00
React Native Bot 19da7bb3b0 Release 0.86.0-rc.2
#publish-packages-to-npm&next
2026-05-25 11:48:45 +00:00
Christian Falch cc27962c58 fix(cocoapods): escape local file URIs for unicode paths (#56907)
Summary:
https://github.com/facebook/react-native/issues/56878 shows that using unicode characters in paths fails with pod install.

Expo fixed this internally here: https://github.com/expo/expo/pull/45779

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

## How:

Build local `file://` sources through a shared helper that percent-encodes filesystem paths before passing them to `URI::File.build`. This avoids Ruby/CocoaPods URI failures when React Native projects or local prebuilt tarballs live under paths containing Unicode characters or spaces.

Apply the helper to `RNCore` and `ReactNativeDependencies` local tarball sources, including RNCore dSYM-processed prebuilt paths, while leaving remote Maven and Sonatype URLs unchanged.

Add focused coverage for Unicode, spaces, ASCII paths, and the raw `URI::File.build` regression case.

## Changelog:

[IOS] [FIXED] - fixed escaping local file URIs for unicode paths in ruby scripts

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

Test Plan: - Test with creating a new project in a path containing a unicode character and the run pod install.

Reviewed By: cortinico

Differential Revision: D105968728

Pulled By: cipolleschi

fbshipit-source-id: 6d5b9043aafe3d86494f3b5ca0f208e46f1f3739
2026-05-25 07:43:00 +00:00
Adrian Cotfas 6c6511c6b3 feat(Pressable): add support for PlatformColor and alpha (#56395)
Summary:
`android_ripple` on `Pressable` (and `TouchableNativeFeedback.Ripple()`) only
accepted numeric (pre-processed ARGB int) colors. Passing a `PlatformColor`
would throw an invariant in JS, making theme-aware ripple colors impossible.

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

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

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

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

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

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

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

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

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

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

Reviewed By: javache

Differential Revision: D105819708

Pulled By: fabriziocucci

fbshipit-source-id: d27c43e0b4e619b6af1c8de0cdb2882db05ee33c
2026-05-22 10:25:43 +01:00
Riccardo Cipolleschi f2880fdae0 Cache prebuilt iOS binaries in ~/Library/Caches/ReactNative (#56847)
Summary:
Adds a shared cache layer at
  `~/Library/Caches/ReactNative/` for prebuilt iOS tarballs
   (Hermes, ReactNativeDependencies, ReactNativeCore).
  - On first download, tarballs are saved to both the local
   Pods artifacts dir **and** the shared cache.
  - On subsequent `pod install` runs, if the local Pods
  cache is empty but the shared cache has the tarball for
  that version, it is copied locally instead of
  re-downloaded from Maven.
  - Adds descriptive log messages for each scenario: local
  Pods hit, shared cache hit, and cache miss (download).

  This avoids redundant downloads when:
  - The Pods directory is deleted between installs
  - Multiple projects use the same React Native version
  - CI environments have a persistent home directory

  ## Changelog:

  [IOS] [CHANGED] - Cache prebuilt iOS binaries (Hermes,
  ReactNativeDependencies, ReactNativeCore) in
  ~/Library/Caches/ReactNative to avoid redundant downloads
   across pod installs

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

Test Plan:

```
[ReactNativeDependencies] Setting up ReactNativeDependencies...
[ReactNativeDependencies] Building from source: false
[ReactNativeDependencies] Using release tarball
[ReactNativeDependencies] Using tarball from URL: https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-dependencies-debug.tar.gz
[ReactNativeDependencies] Cache miss: downloading reactnative-dependencies-0.81.6-debug.tar.gz from https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-dependencies-debug.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:-  0     0    0     0    0     0      0      0 --:--:-- --:- 35 18.3M   35 6580k    0     0  6386k      0  0:00:02  0:0 73 18.3M   73 13.5M    0     0  6827k      0  0:00:02  0:0100 18.3M  100 18.3M    0     0  6915k      0  0:00:02  0:00:02 --:--:-- 6914k
[ReactNativeDependencies] Saved reactnative-dependencies-0.81.6-debug.tar.gz to shared cache (/Users/cipolleschi/Library/Caches/ReactNative)
[ReactNativeDependencies] Cache miss: downloading reactnative-dependencies-0.81.6-release.tar.gz from https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-dependencies-release.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:-  0     0    0     0    0     0      0      0 --:--:-- --:- 67  9.9M   67 6948k    0     0  6332k      0  0:00:01  0:0100  9.9M  100  9.9M    0     0  6607k      0  0:00:01  0:00:01 --:--:-- 6603k
[ReactNativeDependencies] Saved reactnative-dependencies-0.81.6-release.tar.gz to shared cache (/Users/cipolleschi/Library/Caches/ReactNative)
[ReactNativeDependencies] Source: {http: "https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-dependencies-debug.tar.gz"}
[ReactNativeCore] Setting up ReactNativeCore...
[ReactNativeCore] Building from source: false
[ReactNativeCore] Using tarball from URL: https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-core-debug.tar.gz
[ReactNativeCore] Cache miss: downloading reactnative-core-0.81.6-debug.tar.gz from https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-core-debug.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:-  1 78.5M    1 1557k    0     0  5035k      0  0:00:15 --:- 10 78.5M   10 8537k    0     0  6536k      0  0:00:12  0:0 19 78.5M   19 15.4M    0     0  6866k      0  0:00:11  0:0 28 78.5M   28 22.5M    0     0  6990k      0  0:00:11  0:0 37 78.5M   37 29.7M    0     0  7062k      0  0:00:11  0:0 46 78.5M   46 36.4M    0     0  7037k      0  0:00:11  0:0 55 78.5M   55 43.5M    0     0  7065k      0  0:00:11  0:0 64 78.5M   64 50.5M    0     0  7077k      0  0:00:11  0:0100 78.5M  100 78.5M    0     0  6852k      0  0:00:11  0:00:11 --:--:-- 6482k
[ReactNativeCore] Saved reactnative-core-0.81.6-debug.tar.gz to shared cache (/Users/cipolleschi/Library/Caches/ReactNative)
[ReactNativeCore] Cache miss: downloading reactnative-core-0.81.6-release.tar.gz from https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-core-release.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 26.3M  100 26.3M    0     0  5683k      0  0:00:04  0:00:04 --:--:-- 5793k
[ReactNativeCore] Saved reactnative-core-0.81.6-release.tar.gz to shared cache (/Users/cipolleschi/Library/Caches/ReactNative)
[ReactNativeCore] Source: {http: "https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-core-debug.tar.gz"}
Configuring the target with the New Architecture
[ReactNativeCore] Using React Native Core and React Native Dependencies prebuilt versions.
[Codegen] Analyzing /Users/cipolleschi/Tests/My0_81App/package.json
```

```
[ReactNativeDependencies] Setting up ReactNativeDependencies...
[ReactNativeDependencies] Building from source: false
[ReactNativeDependencies] Using release tarball
[ReactNativeDependencies] Using tarball from URL: https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-dependencies-debug.tar.gz
[ReactNativeDependencies] Cache hit: copying reactnative-dependencies-0.81.6-debug.tar.gz from shared cache (/Users/cipolleschi/Library/Caches/ReactNative)
[ReactNativeDependencies] Cache hit: copying reactnative-dependencies-0.81.6-release.tar.gz from shared cache (/Users/cipolleschi/Library/Caches/ReactNative)
[ReactNativeDependencies] Source: {http: "https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-dependencies-debug.tar.gz"}
[ReactNativeCore] Setting up ReactNativeCore...
[ReactNativeCore] Building from source: false
[ReactNativeCore] Using tarball from URL: https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-core-debug.tar.gz
[ReactNativeCore] Cache hit: copying reactnative-core-0.81.6-debug.tar.gz from shared cache (/Users/cipolleschi/Library/Caches/ReactNative)
[ReactNativeCore] Cache hit: copying reactnative-core-0.81.6-release.tar.gz from shared cache (/Users/cipolleschi/Library/Caches/ReactNative)
[ReactNativeCore] Source: {http: "https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-core-debug.tar.gz"}
Configuring the target with the New Architecture
[ReactNativeCore] Using React Native Core and React Native Dependencies prebuilt versions.
[Codegen] Analyzing /Users/cipolleschi/Tests/My0_81App/package.json
...
[ReactNativeDependencies] Using release tarball
[ReactNativeDependencies] Using tarball from URL: https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-dependencies-debug.tar.gz
[ReactNativeDependencies] Tarball reactnative-dependencies-0.81.6-debug.tar.gz already exists in Pods. Skipping download.
[ReactNativeDependencies] Tarball reactnative-dependencies-0.81.6-release.tar.gz already exists in Pods. Skipping download.
```

```
[ReactNativeDependencies] Setting up ReactNativeDependencies...
[ReactNativeDependencies] Building from source: false
[ReactNativeDependencies] Using release tarball
[ReactNativeDependencies] Using tarball from URL: https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-dependencies-debug.tar.gz
[ReactNativeDependencies] Tarball reactnative-dependencies-0.81.6-debug.tar.gz already exists in Pods. Skipping download.
[ReactNativeDependencies] Tarball reactnative-dependencies-0.81.6-release.tar.gz already exists in Pods. Skipping download.
[ReactNativeDependencies] Source: {http: "https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-dependencies-debug.tar.gz"}
[ReactNativeCore] Setting up ReactNativeCore...
[ReactNativeCore] Building from source: false
[ReactNativeCore] Using tarball from URL: https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-core-debug.tar.gz
[ReactNativeCore] Tarball reactnative-core-0.81.6-debug.tar.gz already exists in Pods. Skipping download.
[ReactNativeCore] Tarball reactnative-core-0.81.6-release.tar.gz already exists in Pods. Skipping download.
[ReactNativeCore] Source: {http: "https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-core-debug.tar.gz"}
Configuring the target with the New Architecture
[ReactNativeCore] Using React Native Core and React Native Dependencies prebuilt versions.
[Codegen] Analyzing /Users/cipolleschi/Tests/My0_81App/package.json
[Codegen] Searching for codegen-enabled libraries in the app.
[Codegen] The "codegenConfig" field is not defined in package.json. Assuming there is nothing to generate at the app level.
[Codegen] Searching for codegen-enabled libraries in react-native.config.js
[Codegen] Found react-native-safe-area-context
[Codegen] Processing safeareacontext
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Supported Apple platforms: ios, macos, tvos, visionos for safeareacontext
[Codegen] Generating Native Code for safeareacontext - ios
[Codegen] Generated artifacts: /Users/cipolleschi/Tests/My0_81App/ios/build/generated/ios
[Codegen] Generating RCTThirdPartyComponentsProvider.h
[Codegen] Generated artifact: /Users/cipolleschi/Tests/My0_81App/ios/build/generated/ios/RCTThirdPartyComponentsProvider.h
[Codegen] Generating RCTThirdPartyComponentsProvider.mm
[Codegen] Generated artifact: /Users/cipolleschi/Tests/My0_81App/ios/build/generated/ios/RCTThirdPartyComponentsProvider.mm
[Codegen] Generating RCTModulesProvider.h
[Codegen] Generated artifact: /Users/cipolleschi/Tests/My0_81App/ios/build/generated/ios/RCTModuleProviders.h
[Codegen] Generating RCTModuleProviders.mm
[Codegen] Generated artifact: /Users/cipolleschi/Tests/My0_81App/ios/build/generated/ios/RCTModuleProviders.mm
[Codegen] Generating RCTAppDependencyProvider
[Codegen] Generated artifact: /Users/cipolleschi/Tests/My0_81App/ios/build/generated/ios/RCTAppDependencyProvider.h
[Codegen] Generated artifact: /Users/cipolleschi/Tests/My0_81App/ios/build/generated/ios/RCTAppDependencyProvider.mm
[Codegen] Generated podspec: /Users/cipolleschi/Tests/My0_81App/ios/build/generated/ios/ReactAppDependencyProvider.podspec
[Codegen] Generated podspec: /Users/cipolleschi/Tests/My0_81App/ios/build/generated/ios/ReactCodegen.podspec
[Codegen] Done.
[ReactNativeDependencies] Using release tarball
[ReactNativeDependencies] Using tarball from URL: https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.6/react-native-artifacts-0.81.6-reactnative-dependencies-debug.tar.gz
[ReactNativeDependencies] Tarball reactnative-dependencies-0.81.6-debug.tar.gz already exists in Pods. Skipping download.
[ReactNativeDependencies] Tarball reactnative-dependencies-0.81.6-release.tar.gz already exists in Pods. Skipping download.
Analyzing dependencies
```

Reviewed By: cortinico

Differential Revision: D105315202

Pulled By: cipolleschi

fbshipit-source-id: 3196d589f59b8edc75e62752d0c61c3618c1be90
2026-05-21 17:25:04 +01:00
Christian Falch 443ac4028d fix(cocoapods) Podfile.lock SPEC CHECKSUMS drift for React XCFrameworks (#56803)
Summary:
Two developers (or one developer on two paths, or CI vs. local) running pod install on the same React Native project at the same commit get different SPEC CHECKSUMS entries for React-Core-prebuilt and ReactNativeDependencies in Podfile.lock. That breaks pod install-deployment style verification and any workflow that expects Podfile.lock to be reproducible.

CocoaPods derives each SPEC CHECKSUMS entry by hashing the in-memory podspec JSON. So anything embedded in source.http, prepare_command, user_target_xcconfig, etc. becomes part of the hash. Two podspec-resolution sites in this repo build their source.http from an absolute on-disk path.

Because project_pods_root is an absolute path, the resulting file://<abs>/... URL differs across machines or working-tree paths, so the hashed JSON differs, so the checksum differs.

### How

The Maven URL for each tarball is already computed inside both functions (stable_tarball_url(...) / nightly_tarball_url(...) / release_tarball_url(...)). Returning that URL — a stable string identical across machines — instead of the local file:// URL makes source.http path-free. CocoaPods downloads from Maven and caches the tarball itself, so functionality is preserved.

The pre-existing local-tarball download is kept untouched (its only remaining consumer is the opt-in  `RCT_SYMBOLICATE_PREBUILT_FRAMEWORKS=1` dSYM-injection path in rncore.rb, which still needs file:// to feed CocoaPods a mutated tarball — gated by unless @download_dsyms so the leak is preserved only for that flag).

**Out of scope: **

hermes-engine.podspec has the same shape of leak in user_target_xcconfig.HERMES_CLI_PATH. Fixing it requires a paired change to ensure hermesc lands at the new ${PODS_ROOT}-relative path; that's a separate PR.

## Changelog:

[IOS] [FIXED] - Fix Pod install checksum drifting

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

Test Plan:
Run `pod install` and verify that none of the following files contains absolute paths:

- Pods/Local Podspecs/React-Core-prebuilt.podspec.json
- Pods/Local Podspecs/ReactNativeDependencies.podspec.json

Reviewed By: christophpurrer

Differential Revision: D104889112

Pulled By: CalixTang

fbshipit-source-id: 97505a8bf78f7df57bda2d87705da5a20c934d2b
2026-05-21 16:14:18 +00:00
x-Wawa ff2562e6e1 fix(ios): load RCTDefines.h first in React umbrella + drop submodule wildcard so RCT_* macros stay visible (#56862)
Summary:
When `RCT_USE_PREBUILT_RNCORE=1` (the 0.84+ default) and a consumer pod builds under `use_frameworks!`, RCT macros like `RCT_EXTERN`, `RCT_EXTERN_C_BEGIN`, `RCT_EXPORT_METHOD`, `RCT_REMAP_METHOD` fail to propagate.

The `.m` files using these macros hit cascading parse errors like :
- `unknown type name 'RCT_EXTERN_C_BEGIN'` in `<React/RCTBridgeModule.h>` line 51,
- `unknown type name 'RCT_EXTERN'` in `<React/RCTEventDispatcherProtocol.h>` line 17,
- and `type specifier missing, defaults to 'int'` on every `RCT_EXPORT_METHOD(...)` call site.

Root cause is in two places in `packages/react-native/scripts/ios-prebuild/templates/`:

1. `React-umbrella.h` orders `RCTBridgeConstants.h` (line 56) before `RCTDefines.h` (line 84). `RCTBridgeConstants.h` uses `RCT_EXTERN` at its first declaration but the macro is only defined later in `RCTDefines.h`. When the umbrella is loaded as a single parse context, the `RCT_EXTERN` use is unresolvable.

2. `module.modulemap` declares `module * { export * }` inside both `framework module` blocks, which creates an inferred submodule per header. That isolates macro `#define`s into per-header parse scopes. Even fixing the umbrella order, sibling submodules don't share macros: macros defined in the `RCTDefines.h` submodule are invisible to the `RCTBridgeConstants.h` submodule, and to consumers of the `React` module.

This PR fixes both:

- Move `#import <React/RCTDefines.h>` to the very top of the umbrella (right after the prologue and before any other `<React/...>` import), with a comment explaining why ordering matters.
- Remove the `module * { export * }` wildcard from both `framework module` blocks in the modulemap. The umbrella header alone is sufficient to declare the module's contents, and dropping the wildcard means the whole module shares one parse context where macros propagate.

The combination of `use_frameworks!` + prebuilt RNCore is the path of least resistance today: `use_frameworks!` is the Expo default and is required by `firebase-ios-sdk` for its Swift bridges. Prebuilt RNCore is the 0.84+ default. The colliding defaults break native-module ecosystems like `react-native-firebase` that consume the RCT macros. Producer-side fix is in flight at invertase/react-native-firebase#9024; this PR closes the consumer side.

## Changelog:

[IOS] [FIXED] - Load `RCTDefines.h` first in the prebuilt React umbrella and drop the `module *` submodule wildcard so RCT_* macros propagate to consumer pods under `use_frameworks!`.

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

Test Plan:
Reproduced on RN 0.85.3 (latest stable at time of writing) on macOS 26.3.1 / Xcode 26.5 / iOS 26.5 Simulator (iPhone 17 Pro).

**Reproducer setup**

Fork of `mikehardy/rnfbdemo` with these adjustments in `make-demo.sh`:
- `RN_VER=0.85.3`
- `RNFB_VER=24.0.0`
- `FB_IOS_VER=12.10.0`
- Remove `react-native-firebase/dynamic-links` from the bulk yarn add (deprecated and removed in RNFB 24.x).

Default Podfile mods produced by `make-demo.sh` are preserved: `use_frameworks! :linkage => :static` + `$RNFirebaseAsStaticFramework = true`. No `RCT_USE_PREBUILT_RNCORE` override (stays at the `1` default).

Public reproducer: https://github.com/wneel/rnfbdemo (see its `REPRO.md` for the two-stage flow).

The reproducer also has invertase/react-native-firebase#9024 (producer-side podspec fixes) applied as an overlay. Without those, the build fails earlier at `-Wnon-modular-include-in-framework-module`. With them applied, the build progresses to the consumer side and surfaces the macro propagation bug this PR fixes.

**Before this PR**

Same reproducer config. iOS build fails on consumer pods (RNFBAuth, RNFBStorage, RNFBMessaging) with:

```
.../Pods/Headers/Public/React-Core/React/RCTEventDispatcherProtocol.h:17:1: error: unknown type name 'RCT_EXTERN'
.../Pods/Headers/Public/React-Core/React/RCTEventDispatcherProtocol.h:17:27: error: expected ';' after top level declarator
.../node_modules/react-native-firebase/messaging/ios/RNFBMessaging/RNFBMessaging+AppDelegate.h:26:21: error: declaration of 'RCTPromiseRejectBlock' must be imported from module 'RNFBApp.RNFBAppModule' before it is required
```

**After this PR**

Same reproducer config builds cleanly: `pod install` clean, `xcodebuild` Debug build produces the app, zero `RCT_EXTERN` macro errors anywhere in the log.

Verified by editing `packages/react-native/scripts/ios-prebuild/templates/React-umbrella.h` and `packages/react-native/scripts/ios-prebuild/templates/module.modulemap` in place (the diff in this PR), regenerating the prebuilt React.xcframework artifact, and re-running the reproducer.

**Output of `npx react-native-community/cli info` from the reproducer environment:**

```
System:
  OS: macOS 26.3.1
  CPU: (10) arm64 Apple M2 Pro
  Memory: 466.16 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.14.0
    path: /usr/local/bin/node
  Yarn:
    version: 3.6.4
    path: /usr/local/bin/yarn
  npm:
    version: 11.12.1
    path: /usr/local/bin/npm
  Watchman:
    version: 2026.05.11.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.5
      - iOS 26.5
      - macOS 26.5
      - tvOS 26.5
      - visionOS 26.5
      - watchOS 26.5
IDEs:
  Xcode:
    version: 26.5/17F42
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 21.0.9
    path: /usr/bin/javac
```

**Cross-references**

- `react-native-firebase` producer-side fix in flight: invertase/react-native-firebase#9024
- `react-native-firebase` `.m` import hygiene follow-up: invertase/react-native-firebase#9026
- Original RNFB user-facing issue: invertase/react-native-firebase#8883

Reviewed By: cortinico

Differential Revision: D105582598

Pulled By: cipolleschi

fbshipit-source-id: ab364d46fc94d64274197cdd717a06e425a9324f
2026-05-21 15:57:39 +00:00
React Native Bot aa91ba2772 [LOCAL] Bump Podfile.lock 2026-05-18 16:34:12 +00:00
React Native Bot 94b6bcb34c Release 0.86.0-rc.1
#publish-packages-to-npm&next
2026-05-18 14:48:30 +00:00
Mathieu Acthernoene ff84256ea9 Fix Image.getSize returning downsampled dimensions on Android (#56736)
Summary:
`Image.getSize` and `getSizeWithHeaders` call Fresco's `fetchDecodedImage`, which returns a `CloseableImage` whose width / height reflect the bitmap after Fresco's automatic downsampling (typically capped at the screen size).

For sources larger than the screen this returned the wrong dimensions. ex: a 4000x3000 image on a 1920x1080 device came back as 1920x1440.

Switch to `fetchEncodedImage` and read the dimensions from the parsed image metadata (JPEG / PNG / WebP / HEIF headers), so the values are the true source dimensions. Swap width / height for 90°/270° EXIF rotation to match the iOS behavior in `RCTImageLoader`.

Fixes https://github.com/facebook/react-native/issues/33498
Closes facebook/fresco#2236

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[ANDROID] [FIXED] - `Image.getSize` and `Image.getSizeWithHeaders` now return the true source dimensions instead of Fresco's downsampled values

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

Test Plan:
In the RNTester app, add:

```ts
useEffect(() => {
  Image.getSize(
    'https://images.pexels.com/photos/842711/pexels-photo-842711.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2',
    (width, height) => {
      console.log({width, height});
    },
  );
}, []);
```

### Before

<img width="811" height="467" alt="before" src="https://github.com/user-attachments/assets/6fb401ed-cf5a-4496-bcc1-4cfd243bc0b7" />

### After

<img width="811" height="467" alt="after" src="https://github.com/user-attachments/assets/dc809d5f-c554-45d6-a3a3-7712bf39ac44" />

Reviewed By: javache

Differential Revision: D104533593

Pulled By: Abbondanzo

fbshipit-source-id: f087d528474c40cffbf24eb1e3958b4b18fb118e
2026-05-18 12:50:01 +00:00
Mathieu Acthernoene 1d8d46b07f Make PODFILE_DIR build setting portable across machines (#56732)
Summary:
`PODFILE_DIR` was being set to `Pod::Config.instance.installation_root.to_s`, which bakes the contributor's absolute path (e.g. `/Users/alice/Projects/MyApp/ios`) into `project.pbxproj` — every `pod install` on a different machine churns the diff, and a checked-in pbxproj points at someone else's filesystem.

Set `PODFILE_DIR` per-project via Xcode variable substitution: `$(SRCROOT)` for user projects, `$(SRCROOT)/..` for the Pods project. Resolved value is identical at build time; the persisted string is now machine-independent.

## Changelog:

[IOS] [FIXED] - Persist `PODFILE_DIR` as `$(SRCROOT)`-relative so `project.pbxproj` is portable across machines

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

Test Plan:
1. `pod install`, inspect host-app and Pods `pbxproj`: `PODFILE_DIR` should be `$(SRCROOT)` and `$(SRCROOT)/..`, not an absolute path.
2. Build the app and confirm consumers of `${PODFILE_DIR}` still resolve correctly (`with-environment.sh`, codegen script phases).

Reviewed By: christophpurrer

Differential Revision: D104398698

Pulled By: cipolleschi

fbshipit-source-id: e00f027d5c3570ac1a9c78b54fdbdaf81f98f17f
2026-05-18 12:49:05 +00:00
React Native Bot 6b54fca2c0 [LOCAL] Bump Podfile.lock 2026-05-06 17:38:15 +00:00
React Native Bot 1382a5d9a8 Release 0.86.0-rc.0
#publish-packages-to-npm&next
2026-05-06 15:57:17 +00:00
Rob Hogan 031168013e Bump hermes-compiler dependency 2026-05-05 18:14:17 +01:00
Rob Hogan 89a2a20739 Bump hermes version 2026-05-05 18:10:07 +01:00
Kevin Gozali aadbe96579 Guard Scheduler deferred lambdas against delegate teardown (#56680)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56680

Scheduler::uiManagerDidFinishTransaction and Scheduler::uiManagerDidDispatchCommand queue lambdas via runtimeScheduler_->scheduleRenderingUpdate that capture the raw delegate_ pointer by value. With RuntimeScheduler_Modern (the bridgeless implementation), the lambda runs asynchronously, so if the SchedulerDelegate is destroyed between enqueue and execution (surface teardown, Scheduler destruction, or setDelegate flip), the lambda dereferences dangling memory → EXC_BAD_ACCESS / KERN_INVALID_ADDRESS.

Add a per-delegate-identity invalidation token (`shared_ptr<atomic<bool>>`) owned by Scheduler and captured by-value into the deferred lambdas. The destructor and setDelegate flip the flag to true; lambdas check it (acquire ordering) before dereferencing the captured raw delegate.

The shared_ptr keeps the atomic alive for any outstanding lambdas. Public API is unchanged (private member only), so C++ API snapshots are unaffected.

Changelog:
[General][Fixed] - Prevent Scheduler use-after-free crash when surfaces tear down with pending rendering updates

Reviewed By: mdvacca, Abbondanzo

Differential Revision: D103727974

fbshipit-source-id: 8abf5073b7fd35e88d65a91c42f311b238d8f156
2026-05-04 21:16:03 -07:00
Kevin Gozali d0672fb3a9 Add enableSchedulerDelegateInvalidation feature flag (#56678)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56678

Introduces a new common React Native feature flag, `enableSchedulerDelegateInvalidation`, that gates a defensive guard around `Scheduler::uiManagerDidDispatchCommand` and `uiManagerDidFinishTransaction`. Those call sites enqueue a lambda via `runtimeScheduler_->scheduleRenderingUpdate` that captures the raw `SchedulerDelegate` pointer by value. With `RuntimeScheduler_Modern` (bridgeless) the lambda runs asynchronously, so if the `SchedulerDelegate` is destroyed between enqueue and execution the lambda dereferences dangling memory and the process crashes (`EXC_BAD_ACCESS` / `KERN_INVALID_ADDRESS`). The follow-up commit adds the actual guard wired to this flag.

Defaults to `false` so behavior is unchanged on landing. Apps opt in by overriding the flag in their own `ReactNativeFeatureFlagsDefaults` subclass.

Includes the regenerated feature-flag boilerplate (Kotlin/Java/Cxx accessors, defaults, providers, JS spec, native module) emitted by `yarn featureflags --update`.

Changelog:
[Internal]

Reviewed By: shwanton

Differential Revision: D103757271

fbshipit-source-id: 85991de4a21e3946a25571b6488bee9c0a4e1caf
2026-05-04 21:16:03 -07:00
generatedunixname1389709262956747 52ff392596 folly::dynamic::push_back (dynamic.h) (#56676)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/56676

Reviewed By: tmikov

Differential Revision: D103664557

fbshipit-source-id: bcc53150cf357b025918b4dab9f19603284d602b
2026-05-04 16:27:53 -07:00
Zeya Peng a25e0fdddf Add test for synchronous mount props override behavior (#56663)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56663

## Changelog:

[Android] [Added] - Add test for synchronous mount props override behavior

___

overriding_review_checks_triggers_an_audit_and_retroactive_review
Oncall Short Name: react_native

Reviewed By: christophpurrer

Differential Revision: D103237771

fbshipit-source-id: 617b2dc5f0d9527910eb2b1fc4ec41f431b2e2f7
2026-05-04 13:49:08 -07:00
Christoph Purrer 52d87f92be Consolidate image prefetch flags into enableImagePrefetchingAndroid (#56610)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56610

Removes deprecated feature flags `enableImagePrefetchingJNIBatchingAndroid` and `enableImagePrefetchingOnUiThreadAndroid` by consolidating their behavior into `enableImagePrefetchingAndroid`.

The changes make image prefetch batching and UI thread dispatch the default behavior when `enableImagePrefetchingAndroid` is enabled. This simplifies the feature flag system and removes intermediate experimentation flags that are no longer needed.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D102428102

fbshipit-source-id: af7387e5a3144d7c425fc600a04b33e830d6e2e7
2026-05-01 19:49:50 -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 06b23b885c Use MutableIntObjectMap for SurfaceMountingManager view registry (#56646)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56646

Replace `ConcurrentHashMap<Int, ViewState>` with `MutableIntObjectMap<ViewState>` + `ReentrantReadWriteLock` in `SurfaceMountingManager`, behind the `useOptimizedViewRegistryOnAndroid` feature flag.

`ConcurrentHashMap<Int, ViewState>` boxes every `Int` key to `java.lang.Integer` (16 bytes) and allocates a `Node` object per entry (~32 bytes). `MutableIntObjectMap` from `androidx.collection` uses a Swiss Table layout with primitive `IntArray` keys — ~9 bytes/entry vs ~56-64 bytes, a ~6x reduction in map overhead. For a complex surface with 2000+ views, this saves ~90KB per surface in map overhead alone, plus reduced GC pressure from eliminating `Integer` boxing.

The `ReentrantReadWriteLock` replaces CHM's built-in concurrency. This matches the access pattern: reads from any thread (`getEventEmitter`, `enqueuePendingEvent`), writes almost exclusively from the UI thread. Readers never block each other. `stopSurface` snapshots entries under the write lock and processes `onViewStateDeleted` outside the lock to minimize reader blocking.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D102797904

fbshipit-source-id: c951fd31c9582f2196c3e09b0e41b8b29e889d85
2026-05-01 05:56:55 -07:00
Rubén Norte 3446958490 Honor skipBubbling in the new EventTarget-based event dispatch (#56666)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56666

The feature flag `enableNativeEventTargetEventDispatching` switches the React Native renderer from the legacy plugin-based event dispatch to a new W3C `EventTarget`-based dispatch in `dispatchNativeEvent.js`. The legacy path honors the `phasedRegistrationNames.skipBubbling` flag declared in view configs by short-circuiting the bubble traversal. The new path was unconditionally setting `bubbles: true` for any event with a `customBubblingEventTypes` entry, so `topPointerEnter` / `topPointerLeave` (the only events that declare `skipBubbling: true` today) ended up bubbling to all ancestors, breaking the W3C Pointer Events contract that `pointerenter` / `pointerleave` do not bubble.

Map `skipBubbling: true` to `bubbles: false` on the synthesized `LegacySyntheticEvent`. The existing `EventTarget.dispatch()` bubble loop already short-circuits when `event.bubbles` is `false` and `target !== eventTarget`, so the target's own bubble + capture handlers still fire — only ancestor bubble handlers are suppressed. Capture-phase listeners are unaffected.

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D103200424

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

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

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

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

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

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D103172778

fbshipit-source-id: 81bb5f18da6f46d07955956fb0b721f74cceca47
2026-04-30 15:26:55 -07:00
Kyle Howarth 90c2c595da Fix text wrapping in absolutely positioned elements on Android (#56651)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56651

## Context

On Android TV, text inside absolutely-positioned Views wraps unexpectedly when the computed width from Yoga is fractional. This manifests in Instagram TV as "Keep watching" breaking to two lines in the exit dialog when the button text is focused (rendered via an absolutely-positioned overlay for color animation).

The root cause is a rounding mismatch in React Native's Android `TextLayoutManager`: `desiredWidth` (the text's needed width) uses `ceil()` (rounds up), but `layoutWidth` in `EXACTLY` mode uses `floor()` (rounds down). When Yoga passes a fractional width (e.g. 258.5px), the container gets `floor(258.5) = 258px` but the text needs `ceil(258.3) = 259px`, causing a 1px shortfall that triggers wrapping.

## Fix

In `TextLayoutManager.createLayout()`, change `floor(width).toInt()` to `ceil(width).toInt()` for `YogaMeasureMode.EXACTLY` in **both** layout paths so the behavior is consistent regardless of which `Layout` class is chosen:

- BoringLayout (single-line text that fits)
- StaticLayout (multi-line or complex text)

`YogaMeasureMode.AT_MOST` is intentionally left as `floor(width).toInt()`. `AT_MOST` is a constraint contract from Yoga ("do not exceed this width"), so flooring remains the correct conservative behavior — ceiling there could violate the constraint by up to 1px.

The BoringLayout entry guard (`boring.width <= floor(width)`) is also left unchanged. If a boring text fails the guard, it falls through to the StaticLayout path, which now also ceils for `EXACTLY`, so no truncation results — the only effect is a slightly less optimal layout class choice in a narrow edge case.

## Why ceiling `EXACTLY` is safe

`EXACTLY` means Yoga has guaranteed this width — the container has been allocated at least the full fractional width upstream. Ceiling the local layout width by 1px cannot exceed what Yoga has reserved, while flooring it produced a 1px shortfall that mismatched `desiredWidth`'s ceiling and triggered wrapping.

The compensating mechanism in `calculateWidth()` — which returns the raw fractional width to Yoga for `EXACTLY` mode rather than the floored `layout.width` — is preserved, so Yoga's upstream allocation reasoning is unchanged. This was the subpixel-safety property introduced in D74685353; only the local pixel rounding inside `createLayout` changes from "round down 1px and risk wrapping" to "round up 1px and match `desiredWidth`".

## Testing

Added a new test case to cover this behavior. If this needs to be adjusted in the future, a failure will highlight this bug and ensure it's covered or mitigated with additional test cases.

## Notes

This was confirmed as a problem with an absolutely positioned style with `left:0, right:0` applied. Width sizing was confirmed to be the issue when `left:-1, right:-1` resolved the issue. Further investigation found this fix in text sizing.

Only `EXACTLY` is needed to fix the observed Instagram TV bug. `AT_MOST` is left untouched because the constraint semantics differ.

## Changelog: [Android] [Fixed] - Fix 1px text wrapping in absolutely positioned elements caused by fractional Yoga widths

Reviewed By: Abbondanzo

Differential Revision: D102920508

fbshipit-source-id: 05fad96333a282ad274a5686af3a0d30e6a712f2
2026-04-30 12:01:01 -07:00
jingjing2222 eba0bfb2c8 Enable overrideBySynchronousMountPropsAtMountingAndroid by default on Android (#56652)
Summary:
Enable `overrideBySynchronousMountPropsAtMountingAndroid` by default on Android.

This flag was added to prevent regular Fabric mount updates from overriding newer props that were already applied synchronously by Native Animated direct manipulation. Without this path enabled, Android can still hit a race where:

1. Native Animated applies `transform` props synchronously on the UI thread.
2. A regular Fabric mount update for the same view is already in flight with older props.
3. That regular mount update reaches `SurfaceMountingManager.updateProps()` later and overwrites the newer synchronous animated value.
4. The view visibly jumps/flickers during the animation.

This is not just theoretical. I spent about a week debugging this from a real Android flickering issue, and the final repro is intentionally very small. The visual impact is clear in the README videos, and I am attaching the same videos here as well.

Minimal repro:
https://github.com/jingjing2222/fix-react-native-android-flickering

The repro uses React Native 0.85.2 with Android Fabric. The JS only runs `Animated.timing(..., {useNativeDriver: true})` for `translateX` and `translateY`.

## As-is

https://github.com/user-attachments/assets/64882c09-1580-4209-a4aa-aa62bcf58287

With the current default, flickering is visible during the animation.

## To-be

https://github.com/user-attachments/assets/fa929562-36b3-4930-98b5-754098e571e3

With `overrideBySynchronousMountPropsAtMountingAndroid` enabled, the flickering is gone.

The existing mounting-layer flag fixes this by storing the latest synchronous mount props and reapplying them when regular mount props are processed. This makes the final mounted props preserve the latest Native Animated direct manipulation value.

Because this can happen with a simple native-driver transform animation, enabling this default should prevent other Android users from spending time debugging the same race condition.

### Why Android only?

iOS Fabric already tracks props managed by NativeAnimated on the component view. When NativeAnimated synchronously updates props such as `transform` or `opacity`, iOS records those prop keys and prevents later normal Fabric updates from re-applying stale values for those props.

Android Fabric has a similar mechanism through `tagToSynchronousMountProps`, but it was gated behind `overrideBySynchronousMountPropsAtMountingAndroid`, which defaults to false. Therefore, NativeAnimated could synchronously apply the final transform to the view, and a later normal Fabric props update could re-apply stale transform props, causing a transient flicker.

This change makes Android preserve synchronously mounted NativeAnimated props across later Fabric prop updates, matching the ownership behavior already present on iOS.

## Changelog:

[ANDROID] [FIXED] - Prevent stale Fabric mount updates from overriding newer Native Animated synchronous prop updates.

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

Test Plan:
- Ran `yarn featureflags --update`
- Ran `git diff --check`
- Verified generated feature flag defaults were updated for Android, C++, and JS.
- Verified the minimal repro with the README videos attached above:
  - as-is/current default: flickering is visible during `translateX`/`translateY` native-driver animation
  - to-be/flag enabled: flickering is not visible

Reviewed By: javache, sammy-SC

Differential Revision: D103070058

Pulled By: zeyap

fbshipit-source-id: c5f140ee28ec090677b0cc1b1ad9db35c79aba8d
2026-04-30 11:51:01 -07:00
Kevin Gozali 6ec459735d Fix LayoutAnimation crash from mutation sort ordering (#56629)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56629

`LayoutAnimationDriver::animationMutationsForFrame` was sorting animation-frame Update mutations together with structural mutations (Remove/Insert/Delete) from completed animations. Animation-frame Updates reference views by their pre-structural-change parentTag. When `std::stable_sort` reordered these Updates after Remove/Insert pairs that reparented a view, `StubViewTree::mutate` hit a parentTag mismatch assertion (`react_native_assert(oldStubView->parentTag == mutation.parentTag)`) and crashed with SIGABRT.

The fix records the boundary between animation-frame Updates and final structural mutations, then only sorts the structural portion. This preserves the invariant that animation-frame Updates execute before any structural changes.

Per zeyap's review: simplified to just the LayoutAnimationDriver.cpp change. The earlier MutationComparator (`Update < Insert`) tweak and the `TEST_F` + feature-flag test refactor were dropped — the driver-side fix alone unbreaks the failing test.

Changelog: [Internal]

Reviewed By: zeyap

Differential Revision: D102696875

fbshipit-source-id: abaac2ae6dae44f7df1f4088bb8ec19b055c2b1a
2026-04-30 10:48:33 -07:00
Rubén Norte a3906b629c Expand globals test coverage in setUpDefaultReactNativeEnvironment-Globals-itest.js (#56661)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56661

Expand the Fantom integration test for `setUpDefaultReactNativeEnvironment` globals so it covers the full set of globals that React Native's default environment is expected to install, not just the global-object aliases and `__DEV__`/`NODE_ENV`.

Reorganized the existing tests into nested `describe` blocks (`global object`, `environment`, `JavaScript language features`, `Web APIs`) and added coverage for:
- DOM: `Node`, `Document`, `CharacterData`, `Text`, `Element`, `HTMLElement`, `HTMLCollection`, `NodeList`.
- Geometry: `DOMRect`, `DOMRectReadOnly`, `DOMRectList`.
- Events: `Event`, `EventTarget`, `CustomEvent`.
- Performance: `performance`, `Performance`, `PerformanceEntry`, `PerformanceMark`, `PerformanceMeasure`, `PerformanceObserver`, `PerformanceObserverEntryList`, `PerformanceEventTiming`, `PerformanceLongTaskTiming`, `PerformanceResourceTiming`, `EventCounts`, `TaskAttributionTiming`.
- Timers and microtasks: `setTimeout`/`clearTimeout`, `setInterval`/`clearInterval`, `setImmediate`/`clearImmediate`, `requestAnimationFrame`/`cancelAnimationFrame`, `requestIdleCallback`/`cancelIdleCallback`, `queueMicrotask`.
- Networking: `XMLHttpRequest`, `FormData`, `fetch`, `Headers`, `Request`, `Response`, `WebSocket`, `AbortController`, `AbortSignal`, `URL`, `URLSearchParams`.
- File: `Blob`, `File`, and a presence-only check for `FileReader` (accessing the lazy getter triggers a native module that isn't available in the Fantom environment, so we assert the property is registered on `globalThis` without reading it).
- JavaScript language features: `Promise`.
- Other: `alert`, `navigator`.

`PerformanceObserverEntryList` and `EventCounts` aren't recognized as globals by Flow in this file, so they're declared via `declare var ... : unknown` at the top of the file and the assertion checks `typeof`.

Changelog: [Internal]

___

overriding_review_checks_triggers_an_audit_and_retroactive_review
Oncall Short Name: react_native_iroc

landed-with-radar-review

Differential Revision: D103224423

fbshipit-source-id: 561687eb5c4b489d3beea0d83fc544d5ac9363d4
2026-04-30 10:20:25 -07:00
Shubham Kumar Savita 32d3eafdc4 Add exponential backoff to InspectorPackagerConnection reconnect and exception handling to connect (#56650)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56650

## Summary

Fix occasional SIGSEGV in `operator new` during `InspectorPackagerConnection::connectWebSocket()`.

### Root Cause

The `InspectorPackagerConnection` reconnection loop retries every 2 seconds with no backoff or limit. When no Metro dev server is reachable, this results in hundreds of failed WebSocket connection attempts over the app lifetime. Each attempt allocates and deallocates C++ hybrid objects, JNI references, and OkHttp WebSocket instances. This accumulated churn leads to heap fragmentation and eventual heap metadata corruption, manifesting as SIGSEGV in `operator new` when the allocator follows corrupted internal pointers.

Additionally, the `connect()` method had no exception handling around the `connectWebSocket()` call, meaning any JNI/Java exception would propagate uncaught.

### Changes

1. **Exponential backoff in `reconnect()`**: Start at 2s, double each retry, cap at 120s. This reduces reconnection attempts from ~500 in 17 minutes to ~15, drastically reducing resource churn.
2. **Try-catch in `connect()`**: Catch exceptions from `connectWebSocket()` (e.g., fbjni/JNI exceptions) and gracefully trigger a reconnect instead of crashing.
3. **Reset backoff on success**: When `didOpen()` fires (successful connection), reset the delay back to 2s and clear `suppressConnectionErrors_`.

## Changelog:
[General][Fixed] - Add exponential backoff and exception handling to InspectorPackagerConnection reconnect loop to prevent heap fragmentation crashes

Reviewed By: cipolleschi

Differential Revision: D100956687

fbshipit-source-id: 235dc0f65f1a4083acf52be4348f4932bb739d33
2026-04-29 18:11:39 -07:00
Ingrid Wang 795d902270 Fix unreachable-code-break (#56648)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56648

Changelog:

[iOS][Fixed] - Fixing unreachable-code-break

Reviewed By: fkgozali

Differential Revision: D102855020

fbshipit-source-id: 9f57faa06ee4101da875ec06b7d1e6e37f2de98e
2026-04-29 09:59:25 -07:00
Mathieu Acthernoene ef598d9b5a Add tests for DeviceInfoModule.getWindowDisplayMetrics edge-to-edge branches (#56632)
Summary:
This PR adds two focused unit tests for `DeviceInfoModule.getWindowDisplayMetrics()` that attach a mocked `Activity`, swap in a fake `WindowMetricsCalculator` via `WindowMetricsCalculator.overrideDecorator()` and verify both branches of `isEdgeToEdgeFeatureFlagOn`:

- edge-to-edge on -> `WindowMetrics.bounds` are used directly.
- edge-to-edge off -> bounds minus `systemBars | displayCutout` insets.

To make this testable without reflection or `SuppressLint("RestrictedApi")` outside the production code, three small visibility tweaks:

- `DeviceInfoModule.getWindowDisplayMetrics()` and `getDisplayMetricsWritableMap()`: `private` → `internal` + `VisibleForTesting`
- `WindowUtilKt.isEdgeToEdgeFeatureFlagOn` setter: `private set` → `VisibleForTesting internal set`

## Changelog:

[INTERNAL] [ADDED] - Add unit tests for `DeviceInfoModule.getWindowDisplayMetrics` covering both edge-to-edge branches

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

Test Plan:
```
./gradlew :packages:react-native:ReactAndroid:testDebugUnitTest \
  --tests com.facebook.react.modules.deviceinfo.DeviceInfoModuleTest
```

Reviewed By: javache

Differential Revision: D102801090

Pulled By: alanleedev

fbshipit-source-id: 5e103404ef822d782c87117d77916221c512eaa2
2026-04-29 09:30:53 -07:00
Moti Zilberman 7128482e49 Bump Metro to ^0.84.3 (#56638)
Summary:
Bumps Metro dependency from `^0.84.2` to `^0.84.3` across all packages.

Metro 0.84.3 adds `changeId` to HMR `update-done` messages, which is required by the `unstable_fastRefreshComplete` CDP event and the Fast Refresh performance marker to deduplicate events across multiple updates for the same file change.

## Changelog:

[Internal]

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

Test Plan:
- CI

cc huntie

Reviewed By: cortinico

Differential Revision: D102810175

Pulled By: motiz88

fbshipit-source-id: b05bc522fd7815f2858ce645b03bdea86a8027ea
2026-04-28 22:50:41 -07:00
Moti Zilberman 78a740d40a Add redbox subspec to React-debug pod (#56585)
Summary:
Same fix as https://github.com/facebook/react-native/issues/56584 (targeting 0.83-stable), applied to main.

Add a `redbox` subspec to `React-debug.podspec` with its own `header_dir`, following the same pattern `React-Fabric` uses for its subdirectories.

Without this, static library builds (without `USE_FRAMEWORKS`) flatten all headers into the top-level `header_dir` (`react/debug`), so imports like `<react/debug/redbox/RedBoxErrorParser.h>` fail because the `redbox/` subdirectory is lost.

On main this is currently masked because `test_e2e_ios_templateapp` uses prebuilt `React.framework`, but it would break any from-source static library build that includes `React-CoreModules`.

Changelog: [Internal]

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

Test Plan: CI

Reviewed By: cortinico

Differential Revision: D102809818

Pulled By: motiz88

fbshipit-source-id: 9871706a8e028c27f64f4d0dd9942d7c408c6b3b
2026-04-28 10:40:37 -07:00
Peter Abbondanzo 59ac1db76e Mark FPS listener in ScrollViews as final, avoid reset in initView (#56609)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56609

`mFpsListener` is injected via `ReactHorizontalScrollView`'s constructor and should live for the lifetime of the view. However, it was declared as a mutable field and nulled in `initView()`, which is called both during construction and when the view is recycled in a virtualized list. After recycling, `isScrollPerfLoggingEnabled()` returned false because `mFpsListener` was null, silently disabling FPS performance tracking for the rest of that view instance's lifecycle.

The fix moves `mFpsListener` to a `final` field initialized in the constructor, and removes the `mFpsListener = null` assignment from `initView()`. Applied to `ReactScrollView`, `ReactHorizontalScrollView`, and `ReactNestedScrollView`.

This is a safe change because both view managers are instantiated with a single instance of FPS listener, so recycled view instances will always reference the same FPS listener instance.

Changelog:
[Android][Fixed] - Fix FPS performance listener being cleared on ScrollView recycle

Reviewed By: jehartzog

Differential Revision: D102359747

fbshipit-source-id: 2707e2d853620ff6980c68edaf9d11354b0825be
2026-04-28 10:27:59 -07:00
Kevin Gozali 6a17c21fa2 Delete obsolete MountingIntermediateCommits-itest.js (#56628)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56628

This test file contains a single `it.skip` test guarded by the comment "Enable once synchronous C++ state updates are re-introduced." That feature was deleted entirely (not just disabled) since 2025-07-15, with the reason: *"The current design of enableSynchronousStateUpdates is not correct and breaks `<Modal />` on Android. let's delete it.

Findings: A scan of `packages/react-native/src/private/featureflags`, `scripts/featureflags`, and `ReactCommon/react/featureflags` returns no replacement flag for synchronous C++ state updates. The `enableSynchronousStateUpdates` flag was removed from every layer (JS config, C++, Android Kotlin/JNI, iOS overrides, MC schemas) and the guarded code path in `EventQueue.cpp` was deleted as well.

Empirical confirmation: Removed the `it.skip` and ran the test 10x via stress runs. All 10 runs failed deterministically. The test is asserting the *presence* of the bug — i.e., that an intermediate state mutation leaks through when a UI-thread commit pulls transactions from an in-flight JS commit. Without the synchronous-state-updates codepath, that leak no longer occurs, so the test's expected log never matches the actual output:

  Expected: [Update ScrollView, Update intermediate-state-should-not-be-visible, Update view]
  Actual:   [Update view, Update ScrollView]

The test cannot be un-skipped (the bug it documents is no longer reproducible), and rewriting the assertion would defeat the purpose of the test. Deleting it.

Changelog: [Internal]

Reviewed By: pixelfreak

Differential Revision: D102661539

fbshipit-source-id: fca5d552a80cad572ac43047ff6709403de294f1
2026-04-28 09:15:21 -07:00
Rubén Norte 2a5c4b312a Improve typing of renderApplication (#56636)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56636

General typing improvements to the `renderApplication` module:

- Refactors `renderApplication` to take a single options object instead
  of positional arguments, and removes the unused `fabric` and `_unused`
  parameters. The `fabric` parameter was already always treated as
  `true` internally, and the `_unused` slot was a reserved positional
  placeholder for a removed `scopedPerformanceLogger` argument.
- Migrates the file to `flow strict-local`.
- Types `RootComponent` and `WrapperComponent` using component syntax
  instead of `React.ComponentType`.
- Replaces `rootTag: any` with `number | RootTag`, normalizing via the
  existing `createRootTag` helper for `<AppContainer>` and `Number()`
  for `Renderer.renderElement`.
- Simplifies `ActivityType` (drops the unnecessary spread) and tightens
  null/boolean checks (`debugName != null`, `useOffscreen === true`).

Exports a new `RenderApplicationOptions<Props>` type and updates all
internal callers accordingly.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D102325691

fbshipit-source-id: 9b4f0b16d8508f6eee33c2e6cb8d5b7157c0742a
2026-04-28 06:13:11 -07:00
Rubén Norte 6a59fc9e3c Add tests for event dispatching bubbling to document and documentElement (#56633)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56633

Changelog: [internal]

TSIA

Reviewed By: javache

Differential Revision: D102604056

fbshipit-source-id: 4d965a04b7f3d99a15bf11c8fa9f448425f63e6d
2026-04-28 04:55:26 -07:00
qflen 1e8e182410 fix(hit-testing): ignore views with non-invertible transforms (scale 0) (#56586)
Summary:
Fixes https://github.com/facebook/react-native/issues/50797. A view with a non-invertible transform (e.g. `transform: [{scaleY: 0}]` or `{scaleX: 0}`) still received touches on both Android and iOS. On Android the view appeared to "inherit" a hit region from another view in the hierarchy; on iOS the view registered taps along the collapsed axis. Both symptoms collapse to the same native behaviour: when a transform can't be inverted, the platform APIs silently fall back to stale or degenerate data during hit testing.

### Root cause

**Android.** `TouchTargetHelper.getChildPoint` calls `Matrix.invert(inverseMatrix)` without checking its return value. `Matrix.invert` returns `false` for a non-invertible matrix and **leaves its destination unchanged**. `inverseMatrix` is a class-level field reused across every child-point conversion, so on failure we apply *the previous view's* inverse to the current view's touch point: the exact "inherits from another view" behavior. It is also why shrinking a view from `scaleY: 0.9` to `0.0` leaves a 90 % hit region: the 0.9 frame populated the cache.

**iOS.** `CGAffineTransformInvert` is documented to return the original matrix when it can't invert. `-[UIView convertPoint:fromView:]` uses that "inverse" during hit testing, so the touch point gets collapsed onto the degenerate axis (e.g. y = 0 for `scaleY: 0`) and the inherited `pointInside:` still reports a hit against a visually invisible view.

### Fix

- **Android** (`TouchTargetHelper.kt`): `getChildPoint` now returns `Boolean`. It returns `false` when `Matrix.invert` fails; the child iteration loop skips such children. One behaviour change, no epsilon tuning, no shared state leaks. Resolves both symptom variants via the same code path.
- **iOS** (`RCTViewComponentView.mm`, Fabric): add a small `RCTLayerTransformCollapsesAxis` helper that tests the determinant of the 2 × 2 XY projection of `layer.transform` and return `NO` from the existing `pointInside:` override when it collapses.
- **Tests.** `TouchTargetHelperTest` (new, Robolectric): initial `scaleX`/`scaleY: 0`, zero-scale parent, the "inherits from sibling" regression, the 0.9 to 0.0 transition, and the touch-path accumulator. `RCTViewComponentViewTests` gets four parallel iOS cases. All pass locally.
- **RNTester.** New Transforms entry "Zero-scale hit test (regression for https://github.com/facebook/react-native/issues/50797)". Reproduces both variants and exposes a scale input so you can step through the transition interactively.

### Why not https://github.com/facebook/react-native/issues/53769?

PR https://github.com/facebook/react-native/issues/53769 solved the Android side with a `hasZeroScale(view)` early-return plus an epsilon comparison on individual matrix entries, and handled the `invert` failure in `getChildPoint` by *falling back to untransformed coordinates*. That still lets the degenerate view be hit with its pre-transform bounds; the early-return then has to catch the miss. This branch fixes the root cause once: if the matrix can't be inverted we don't descend into the child. The iOS fix is the matching change on the Fabric side.

## Changelog:

[GENERAL] [FIXED] - Views with a non-invertible transform (e.g. `scaleX: 0` or `scaleY: 0`) no longer receive touches on Android or iOS.

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

Test Plan:
### Unit tests

- `./gradlew :packages:react-native:ReactAndroid:testDebugUnitTest --tests 'com.facebook.react.uimanager.TouchTargetHelperTest*'`: 7/7 pass.
- iOS build-for-testing of `RNTesterUnitTests` scheme succeeds; the four new `RCTViewComponentViewTests` cases live next to the existing cases in `React/Tests/Mounting/`.
- `./gradlew ktfmtCheck`, `clang-format --dry-run -Werror`, `prettier --check`, `flow`, and `eslint` all pass.

### Manual verification (Android)

RNTester → Components → Transforms → "Zero-scale hit test (regression for https://github.com/facebook/react-native/issues/50797)".

**Variant 1: tap the `scaleY: 0` row directly.** "Last tapped:" must stay `(none)`.

| Before | After |
| --- | --- |
| <img src="https://raw.githubusercontent.com/qflen/react-native/6f3799dbb597630a91f43e460437d636796dbbe7/assets/50797/before-tap-zero-scale.png" width="260"> | <img src="https://raw.githubusercontent.com/qflen/react-native/6f3799dbb597630a91f43e460437d636796dbbe7/assets/50797/after-tap-zero-scale.png" width="260"> |
| `Last tapped: zero-scale` (bug) | `Last tapped: (none)` |

**Variant 2: tap the `scaleY: 0.5` row (①), then tap the `scaleY: 0` row (②).** Without the fix, the shared `inverseMatrix` cache populated by tap ① leaks into the zero-scale hit test on tap ②. After the fix, tap ② is correctly ignored and "Last tapped" still reflects tap ①.

| Before | After |
| --- | --- |
| <img src="https://raw.githubusercontent.com/qflen/react-native/6f3799dbb597630a91f43e460437d636796dbbe7/assets/50797/before-tap-zero-after-05.png" width="260"> | <img src="https://raw.githubusercontent.com/qflen/react-native/6f3799dbb597630a91f43e460437d636796dbbe7/assets/50797/after-tap-zero-after-05.png" width="260"> |
| `Last tapped: zero-scale` (stale cache) | `Last tapped: variable (scaleY=0.5)` |

iOS behaves similarly. I tried the example on iPhone 17 Pro (Simulator, iOS 26.1) and the zero-scale pressable is correctly untouchable; driving synthetic taps on the simulator wasn't scripted here, so the iOS signal is the four XCTest cases plus manual verification.

Reviewed By: fabriziocucci

Differential Revision: D102590386

Pulled By: javache

fbshipit-source-id: 863a653f17db72ff85135fd8eb344ccd1528eda7
2026-04-28 03:33:59 -07:00
Shubham Kumar Savita 0c153e2971 Handle OutOfMemoryError in NetworkingModule response processing (#56630)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56630

Catch `OutOfMemoryError` in the `onResponse` callback's response processing try-catch block in `NetworkingModule.kt`. Previously, only `IOException` was caught — `OutOfMemoryError` (which extends `Error`, not `Exception`) would propagate uncaught and crash the app.

When the Java heap is near its limit (e.g., 256MB with <1% free), any allocation during response processing (buffer creation in `readWithProgress`, `responseBody.bytes()`, `responseBody.string()`) can trigger OOM. The fix converts this to a network request error event sent to JS, allowing the app to handle the failure gracefully (retry, show error message) instead of crashing.

**Crash:** `android_crash:java.lang.OutOfMemoryError:com.oculus.igvr`
**MID:** `024a57cfb70eef9a61af42d845c981a1` — 246 crashes in 7 days
**Task:** T212267841

Logview link: [024a57cfb70eef9a61af42d845c981a1](https://www.internalfb.com/logview/system_vros_crashes/024a57cfb70eef9a61af42d845c981a1)
Changelog: [Android][Fixed] - Catch OutOfMemoryError in NetworkingModule response processing to prevent app crashes

Reviewed By: cortinico

Differential Revision: D102236869

fbshipit-source-id: de6624640b3f2343ca8e516fe7677eecae23a932
2026-04-27 23:21:43 -07:00
Zeya Peng c20a58ab6b make sure view width and height are non 0 before calling createBitmap() (#56627)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56627

## Changelog:

[Android] [Fixed] - make sure view width and height are non 0 before calling createBitmap()

Reviewed By: Abbondanzo

Differential Revision: D102657602

fbshipit-source-id: 5e93e110af0e5a795e23c0006a9833934c5e5985
2026-04-27 16:57:21 -07:00
Mathieu Acthernoene 44a4b1ba5d Fix Dimensions window values on Android < 15 (#53254)
Summary:
This PR (initially created for edge-to-edge opt-in support, rebased multiple times) fixes the `Dimensions` API `window` values on Android < 15, when edge-to-edge is enabled.

Currently the window height doesn't include the status and navigation bar heights (but it does on Android >= 15):

<img width="300" alt="Screenshot 2025-06-27 at 16 23 02" src="https://github.com/user-attachments/assets/c7d11334-9298-4f7f-a75c-590df8cc2d8a" />

Using `WindowMetricsCalculator` from AndroidX:

<img width="300" alt="Screenshot 2025-06-27 at 16 34 01" src="https://github.com/user-attachments/assets/7a4e3dc7-a83b-421b-8f6d-fd1344f5fe81" />

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

## Changelog:

[Android] [Fixed] Fix `Dimensions` `window` values on Android < 15 when edge-to-edge is enabled

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

Test Plan: Run the example app on an Android < 15 device.

Reviewed By: javache

Differential Revision: D80237818

Pulled By: alanleedev

fbshipit-source-id: f05e546cd38c7bd539b86d30fe7b663715a34a99
2026-04-27 10:00:41 -07:00
Peter Abbondanzo e0a453c603 Dispatch FPS events from ACTION_SCROLL events (#56601)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56601

`ACTION_SCROLL` events (mouse wheel, trackpad, joystick) were not participating in FPS performance logging. Touch-driven scrolls already called `enableFpsListener`/`disableFpsListener` through `handlePostTouchScrolling`, which uses a stable-frames heuristic to detect when scrolling has settled (3 consecutive frames with no position change). ACTION_SCROLL events bypassed this entirely.

This adds FPS listener support to the `ACTION_SCROLL` path by calling `enableFpsListener` when a scroll event arrives, then delegating to `handlePostTouchScrolling` for lifecycle management:

- **Snapping ScrollViews (`ReactScrollView`, `ReactHorizontalScrollView`):** The existing debounce runnable calls `flingAndSnap` to animate to a snap point. After the snap, `handlePostTouchScrolling` monitors the animation via the stable-frames mechanism and disables the FPS listener once settled.
- **Non-snapping ScrollViews (`ReactScrollView`):** `handlePostTouchScrolling` is called directly. Its re-entry guard (`mPostTouchRunnable != null`) naturally deduplicates across rapid scroll events, while `onScrollChanged` keeps the monitor alive by setting `mActivelyScrolling`.

Also nulls `mPostTouchRunnable` before reassignment in the debounce cancel path to avoid stale references.

Changelog:
[Android][Fixed] - Dispatch FPS performance events for mouse wheel and trackpad scroll interactions in ScrollView

Reviewed By: javache, jehartzog

Differential Revision: D102347043

fbshipit-source-id: aab91858404db54b1c44146d4d071193baaae7a1
2026-04-27 09:01:01 -07:00
Zeya Peng 610564cf45 Fix PixelCopy snapshot for partially off-screen views (#56608)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56608

## Changelog:

[Internal] [Fixed] - Fix PixelCopy snapshot for partially off-screen

PixelCopy captures only the visible portion of the window surface.
When a view is partially off-screen, the capture rect extends beyond
the window bounds, resulting in a bitmap where only the visible
region has content. This partial bitmap then gets stretched to fill
the full-size pseudo-element, causing visual distortion.

Fix by clamping the PixelCopy rect to the window bounds and
compositing the clamped capture into a full-size bitmap at the
correct offset. The off-screen portions remain transparent instead
of being stretched.

If the view is entirely off-screen, skip capture entirely — the
pseudo-element will have no snapshot applied (didMountItems skips
tags without a captured bitmap).

Reviewed By: javache

Differential Revision: D102360642

fbshipit-source-id: 6da9ddce0eef4bac011f25494a6d916c8311058e
2026-04-27 08:34:24 -07:00
Rubén Norte 0f58e5e1db Back out "Revert D102166537: [RN] Hoist PerformanceLogger primitives out of react-native" (#56621)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56621

Changelog: [General][Deprecated] Deprecated second argument for hook function passed to AppRegistry.setComponentProviderInstrumentationHook as it's not usable by apps. Passed stub that warns when used.

Re-applying https://github.com/facebook/react-native/pull/56580 that was reverted.

Reviewed By: javache

Differential Revision: D102593753

fbshipit-source-id: 7714260a494a62d55880f10887cd440d217a4672
2026-04-27 07:02:13 -07:00
Fabrizio Cucci 2c208f8c5c Override getClipBounds to expose overflow clipping to the framework (#56606)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56606

Override `getClipBounds()` on ReactViewGroup to return the padding box rect when
`overflow` is hidden or scroll, gated behind the `syncAndroidClipBoundsWithOverflow`
feature flag.

This exposes the view's clipping behavior to the Android framework via the standard
`View.getClipBounds()` API:
- `getClipBounds(Rect): Boolean` returns `true` and populates the rect with the
  padding box when overflow is hidden/scroll, or `false` when overflow is visible
- `getClipBounds(): Rect?` returns the padding box rect or `null` respectively

This allows framework-level systems to inspect a view and determine whether it clips
its children by checking `getClipBounds() != null`, and to obtain the actual clipping
region for `getGlobalVisibleRect()` calculations.

## Why not `setClipBounds()`?

An alternative approach would be to call `View.setClipBounds(Rect)` which sets the
`mClipBounds` field directly. This has the advantage of being picked up by AOSP's
`ViewGroup.getChildVisibleRect()` (which reads `mClipBounds` via direct field access
rather than calling `getClipBounds()`). However, `setClipBounds()` also propagates
the clip rect to the RenderNode via `mRenderNode.setClipRect()`, which clips the
view's own rendering — including its borders. It also requires maintaining a Rect
that must be kept in sync across size changes, border width changes, and overflow
changes.

For now, the `getClipBounds()` override is sufficient because harvesting systems
query the method rather than the field. If we find that AOSP's field-based path is
also needed, we can switch to `setClipBounds()` in the future.

Adds `BackgroundStyleApplicator.getPaddingBoxRect()` (internal via buck friend_paths)
which computes the padding box (view bounds minus border insets) reusing the same
border inset resolution logic as `clipToPaddingBox()`.

Changelog: [Internal]

Reviewed By: twasilczyk, javache

Differential Revision: D102353840

fbshipit-source-id: fe1d52e3c000ba1b5e2d21eac75928be24a86645
2026-04-27 06:33:23 -07:00
Fabrizio Cucci 497d9c1615 Add syncAndroidClipBoundsWithOverflow feature flag
Summary:
Add a new feature flag to gate overriding getClipBounds on Android views to return
the padding box when overflow is hidden. This communicates the view's clipping
region to the Android framework for correct getGlobalVisibleRect calculations
(T253147322, T263753590).

Changelog: [Internal]

Reviewed By: twasilczyk

Differential Revision: D102353841

fbshipit-source-id: d5f9c5428c342061c0d45bfcc000db356048f930
2026-04-27 06:33:23 -07:00