Skip to content

Commit

Permalink
Removing Fabric check from UIManagerProvider (facebook#41982)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#41982

Moving the check for Fabric i.e. `ReactFeatureFlags.enableFabricRenderer` to old JSI Module path logic instead of new UIManagerProvider path for Fabric initialization and changing the default of UIManagerProvider from `null` -> `reactApplicationContext -> null;` since we are adding null check on the returned `UIManager`

Slight change of design of API for JSI Module in order to address the issues faced due to `ReactFeatureFlags.enableFabricRenderer`,
1. Getting rid of this check for the new Fabric initialization and keeping the old JSI Module path intact.
2. Allowing the UIManager to be nullable so as to allow Twilight surface not have UIManager set even though they it succeeds in initializing the TwilightJSIModule.
3. As made the UIManager nullable, added the null check for the same.
4. This eradicates the dependency on this flag for Anna as well.

Reviewed By: christophpurrer

Differential Revision: D52273097

fbshipit-source-id: bdf8b1de3771250c987c8f8bd4e48192f67a1afa
  • Loading branch information
arushikesarwani94 authored and facebook-github-bot committed Dec 19, 2023
1 parent 43826fa commit 1045b22
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1406,14 +1406,14 @@ private ReactApplicationContext createReactContext(
mJSIModulePackage.getJSIModules(
reactContext, catalystInstance.getJavaScriptContextHolder()));
}
if (ReactFeatureFlags.enableFabricRenderer) {
if (mUIManagerProvider != null) {
UIManager uiManager = mUIManagerProvider.createUIManager(reactContext);
if (mUIManagerProvider != null) {
UIManager uiManager = mUIManagerProvider.createUIManager(reactContext);
if (uiManager != null) {
uiManager.initialize();
catalystInstance.setFabricUIManager(uiManager);
} else {
catalystInstance.getJSIModule(JSIModuleType.UIManager);
}
} else if (ReactFeatureFlags.enableFabricRenderer) {
catalystInstance.getJSIModule(JSIModuleType.UIManager);
}
if (mBridgeIdleDebugListener != null) {
catalystInstance.addBridgeIdleDebugListener(mBridgeIdleDebugListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ protected final Application getApplication() {
}

protected @Nullable UIManagerProvider getUIManagerProvider() {
return null;
return reactApplicationContext -> null;
}

/** Returns whether or not to treat it as normal if Activity is null. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ import com.facebook.react.common.annotations.DeprecatedInNewArchitecture
fun interface UIManagerProvider {

/* Provides a {@link com.facebook.react.bridge.UIManager} for the context received as a parameter. */
fun createUIManager(context: ReactApplicationContext): UIManager
fun createUIManager(context: ReactApplicationContext): UIManager?
}

0 comments on commit 1045b22

Please sign in to comment.