Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid crash by handling missing views in dispatchViewManagerCommand (#…
…33795) Summary: Based on Google Play crash logs, crashes due to the assertions in `dispatchViewManagerCommand` is our top source of crashes: ``` com.facebook.react.uimanager.IllegalViewOperationException: Unable to execute operation dispatchViewManagerCommand: blur on view with tag: 17549, since the view does not exists at com.facebook.react.uimanager.UIImplementation.assertViewExists(UIImplementation.java:830) at com.facebook.react.uimanager.UIImplementation.dispatchViewManagerCommand(UIImplementation.java:713) at com.facebook.react.uimanager.UIManagerModule.dispatchCommand(UIManagerModule.java:739) at com.facebook.react.uimanager.UIManagerModule.dispatchViewManagerCommand(UIManagerModule.java:726) at com.facebook.react.uimanager.ReanimatedUIManager.dispatchViewManagerCommand(ReanimatedUIManager.java:233) at java.lang.reflect.Method.invoke(Method.java:-2) at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151) at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java:-2) ``` There are many other places in UIImplementation that instead of throwing a fatal exception, just log a message and continues execution. Logging a message and discarding the command should be safe for commands like "blur this view". We keep the previous behavior in debug mode, but just log and discard commands in production. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Fixed] - Avoid crash by handling missing views in dispatchViewManagerCommand Pull Request resolved: #33795 Test Plan: We had a tough time reproducing specific crashes, but we ran with this binary in the latest release of our app and it has eliminated this class of crashes from Google Play and Bugsnag instrumentation. Reviewed By: cortinico Differential Revision: D36285603 Pulled By: JoshuaGross fbshipit-source-id: db0be74926c4cb83f07686398579236da8e586bf
- Loading branch information