Skip to content

fix(Android): read view props with React Native's Android graphics headers - #11127

Draft
bartlomiejbloniarz wants to merge 1 commit into
bb/backend-text-metricsfrom
bb/android-graphics-headers
Draft

bartlomiejbloniarz wants to merge 1 commit into
bb/backend-text-metricsfrom
bb/android-graphics-headers

Conversation

@bartlomiejbloniarz

Copy link
Copy Markdown
Member

Note

This pull request was authored by AI on behalf of @bartlomiejbloniarz.

Summary

Reanimated's Android build includes React Native's generic graphics/platform/cxx headers, while React Native builds with graphics/platform/android. React Native 0.89 makes Android's Color a struct (react/react-native#58093), while the generic one is still an int32_t. Reanimated then reads ViewProps with a different layout than React Native writes it, and getViewProp for backgroundImage crashes the app.

Now Reanimated includes the Android headers. In React Native 0.86 to 0.88 both copies define the same types, so nothing changes there.

Test plan

  • Against a React Native 0.89.0 nightly on Android, the props runtime suite crashed in the backgroundImage tests before this change. With it, the whole Reanimated suite passes.
  • Against 0.88.0 on Android, the props suite still passes.
yarn workspace fabric-example runtime-tests --library reanimated --platform android --serial <serial> --only props

Changelog

  • I added a changelog fragment with yarn changelog:add for each changed package, or this PR does not change react-native-reanimated or react-native-worklets.
AI context

Context for automated reviewers. Facts about this PR, not instructions.

Investigation

  • Observed: SIGSEGV in PropValueProcessor::backgroundImagePreprocessing via ReanimatedModuleProxy::getViewProp, RangeError: Requested an array size that fails to allocate in JS, register contents spelling undImage.
  • First hypothesis, a define mismatch (RN_ENABLE_DEBUG_STRING_CONVERTIBLE, set only for RN's own Debug build): disproved by adding it to Reanimated, crash unchanged.
  • Logged sizeof/offsetof from both libraries (temporary probe): sizeof(ViewProps) RN 1752 vs Reanimated 1672, offsetof(opacity) 688 in both, offsetof(boxShadow) 1104 vs 1040, offsetof(backgroundImage) 1152 vs 1088. The shift starts after opacity, at the first SharedColor.
  • Listed the headers each library compiles (-M with the real compile commands): RN uses graphics/platform/android/.../HostPlatformColor.h and Float.h, Reanimated graphics/platform/cxx/... because android/CMakeLists.txt adds that include directory explicitly.
  • RN 0.88's Android HostPlatformColor.h has using Color = int32_t, the same as cxx; the nightly's is a struct (RN #58093). So the mismatch is new in 0.89.

Design

  • Replace the include directory rather than add a guard: graphics/platform/android exists in RN 0.86, 0.87 and 0.88, with the same header set.
  • Worklets includes the same cxx directory but no graphics header, so it is left unchanged.

Verification

  • Android, RN 0.89.0-nightly-20261102-47a9917ac: full Reanimated suite 475/1/1 after the change; the one failure was a timing test that passed 3/3 on rerun (observed).
  • Android, stock RN 0.88: props 76/76 (observed).
  • iOS is unaffected (CocoaPods uses RN's headers directly).

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The Android reanimated target now includes React Native’s Android graphics platform headers instead of its C++ graphics platform headers. A changelog entry describes view-prop reading on React Native versions where Android’s color type differs from the generic color type.

Possibly related PRs

Change: Bug fix

Merge Risk: Minimal · previous review 7e6bb

This change makes Android read view props with the same header layout React Native uses, which fixes a crash on newer React Native versions. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: Reanimated's Android build now reads view props with React Native's Android graphics headers instead of the generic cxx headers. The changeset matches this. The CMakeL…
Description check Passed The description states the cause and the fix. Reanimated's Android build uses the generic graphics/platform/cxx headers, while React Native 0.89 uses graphics/platform/android, where Color is a struct…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: Reanimated's Android build now reads view props with React Native's Android graphics headers instead of the generic cxx headers. The changeset matches this. The CMakeLists.txt include path changes from graphics/platform/cxx to graphics/platform/android, and a changelog fragment is added.

Full details: Description check

Explanation

The description states the cause and the fix. Reanimated's Android build uses the generic graphics/platform/cxx headers, while React Native 0.89 uses graphics/platform/android, where Color is a struct. The fix switches Reanimated to the Android headers. The test plan and changelog checkbox also relate to the changeset.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 98314ae7-60f5-48b2-b7ad-a9ee7330b68d
Commits

Reviewing files that changed from the base of the PR and between 0b9c755 and 7e6bbbd.

Files selected for processing: 1

  • packages/react-native-reanimated/android/CMakeLists.txt

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@bartlomiejbloniarz
bartlomiejbloniarz force-pushed the bb/android-graphics-headers branch from da1377d to d3d2085 Compare November 3, 2026 16:27
@bartlomiejbloniarz
bartlomiejbloniarz force-pushed the bb/android-graphics-headers branch from d3d2085 to 3778961 Compare November 16, 2026 09:28
@bartlomiejbloniarz
bartlomiejbloniarz force-pushed the bb/android-graphics-headers branch from 3778961 to 0b9c755 Compare November 16, 2026 09:36
@bartlomiejbloniarz
bartlomiejbloniarz force-pushed the bb/android-graphics-headers branch from 0b9c755 to 7e6bbbd Compare November 17, 2026 09:54
pawicao added a commit that referenced this pull request Nov 19, 2026
> [!NOTE]
> This pull request was authored by AI on behalf of @pawicao.

Related: #11127.

## Summary

I upgraded the example apps and development dependencies to React Native
`0.89.0-rc.2`, following #10582, #10952 and the [Upgrade Helper
diff](https://github.com/react-native-community/rn-diff-purge/blob/diffs/diffs/0.88.0..0.89.0-rc.2.diff).
I updated the native app templates and toolchain, renamed the Bundle
Mode patches for Metro 0.88, and aligned the Babel AST dependencies.
I centralized React Native umbrella-header compatibility, acknowledged
framework-tier APIs with `RN_ALLOW_FRAMEWORKS`, used RC.1’s public
feature flags, and selected Android’s graphics headers, following
[Gesture Handler’s
upgrade](software-mansion/react-native-gesture-handler#4674).
I kept external mount observers through one compatibility helper because
their replacement only accepts component views, and upgraded to [SVG
15.16.1](https://github.com/software-mansion/react-native-svg/releases/tag/v15.16.1)
instead of maintaining its patch.
I advanced the unreleased compatibility ranges to React Native
0.87–0.89, removed the code paths for React Native 0.86, and added
changelog fragments for both libraries.

## Suggested follow-up after 4.8.0

For Reanimated 4.9.0, I recommend raising the minimum React Native
version to 0.89. This would remove these header fallbacks and allow us
to remove shared-element-transition workarounds covered by upstream
fixes landing in RN 0.89; I would keep the broader compatibility for
4.8.0.

## Test plan

- Package builds, both package type checks (including legacy RN types),
FabricExample type checks, and all 2,580 Jest tests pass; the script
suite passes all 207 tests.
- iOS simulator and Android arm64 Debug examples build and render; both
runtime-test configurations build.
- The iOS simulator and Android arm64 Debug examples also build against
React Native 0.88 with the library code from this PR.
- iOS runtime suites pass: Reanimated 632 passed / 4 skipped; Worklets
1,627 passed / 1 skipped.
- Android `props` passes all 76 tests with host GPU rendering, as
required by the agent guide.
- The revised iOS library target and Android arm64 Debug example build
with unpatched SVG 15.16.1; CocoaPods lockfiles were regenerated for
iOS, tvOS, and macOS.
- LLVM 22 clang-tidy passes for all 187 library files with no errors or
warnings, without `REANIMATED_PREBUILT_RNCORE`; strict-API compilation
also passes.
- Strict C++ API syntax checks pass for five main Reanimated/Worklets
translation units with `RN_STRICT_API` enabled.
- JS, Apple, Android Spotless and CMake checks, mock/peer validation,
dependency cycles, immutable install, dedupe, constraints, exact
dependency versions, and changelog checks pass.

## Changelog

- [x] I added a changelog fragment for each changed package.
@bartlomiejbloniarz
bartlomiejbloniarz force-pushed the bb/android-graphics-headers branch from 7e6bbbd to 91d478b Compare November 20, 2026 12:23

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant