Skip to content

Commit d9eae2a

Browse files
sahrensfacebook-github-bot
authored andcommitted
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
1 parent 45b9b65 commit d9eae2a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,13 @@ public void updateView(int tag, String className, ReadableMap props) {
472472
FLog.d(ReactConstants.TAG, message);
473473
PrinterHolder.getPrinter().logMessage(ReactDebugOverlayTags.UI_MANAGER, message);
474474
}
475-
476-
mUIImplementation.updateView(tag, className, props);
475+
int uiManagerType = ViewUtil.getUIManagerType(tag);
476+
if (uiManagerType == FABRIC) {
477+
UIManager fabricUIManager = UIManagerHelper.getUIManager(getReactApplicationContext(), uiManagerType);
478+
fabricUIManager.synchronouslyUpdateViewOnUIThread(tag, props);
479+
} else {
480+
mUIImplementation.updateView(tag, className, props);
481+
}
477482
}
478483

479484
/**

0 commit comments

Comments
 (0)