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 facebook-github-bot committed May 6, 2021
1 parent b2e2f43 commit b0e8c1e
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,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

2 comments on commit b0e8c1e

@pwaweru
Copy link

@pwaweru pwaweru commented on b0e8c1e May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - do you have a timescale for when this would be included in the next release?

@mikehardy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pwaweru the release process is somewhat unrelated to the commits as they flow in. I have posted cherry-pick requests to the 0.64.2 and 0.65.0 cherrypicks request issues over on the releases repo: https://github.com/react-native-community/releases/issues - and that's how they'll flow into releases. Follow the related issues for updates on release status

Please sign in to comment.