Skip to content

Remove REACT_NATIVE_MINOR_VERSION build flag - #4422

Merged
m-bert merged 1 commit into
mainfrom
@mbert/remove-rn-version-check
Aug 17, 2026
Merged

Remove REACT_NATIVE_MINOR_VERSION build flag#4422
m-bert merged 1 commit into
mainfrom
@mbert/remove-rn-version-check

Conversation

@m-bert

@m-bert m-bert commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR removes the REACT_NATIVE_MINOR_VERSION build flag and fixes the target_compile_reactnative_options call in the Android CMakeLists.

The only consumer of REACT_NATIVE_MINOR_VERSION was a >= 81 check in RNGHRuntimeDecorator.cpp, which is always true on supported react-native versions. If a version check becomes necessary in the future, react-native ships <cxxreact/ReactNativeVersion.h> with the REACT_NATIVE_VERSION_MINOR macro, available on all platforms and build systems.

The target_compile_reactnative_options block added in #3688 never executed: it ran before find_package(ReactAndroid) defines ReactAndroid_VERSION_MINOR, referenced an undefined LIB_TARGET_NAME, and was missing the include of react-native-flags.cmake that defines the function. This PR fixes it to match how reanimated and worklets use it. Note that this applies RN_SERIALIZABLE_STATE and HERMES_V1_ENABLED=1 to our JNI target for the first time, matching how ReactAndroid itself is built.

Test plan

  • basic-example builds and launches on iOS (pod install + yarn ios)
  • basic-example builds on Android (assembleDebug, -Wall -Werror, no new warnings)
  • compile_commands.json confirms RN_SERIALIZABLE_STATE and HERMES_V1_ENABLED=1 are applied to all translation units
  • basic-example builds under the experimental SwiftPM setup from react-native 0.87
  • pod ipc spec evaluates the modified podspec cleanly

Copilot AI lite review requested due to automatic review settings August 14, 2026 12:28
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: eff98cac-5a83-49bf-903a-8fa78bc46478

📥 Commits

Reviewing files that changed from the base of the PR and between 3e4497e and a55f44e.

📒 Files selected for processing (5)
  • packages/react-native-gesture-handler/RNGestureHandler.podspec
  • packages/react-native-gesture-handler/android/build.gradle
  • packages/react-native-gesture-handler/android/src/main/jni/CMakeLists.txt
  • packages/react-native-gesture-handler/scripts/gesture_handler_utils.rb
  • packages/react-native-gesture-handler/shared/runtime/RNGHRuntimeDecorator.cpp
💤 Files with no reviewable changes (3)
  • packages/react-native-gesture-handler/shared/runtime/RNGHRuntimeDecorator.cpp
  • packages/react-native-gesture-handler/android/build.gradle
  • packages/react-native-gesture-handler/scripts/gesture_handler_utils.rb

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility with current React Native versions by removing version-specific build and runtime handling.
    • Updated Android native compilation to consistently use C++20 and React Native compiler settings.
    • Improved conversion of JavaScript values to native shadow nodes for view flattening.
  • Refactor
    • Simplified native build configuration by removing React Native version detection and legacy fallbacks.

Walkthrough

The native integrations no longer parse or pass React Native minor versions. Android uses C++20 and React Native compile options unconditionally. Runtime ShadowNode conversion always uses the current bridging API.

Changes

Version-independent native integration

Layer / File(s) Summary
Native build configuration
packages/react-native-gesture-handler/RNGestureHandler.podspec, packages/react-native-gesture-handler/android/build.gradle, packages/react-native-gesture-handler/android/src/main/jni/CMakeLists.txt, packages/react-native-gesture-handler/scripts/gesture_handler_utils.rb
The podspec, Gradle build, CMake configuration, and Ruby utilities no longer discover or pass React Native minor versions. Android now uses C++20 and React Native compile options unconditionally.
ShadowNode conversion
packages/react-native-gesture-handler/shared/runtime/RNGHRuntimeDecorator.cpp
The runtime decorator always uses Bridging<std::shared_ptr<const ShadowNode>>::fromJs for JavaScript-to-ShadowNode conversion.

Possibly related PRs

Merge Risk: ⚪ Minimal · up to a55f4

The PR removes an unused build flag and corrects Android compile-option setup; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: removing the REACT_NATIVE_MINOR_VERSION build flag.
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.

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

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the REACT_NATIVE_MINOR_VERSION build flag across Apple/Android build tooling and simplifies the runtime C++ code accordingly, while also fixing Android’s JNI CMakeLists.txt so target_compile_reactnative_options is correctly applied to the gesturehandler target (matching ReactAndroid’s compile flags).

Changes:

  • Removed REACT_NATIVE_MINOR_VERSION usage from runtime code and build scripts (podspec/Gradle/CMake).
  • Fixed Android JNI CMake to include react-native-flags.cmake and apply target_compile_reactnative_options to the correct target after find_package(ReactAndroid).
  • Standardized the Android JNI CMake C++ standard selection to C++20.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/react-native-gesture-handler/shared/runtime/RNGHRuntimeDecorator.cpp Removes now-unnecessary RN-minor conditional compilation around shadow node bridging.
packages/react-native-gesture-handler/scripts/gesture_handler_utils.rb Deletes Ruby helpers used solely to discover RN minor version for build flags.
packages/react-native-gesture-handler/RNGestureHandler.podspec Drops -DREACT_NATIVE_MINOR_VERSION=... from OTHER_CFLAGS.
packages/react-native-gesture-handler/android/src/main/jni/CMakeLists.txt Removes RN-minor-based flag/standard logic; correctly wires react-native-flags.cmake + target_compile_reactnative_options for the JNI target.
packages/react-native-gesture-handler/android/build.gradle Removes parsing/exposing of RN minor version and stops passing it into the native build.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@m-bert
m-bert requested a review from j-piasecki August 17, 2026 06:23
@m-bert
m-bert merged commit 0d4b34f into main Aug 17, 2026
9 checks passed
@m-bert
m-bert deleted the @mbert/remove-rn-version-check branch August 17, 2026 07:31
This was referenced Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants