mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Refactor calls to UIManagerHelper.getUIManager
Summary: This diff refactors the usages of UIManagerHelper.getUIManager() to make sure we always consider null objects. Some of the callsites were throwing a NullPointerExcetpion, now they throw a more explicit exception. changelog: [internal] Reviewed By: makovkastar Differential Revision: D19383064 fbshipit-source-id: 1806a37528e80cab1c8fdff5eb631aaf47bde819
This commit is contained in:
committed by
Facebook Github Bot
parent
edcbfb9821
commit
39089b4c45
@@ -34,6 +34,7 @@ import com.facebook.react.bridge.CatalystInstance;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactMarker;
|
||||
import com.facebook.react.bridge.ReactMarkerConstants;
|
||||
import com.facebook.react.bridge.UIManager;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.WritableNativeMap;
|
||||
@@ -125,6 +126,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
// TODO: T60453649 - Add test automation to verify behavior of onMeasure
|
||||
setAllowImmediateUIOperationExecution(false);
|
||||
|
||||
if (mUseSurface) {
|
||||
@@ -441,8 +443,13 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
|
||||
final ReactContext reactApplicationContext = mReactInstanceManager.getCurrentReactContext();
|
||||
|
||||
if (reactApplicationContext != null) {
|
||||
UIManagerHelper.getUIManager(reactApplicationContext, getUIManagerType())
|
||||
.updateRootLayoutSpecs(getRootViewTag(), widthMeasureSpec, heightMeasureSpec);
|
||||
@Nullable
|
||||
UIManager uiManager =
|
||||
UIManagerHelper.getUIManager(reactApplicationContext, getUIManagerType());
|
||||
// Ignore calling updateRootLayoutSpecs if UIManager is not properly initialized.
|
||||
if (uiManager != null) {
|
||||
uiManager.updateRootLayoutSpecs(getRootViewTag(), widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,8 +481,13 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
|
||||
return;
|
||||
}
|
||||
|
||||
UIManagerHelper.getUIManager(reactApplicationContext, getUIManagerType())
|
||||
.setAllowImmediateUIOperationExecution(flag);
|
||||
@Nullable
|
||||
UIManager uiManager = UIManagerHelper.getUIManager(reactApplicationContext, getUIManagerType());
|
||||
// Ignore calling setAllowImmediateUIOperationExecution if UIManager is not properly
|
||||
// initialized.
|
||||
if (uiManager != null) {
|
||||
uiManager.setAllowImmediateUIOperationExecution(flag);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user