How to find the tag from the error: Trying to update non-existent view with tag 85273 in React Native Android

Viewed 777

In production of React Native app get the error on Android from crashlytics of firebase:


    Fatal exception: com.facebook.react.uimanager.IllegalViewOperationException.
    Trying to update non-existent view with tag 85273.

And there is no scenario of the crash, therefore it is not possible to detect it. I checked many times on emulators and a real Android device.

What did we find out about this crash?

  • the updateView method that caused the exception is located in node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java; 
  

    public void updateView(int tag, String className, ReadableMap props) {
        ViewManager viewManager = mViewManagers.get(className);
        if (viewManager == null) {
          throw new IllegalViewOperationException("Got unknown view type: " + className);
        }
        ReactShadowNode cssNode = mShadowNodeRegistry.getNode(tag);
        if (cssNode == null) {
          throw new IllegalViewOperationException("Trying to update non-existent view with tag " + tag);
        }
    
        if (props != null) {
          ReactStylesDiffMap styles = new ReactStylesDiffMap(props);
          cssNode.updateProperties(styles);
          handleUpdateView(cssNode, className, styles);
        }
      }

  • by condition if cssNode == null, then throw an exception, it means some null came from the JS side;
  • ShadowNodeRegistry is a simple container class to keep track of ReactShadowNodes associated with a particular UIManagerModule instance;
  • and we have the number of the tag 85273, the cause of the exception.

How can I find the element in JS side by tag number 85273? Or maybe somebody could recommend me please some articles or share your experience how to solve like this crashes in Android of React Native app. Thanks in advance.

0 Answers
Related