Back out "Add support for legacy UIManager in UIManagerHelper"

Summary:
Original commit changeset: 93eba1eb3106

Original Phabricator Diff: D50694805

changelog: [internal] internal

Reviewed By: fkgozali

Differential Revision: D50853438

fbshipit-source-id: 687cb100dfea28f3ea63812e1dd5b21e4c8ceb0e
This commit is contained in:
David Vacca
2023-10-31 20:23:36 -07:00
committed by Facebook GitHub Bot
parent ace81ff7d8
commit c66ca47f2b
@@ -22,9 +22,9 @@ import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReactNoCrashSoftException;
import com.facebook.react.bridge.ReactSoftExceptionLogger;
import com.facebook.react.bridge.UIManager;
import com.facebook.react.config.ReactFeatureFlags;
import com.facebook.react.uimanager.common.UIManagerType;
import com.facebook.react.uimanager.events.EventDispatcher;
import com.facebook.react.uimanager.events.EventDispatcherProvider;
/** Helper class for {@link UIManager}. */
public class UIManagerHelper {
@@ -53,19 +53,13 @@ public class UIManagerHelper {
@UIManagerType int uiManagerType,
boolean returnNullIfCatalystIsInactive) {
if (context.isBridgeless()) {
UIManager uiManager = null;
if (uiManagerType == FABRIC) {
uiManager = (UIManager) context.getJSIModule(JSIModuleType.UIManager);
} else if (ReactFeatureFlags.unstable_useFabricInterop) {
// When Fabric Interop is enabled in Bridgeless mode, enable the legacy UIManager
uiManager = context.getNativeModule(UIManagerModule.class);
}
@Nullable UIManager uiManager = (UIManager) context.getJSIModule(JSIModuleType.UIManager);
if (uiManager == null) {
ReactSoftExceptionLogger.logSoftException(
TAG,
new ReactNoCrashSoftException(
"Cannot get UIManager because the instance hasn't been initialized yet."));
return null;
}
return uiManager;
}
@@ -124,6 +118,13 @@ public class UIManagerHelper {
@Nullable
public static EventDispatcher getEventDispatcher(
ReactContext context, @UIManagerType int uiManagerType) {
// TODO T67518514 Clean this up once we migrate everything over to bridgeless mode
if (context.isBridgeless()) {
if (context instanceof ThemedReactContext) {
context = ((ThemedReactContext) context).getReactApplicationContext();
}
return ((EventDispatcherProvider) context).getEventDispatcher();
}
UIManager uiManager = getUIManager(context, uiManagerType, false);
if (uiManager == null) {
ReactSoftExceptionLogger.logSoftException(