Skip to content

fix: android build on Expo SDK 55 / RN 0.83 / Kotlin 2.x#1197

Open
oobagi wants to merge 2 commits into
react-native-menu:masterfrom
oobagi:fix/android-expo-sdk-55-kotlin-2x
Open

fix: android build on Expo SDK 55 / RN 0.83 / Kotlin 2.x#1197
oobagi wants to merge 2 commits into
react-native-menu:masterfrom
oobagi:fix/android-expo-sdk-55-kotlin-2x

Conversation

@oobagi

@oobagi oobagi commented Apr 16, 2026

Copy link
Copy Markdown

Overview

v2.0.0 doesn't build on Android with Expo SDK 55 (RN 0.83, Kotlin 2.1.20). Two issues:

isNewArchitectureEnabled() returns false on RN 0.83+ — RN 0.83 removed the newArchEnabled gradle property since new arch is now the only option. Without it the function defaults to false, the com.facebook.react plugin never gets applied, oldarch sources are used, and codegen is skipped. Result: "View config not found for component MenuView" at runtime. This PR defaults to true when the property is absent.

MenuView.kt setter breaks under K2#1156 switched to property syntax for hitSlopRect, but K2 rejects super.hitSlopRect = value because it's val in the ReactHitSlopView interface. The self-assignment mHitSlopRect = value inside its own setter is also infinite recursion. Same bug that was fixed in v1.0.0 via #746. This PR uses the field keyword instead.

Closes #1167, Fixes #1058
Related: #1179, #1186, #1187

Test Plan

  • Build an Expo SDK 55 project with @react-native-menu/menu on Android
  • Verify MenuView renders and popup opens on tap
  • Verify hit slop works without stack overflow
  • Verify old arch builds still work (property present and set to "true"/"false")

1. isNewArchitectureEnabled() defaults to true when newArchEnabled
   property is absent (removed in RN 0.83 since new arch is the
   only option).

2. MenuView.kt mHitSlopRect setter uses `field` keyword instead of
   super.hitSlopRect (rejected by K2 compiler) and recursive self-
   assignment.

Closes react-native-menu#1167, Fixes react-native-menu#1058
Related: react-native-menu#1179, react-native-menu#1186, react-native-menu#1187

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@oobagi oobagi requested a review from Naturalclar as a code owner April 16, 2026 09:42
@1kuko3

1kuko3 commented May 26, 2026

Copy link
Copy Markdown

This works on Expo 56, too!

@orientalperil

Copy link
Copy Markdown

Can this get merged and released? This library is broken

Comment thread android/build.gradle Outdated
Comment on lines +18 to +21
if (rootProject.hasProperty("newArchEnabled")) {
return rootProject.getProperty("newArchEnabled") == "true"
}
return true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i believe this would cause breaking change as it would force apps without newArchEnabled to use the new arch

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch, thanks. I updated this to only default to New Architecture on RN 0.82+, where legacy architecture is no longer selectable. For earlier versions, it preserves the previous behavior and only uses the new-arch path when it is explicitly set.

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.

Bug Report: "Val cannot be reassigned" error regression in v2.0.0 MenuView fails on iOS (Unimplemented) + Android (View config missing)

4 participants