Repository navigation
fix(Android): read view props with React Native's Android graphics headers - #11127
bartlomiejbloniarz wants to merge 1 commit into
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix Merge Risk:
|
da1377d to
d3d2085
Compare
d3d2085 to
3778961
Compare
3778961 to
0b9c755
Compare
0b9c755 to
7e6bbbd
Compare
> [!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.
7e6bbbd to
91d478b
Compare
Note
This pull request was authored by AI on behalf of @bartlomiejbloniarz.
Summary
Reanimated's Android build includes React Native's generic
graphics/platform/cxxheaders, while React Native builds withgraphics/platform/android. React Native 0.89 makes Android'sColora struct (react/react-native#58093), while the generic one is still anint32_t. Reanimated then readsViewPropswith a different layout than React Native writes it, andgetViewPropforbackgroundImagecrashes 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
0.89.0nightly on Android, thepropsruntime suite crashed in thebackgroundImagetests before this change. With it, the whole Reanimated suite passes.0.88.0on Android, thepropssuite still passes.Changelog
yarn changelog:addfor each changed package, or this PR does not changereact-native-reanimatedorreact-native-worklets.AI context
Investigation
PropValueProcessor::backgroundImagePreprocessingviaReanimatedModuleProxy::getViewProp,RangeError: Requested an array size that fails to allocatein JS, register contents spellingundImage.RN_ENABLE_DEBUG_STRING_CONVERTIBLE, set only for RN's own Debug build): disproved by adding it to Reanimated, crash unchanged.sizeof/offsetoffrom 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 afteropacity, at the firstSharedColor.-Mwith the real compile commands): RN usesgraphics/platform/android/.../HostPlatformColor.handFloat.h, Reanimatedgraphics/platform/cxx/...becauseandroid/CMakeLists.txtadds that include directory explicitly.HostPlatformColor.hhasusing Color = int32_t, the same as cxx; the nightly's is a struct (RN #58093). So the mismatch is new in 0.89.Design
graphics/platform/androidexists in RN 0.86, 0.87 and 0.88, with the same header set.Verification
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).props76/76 (observed).