From 560e5bc258b0a0ed024e607fec5849edcbefa321 Mon Sep 17 00:00:00 2001 From: igaboo Date: Thu, 16 Apr 2026 02:28:11 -0700 Subject: [PATCH] fix: Android build on Expo SDK 55 / RN 0.83 / Kotlin 2.x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two bugs that combine to make @react-native-menu/menu@2.0.0 unusable on Android with Expo SDK 55: 1. isNewArchitectureEnabled() returns false on RN 0.83+ Expo SDK 55 / RN 0.83 removed the `newArchEnabled` Gradle property because New Architecture is the only option. The function defaulted to false, skipping the com.facebook.react plugin, using oldarch sources, and skipping codegen — causing "View config not found for component MenuView" at runtime. Fix: default to true when the property is absent. 2. MenuView.kt setter breaks under Kotlin 2.x (K2 compiler) PR #1156 switched from setHitSlopRect() method calls to property syntax. The K2 compiler rejects `super.hitSlopRect = value` because hitSlopRect is declared as val in the ReactHitSlopView interface. Additionally, `mHitSlopRect = value` inside its own setter causes infinite recursion. Fix: use the `field` keyword directly. Closes #1167 Fixes #1058 Related: #1179, #1186, #1187 --- android/build.gradle | 5 ++++- android/src/main/java/com/reactnativemenu/MenuView.kt | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index f1d2631f..0a4cf2ef 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -15,7 +15,10 @@ buildscript { } def isNewArchitectureEnabled() { - return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" + if (rootProject.hasProperty("newArchEnabled")) { + return rootProject.getProperty("newArchEnabled") == "true" + } + return true } apply plugin: "com.android.library" diff --git a/android/src/main/java/com/reactnativemenu/MenuView.kt b/android/src/main/java/com/reactnativemenu/MenuView.kt index c45f5cc8..16fb9946 100644 --- a/android/src/main/java/com/reactnativemenu/MenuView.kt +++ b/android/src/main/java/com/reactnativemenu/MenuView.kt @@ -25,8 +25,7 @@ class MenuView(private val mContext: ReactContext) : ReactViewGroup(mContext) { private var mGestureDetector: GestureDetector private var mHitSlopRect: Rect? = null set(value) { - super.hitSlopRect = value - mHitSlopRect = value + field = value updateTouchDelegate() }