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:
1 parent
edcbfb9821
commit
39089b4c45
3 files changed
+33
-21
No files matched your search
@@ -680,22 +680,18 @@ public class UIManagerModule extends ReactContextBaseJavaModule
|
||||
int reactTag, Dynamic commandId, @Nullable ReadableArray commandArgs) {
|
||||
// TODO: this is a temporary approach to support ViewManagerCommands in Fabric until
|
||||
// the dispatchViewManagerCommand() method is supported by Fabric JS API.
|
||||
@Nullable
|
||||
UIManager uiManager =
|
||||
UIManagerHelper.getUIManager(
|
||||
getReactApplicationContext(), ViewUtil.getUIManagerType(reactTag));
|
||||
if (uiManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (commandId.getType() == ReadableType.Number) {
|
||||
final int commandIdNum = commandId.asInt();
|
||||
UIManager uiManager =
|
||||
UIManagerHelper.getUIManager(
|
||||
getReactApplicationContext(), ViewUtil.getUIManagerType(reactTag));
|
||||
if (uiManager != null) {
|
||||
uiManager.dispatchCommand(reactTag, commandIdNum, commandArgs);
|
||||
}
|
||||
uiManager.dispatchCommand(reactTag, commandId.asInt(), commandArgs);
|
||||
} else if (commandId.getType() == ReadableType.String) {
|
||||
final String commandIdStr = commandId.asString();
|
||||
UIManager uiManager =
|
||||
UIManagerHelper.getUIManager(
|
||||
getReactApplicationContext(), ViewUtil.getUIManagerType(reactTag));
|
||||
if (uiManager != null) {
|
||||
uiManager.dispatchCommand(reactTag, commandIdStr, commandArgs);
|
||||
}
|
||||
uiManager.dispatchCommand(reactTag, commandId.asString(), commandArgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user