You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Kotlin 2.4: generated *ViewManager.kt fails with "Check for instance is always 'false'" when the HybridView doesn't implement RecyclableView #2010
Disclaimer: An AI agent (Claude Code) found this issue while helping us upgrade our app to React Native 0.88, and it also wrote this report. A person reviewed the report before posting it.
With Kotlin 2.4.0 (required e.g. by @react-native-firebase v27), the Android build fails in nitrogen-generated view managers whose view implementation class is final and doesn't implement RecyclableView. For example, react-native-vision-camera 5.2.3 fails like this:
e: .../react-native-vision-camera/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/views/HybridPreviewViewManager.kt:82:9 Check for instance is always 'false'.
e: .../react-native-vision-camera/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/views/HybridFrameRendererViewManager.kt:82:9 Check for instance is always 'false'.
A Nitro view in our own project, freshly generated with nitrogen 0.37.1, fails the same way.
Cause
HybridViewHolder.hybridView is typed as the concrete view class. So in prepareToRecycleView, the check hybridView is RecyclableView is provably false. Kotlin 2.4 reports this as an error, and the existing @Suppress("USELESS_IS_CHECK") doesn't suppress it.
The template on main (packages/nitrogen/src/views/kotlin/KotlinHybridViewManager.ts) still generates this.
Workaround we use
We patched the generated code like this:
val recyclableView:Any= hybridView
if (recyclableView isRecyclableView) {
recyclableView.prepareForRecycle()
return hybridView.view
}
Two possible fixes in the template:
Store the view in HybridViewHolder typed as its spec or Any.
Only emit the recycling branch when the implementation implements RecyclableView.
Activity
mrousavy commentedon Oct 27, 2026
Fixed by #2011