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: #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 kelset committed May 26, 2021
1 parent a05d179 commit d894163
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
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 d894163

Please sign in to comment.