mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Revert D50926218: Adding getFabricUIManager() APIs to ReactContext
Differential Revision: D50926218 Original commit changeset: f311affb0f82 Original Phabricator Diff: D50926218 fbshipit-source-id: 313fd5aff1314860994487d1f4d17d2a2d5fe8c1
This commit is contained in:
1 parent
93be03056b
commit
c8db60c7aa
5 files changed
+3
-38
No files matched your search
-20
@@ -26,7 +26,6 @@ import com.facebook.react.bridge.queue.MessageQueueThread;
|
||||
import com.facebook.react.bridge.queue.ReactQueueConfiguration;
|
||||
import com.facebook.react.common.LifecycleState;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
@@ -555,25 +554,6 @@ public class ReactContext extends ContextWrapper {
|
||||
return mCatalystInstance.getJSIModule(moduleType);
|
||||
}
|
||||
|
||||
@DeprecatedInNewArchitecture(
|
||||
message =
|
||||
"This method will be deprecated later as part of Stable APIs with bridge removal and not encouraged usage.")
|
||||
/**
|
||||
* Get the UIManager for Fabric from the CatalystInstance.
|
||||
*
|
||||
* @return The UIManager when CatalystInstance is active.
|
||||
*/
|
||||
public @Nullable UIManager getFabricUIManager() {
|
||||
if (!hasActiveReactInstance()) {
|
||||
throw new IllegalStateException(
|
||||
"Unable to retrieve a UIManager if CatalystInstance is not active.");
|
||||
}
|
||||
UIManager uiManager = mCatalystInstance.getFabricUIManager();
|
||||
return uiManager != null
|
||||
? uiManager
|
||||
: (UIManager) mCatalystInstance.getJSIModule(JSIModuleType.UIManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sourceURL for the JS bundle from the CatalystInstance. This method is needed for
|
||||
* compatibility with bridgeless mode, which has no CatalystInstance.
|
||||
|
||||
-6
@@ -21,7 +21,6 @@ import com.facebook.react.bridge.NativeModule;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactNoCrashBridgeNotAllowedSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.UIManager;
|
||||
import com.facebook.react.bridge.WritableNativeArray;
|
||||
import com.facebook.react.config.ReactFeatureFlags;
|
||||
import com.facebook.react.devsupport.interfaces.DevSupportManager;
|
||||
@@ -85,11 +84,6 @@ class BridgelessReactContext extends ReactApplicationContext implements EventDis
|
||||
+ moduleType.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable UIManager getFabricUIManager() {
|
||||
return mReactHost.getUIManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CatalystInstance getCatalystInstance() {
|
||||
ReactSoftExceptionLogger.logSoftExceptionVerbose(
|
||||
|
||||
-9
@@ -15,7 +15,6 @@ import com.facebook.react.bridge.JSIModuleType;
|
||||
import com.facebook.react.bridge.LifecycleEventListener;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.UIManager;
|
||||
|
||||
/**
|
||||
* Wraps {@link ReactContext} with the base {@link Context} passed into the constructor. It provides
|
||||
@@ -117,12 +116,4 @@ public class ThemedReactContext extends ReactContext {
|
||||
}
|
||||
return super.getJSIModule(moduleType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UIManager getFabricUIManager() {
|
||||
if (isBridgeless()) {
|
||||
return mReactApplicationContext.getFabricUIManager();
|
||||
}
|
||||
return super.getFabricUIManager();
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -17,6 +17,7 @@ import android.widget.EditText;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import com.facebook.react.bridge.CatalystInstance;
|
||||
import com.facebook.react.bridge.JSIModuleType;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactNoCrashSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
@@ -52,7 +53,7 @@ public class UIManagerHelper {
|
||||
@UIManagerType int uiManagerType,
|
||||
boolean returnNullIfCatalystIsInactive) {
|
||||
if (context.isBridgeless()) {
|
||||
@Nullable UIManager uiManager = context.getFabricUIManager();
|
||||
@Nullable UIManager uiManager = (UIManager) context.getJSIModule(JSIModuleType.UIManager);
|
||||
if (uiManager == null) {
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
@@ -84,7 +85,7 @@ public class UIManagerHelper {
|
||||
CatalystInstance catalystInstance = context.getCatalystInstance();
|
||||
try {
|
||||
return uiManagerType == FABRIC
|
||||
? context.getFabricUIManager()
|
||||
? (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
|
||||
|
||||
-1
@@ -83,7 +83,6 @@ class NativeAnimatedNodeTraversalTest {
|
||||
whenever(catalystInstanceMock.getJSIModule(any(JSIModuleType::class.java))).thenAnswer {
|
||||
uiManagerMock
|
||||
}
|
||||
whenever(reactApplicationContextMock.getFabricUIManager()).thenAnswer { uiManagerMock }
|
||||
whenever(catalystInstanceMock.getNativeModule(UIManagerModule::class.java)).thenAnswer {
|
||||
uiManagerMock
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user