From d9eae2a8093156c8faae0c5ae14546bbc95e7a3d Mon Sep 17 00:00:00 2001 From: Spencer Ahrens Date: Mon, 25 Mar 2019 12:10:09 -0700 Subject: [PATCH] fix setNativeProps crash Summary: setNativeProps ends up calling UIManager.updateView which fails to find the view tag in the Paper UIManager and crashes. This diff simply checks if the tag is managed by fabric, and calls `fabricUIManager.synchronouslyUpdateViewOnUIThread` if it is. Not the ideal fix, but it generally works (js-driven animations work as well as in Paper) and it's better than crashing or not working at all. Reviewed By: JoshuaGross Differential Revision: D14414523 fbshipit-source-id: 0acd404f55094f8ce8eda39cb87ab58c727fb068 --- .../com/facebook/react/uimanager/UIManagerModule.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java index cc51ec89a48..1d2e4fbb6a7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java @@ -472,8 +472,13 @@ public class UIManagerModule extends ReactContextBaseJavaModule FLog.d(ReactConstants.TAG, message); PrinterHolder.getPrinter().logMessage(ReactDebugOverlayTags.UI_MANAGER, message); } - - mUIImplementation.updateView(tag, className, props); + int uiManagerType = ViewUtil.getUIManagerType(tag); + if (uiManagerType == FABRIC) { + UIManager fabricUIManager = UIManagerHelper.getUIManager(getReactApplicationContext(), uiManagerType); + fabricUIManager.synchronouslyUpdateViewOnUIThread(tag, props); + } else { + mUIImplementation.updateView(tag, className, props); + } } /**