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
This commit is contained in:
Spencer Ahrens
2019-03-25 12:10:09 -07:00
committed by Facebook Github Bot
parent 45b9b656cc
commit d9eae2a809

View File

@@ -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);
}
}
/**