Skip to content

Commit

Permalink
Refactor UIManagerHelper.getUIManager to return null when there's no …
Browse files Browse the repository at this point in the history
…UIManager registered

Summary:
This diff refactors the UIManagerHelper.getUIManager method to return null when there's no UIManager registered for the uiManagerType received as a parameter.

This is necessary to workaround: facebook#31245

changelog: [changed] UIManagerHelper.getUIManager now returns null when there's no UIManager registered for the uiManagerType received as a parameter

Reviewed By: fkgozali

Differential Revision: D28242592

fbshipit-source-id: c3a4979bcf6e547d0f0060737e41bbf19860a984
  • Loading branch information
mdvacca authored and danilobuerger committed May 13, 2021
1 parent d9f7770 commit d99a3ac
Showing 1 changed file with 12 additions and 3 deletions.
Expand Up @@ -86,9 +86,18 @@ private static UIManager getUIManager(
}
}
CatalystInstance catalystInstance = context.getCatalystInstance();
return uiManagerType == FABRIC
? (UIManager) catalystInstance.getJSIModule(JSIModuleType.UIManager)
: catalystInstance.getNativeModule(UIManagerModule.class);
try {
return uiManagerType == FABRIC
? (UIManager) catalystInstance.getJSIModule(JSIModuleType.UIManager)
: catalystInstance.getNativeModule(UIManagerModule.class);
} catch (IllegalArgumentException ex) {
// TODO T67518514 Clean this up once we migrate everything over to bridgeless mode
ReactSoftException.logSoftException(
"UIManagerHelper",
new ReactNoCrashSoftException(
"Cannot get UIManager for UIManagerType: " + uiManagerType));
return catalystInstance.getNativeModule(UIManagerModule.class);
}
}

/**
Expand Down

0 comments on commit d99a3ac

Please sign in to comment.