react-native: UIImplementation.createView "Root node with tag 21 doesn't exist " for both debug builds and prod builds

Description

If an apk is debug enabled, one out of 3 times, the first load on physical devices (Pixel 5, Samsung S20 Ultra, etc.) cause errors due to “no active CatalystInstance”. RN error screen also shows “Root node with tag 21 doesn’t exist”. It only happens on the first load. Sub-sequential loads have no issue. [Update: we observed it is repeated issue on production!]

First error call stack:

Unhandled SoftException com.facebook.react.bridge.ReactNoCrashSoftException: No active CatalystInstance, cannot emitUpdateDimensionsEvent at com.facebook.react.modules.deviceinfo.DeviceInfoModule.emitUpdateDimensionsEvent(DeviceInfoModule.java:94) at com.facebook.react.ReactRootView$CustomGlobalLayoutListener.emitUpdateDimensionsEvent(ReactRootView.java:1075) at com.facebook.react.ReactRootView$CustomGlobalLayoutListener.checkForDeviceDimensionsChanges(ReactRootView.java:1032) at com.facebook.react.ReactRootView$CustomGlobalLayoutListener.onGlobalLayout(ReactRootView.java:916) at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:1084) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4302) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:3116) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:10885) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1301) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1309) at android.view.Choreographer.doCallbacks(Choreographer.java:923) at android.view.Choreographer.doFrame(Choreographer.java:852) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1283) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8762) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

Second error call stack:

com.facebook.react.bridge.ReactNoCrashSoftException: Cannot get UIManager because the context doesn't contain an active CatalystInstance. at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:77) at com.facebook.react.uimanager.UIManagerHelper.getEventDispatcher(UIManagerHelper.java:128) at com.facebook.react.uimanager.UIManagerHelper.getEventDispatcherForReactTag(UIManagerHelper.java:106) at com.th3rdwave.safeareacontext.SafeAreaProviderManagerKt.handleOnInsetsChange(SafeAreaProviderManager.kt:39) at com.th3rdwave.safeareacontext.SafeAreaProviderManagerKt.access$handleOnInsetsChange(SafeAreaProviderManager.kt:1) at com.th3rdwave.safeareacontext.SafeAreaProviderManager$addEventEmitters$1.invoke(SafeAreaProviderManager.kt:28) at com.th3rdwave.safeareacontext.SafeAreaProviderManager$addEventEmitters$1.invoke(SafeAreaProviderManager.kt:28) at com.th3rdwave.safeareacontext.SafeAreaProvider.maybeUpdateInsets(SafeAreaProvider.kt:21) at com.th3rdwave.safeareacontext.SafeAreaProvider.onPreDraw(SafeAreaProvider.kt:39) at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1121) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4442) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:3116) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:10885) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1301) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1309) at android.view.Choreographer.doCallbacks(Choreographer.java:923) at android.view.Choreographer.doFrame(Choreographer.java:852) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1283) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8762) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

React Native Version

0.72.6

Output of npx react-native info

System: OS: macOS 13.5.1 CPU: (10) arm64 Apple M1 Pro Memory: 78.66 MB / 16.00 GB Shell: version: 3.2.57 path: /bin/bash Binaries: Node: version: 18.18.2 path: /opt/homebrew/opt/node@18/bin/node Yarn: Not Found npm: version: 7.24.2 path: ???/node_modules/.bin/npm Watchman: version: 2023.07.10.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.12.1 path: /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 22.1 - iOS 16.1 - macOS 13.0 - tvOS 16.1 - watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: version: 14.1/14B47b path: /usr/bin/xcodebuild Languages: Java: version: 11.0.17 path: /Library/Java/JavaVirtualMachines/jdk-11.0.17+8/Contents/Home/bin/javac Ruby: version: 2.6.10 path: /usr/bin/ruby npmPackages: “@react-native-community/cli”: Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.6 wanted: ^0.72.6 react-native-macos: Not Found npmGlobalPackages: “react-native”: Not Found Android: hermesEnabled: false newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false

Steps to reproduce

  1. Build a debug apk with index.android.bundle
  2. Side load the apk to a Samsung S20 Ultra or Pixel 5
  3. Start the app
  4. Observe if an error screen shows up
  5. If no, delete the app and repeat step 2 to 4

Snack, screenshot, or link to a repository

Screenshot 2023-11-16 at 2 35 39 PM

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (2 by maintainers)

Most upvoted comments

⚠️ Newer Version of React Native is Available!
ℹ️ You are on a supported minor version, but it looks like there’s a newer patch available - 0.72.7. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.