Summary
When compiling the Android library with Kotlin 2.3.x (e.g. as required by other dependencies such as Stripe Android SDK), RNGestureHandlerModule.kt fails to compile in findRootHelperForViewAncestor:
Function invocation 'getRootViewTag()' expected
at the expression using it.rootView.rootViewTag next to a local variable also named rootViewTag.
Environment
react-native-gesture-handler 2.30.1 (also reproducible on current 2.30.x line)
- Kotlin 2.3.0+ (project/toolchain aligned with RN 0.83 + libraries compiled with Kotlin 2.3 metadata)
- Android Gradle Plugin 8.12 (typical RN 0.83 setup)
Root cause
Inside findRootHelperForViewAncestor, the local val rootViewTag = ... shadows the synthetic Kotlin property rootViewTag on ReactRootView. The compiler then fails to resolve the property access on the left-hand side of the comparison (Kotlin 2.3 is stricter here than 2.1.x).
ReactRootView exposes the tag via getRootViewTag() in Java; the fix is to use an explicit receiver and call getRootViewTag() (or rename the local variable).
Suggested fix
synchronized(roots) {
return roots.firstOrNull {
val rv = it.rootView
rv is ReactRootView && rv.getRootViewTag() == rootViewTag
}
}
Workaround
Consumers can apply the one-line change locally (e.g. patch-package) until an upstream release includes the fix.
Related downstream context: projects that bump Kotlin to 2.3 for Stripe or other SDKs hit this as a hard compile failure on :react-native-gesture-handler:compileDebugKotlin.
Summary
When compiling the Android library with Kotlin 2.3.x (e.g. as required by other dependencies such as Stripe Android SDK),
RNGestureHandlerModule.ktfails to compile infindRootHelperForViewAncestor:at the expression using
it.rootView.rootViewTagnext to a local variable also namedrootViewTag.Environment
react-native-gesture-handler2.30.1 (also reproducible on current 2.30.x line)Root cause
Inside
findRootHelperForViewAncestor, the localval rootViewTag = ...shadows the synthetic Kotlin propertyrootViewTagonReactRootView. The compiler then fails to resolve the property access on the left-hand side of the comparison (Kotlin 2.3 is stricter here than 2.1.x).ReactRootViewexposes the tag viagetRootViewTag()in Java; the fix is to use an explicit receiver and callgetRootViewTag()(or rename the local variable).Suggested fix
synchronized(roots) { return roots.firstOrNull { val rv = it.rootView rv is ReactRootView && rv.getRootViewTag() == rootViewTag } }Workaround
Consumers can apply the one-line change locally (e.g.
patch-package) until an upstream release includes the fix.Related downstream context: projects that bump Kotlin to 2.3 for Stripe or other SDKs hit this as a hard compile failure on
:react-native-gesture-handler:compileDebugKotlin.