mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Ensure that ReactInstanceManager is still alive when animation system updates views in Fabric
Summary: This diff ensures that ReactInstanceManager has a valid catalystInstance when updating views as part of the animation system. This also force the update of views to be posted in the UI Thread Changelog: [internal] Reviewed By: JoshuaGross Differential Revision: D18311782 fbshipit-source-id: 1f1e7b0d34346f34b3607e5b75e5c14cda3f4861
This commit is contained in:
committed by
Facebook Github Bot
parent
c6b16ecc41
commit
3281714312
@@ -469,7 +469,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void updateView(int tag, String className, ReadableMap props) {
|
||||
public void updateView(final int tag, final String className, final ReadableMap props) {
|
||||
if (DEBUG) {
|
||||
String message =
|
||||
"(UIManager.updateView) tag: " + tag + ", class: " + className + ", props: " + props;
|
||||
@@ -478,10 +478,19 @@ public class UIManagerModule extends ReactContextBaseJavaModule
|
||||
}
|
||||
int uiManagerType = ViewUtil.getUIManagerType(tag);
|
||||
if (uiManagerType == FABRIC) {
|
||||
UIManager fabricUIManager =
|
||||
UIManagerHelper.getUIManager(getReactApplicationContext(), uiManagerType);
|
||||
if (fabricUIManager != null) {
|
||||
fabricUIManager.synchronouslyUpdateViewOnUIThread(tag, props);
|
||||
ReactApplicationContext reactApplicationContext = getReactApplicationContext();
|
||||
if (reactApplicationContext.hasActiveCatalystInstance()) {
|
||||
final UIManager fabricUIManager =
|
||||
UIManagerHelper.getUIManager(reactApplicationContext, uiManagerType);
|
||||
if (fabricUIManager != null) {
|
||||
reactApplicationContext.runOnUiQueueThread(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fabricUIManager.synchronouslyUpdateViewOnUIThread(tag, props);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mUIImplementation.updateView(tag, className, props);
|
||||
|
||||
Reference in New Issue
Block a user