Skip to content

Commit

Permalink
Refactor React to get rid of JSIModule (#42069)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #42069

 Refactor React to get rid of JSIModule and its dependencies now that the changes are rolled out for all internal apps.

Changelog:
[Internal] Internal

Reviewed By: christophpurrer

Differential Revision: D51058885

fbshipit-source-id: 07a7335235605fbc07657f8da8588ec548bce797
  • Loading branch information
arushikesarwani94 authored and facebook-github-bot committed Dec 27, 2023
1 parent e75f050 commit 6555205
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
import com.facebook.react.bridge.CatalystInstanceImpl;
import com.facebook.react.bridge.JSBundleLoader;
import com.facebook.react.bridge.JSExceptionHandler;
import com.facebook.react.bridge.JSIModulePackage;
import com.facebook.react.bridge.JSIModuleType;
import com.facebook.react.bridge.JavaJSExecutor;
import com.facebook.react.bridge.JavaScriptExecutor;
import com.facebook.react.bridge.JavaScriptExecutorFactory;
Expand Down Expand Up @@ -186,7 +184,6 @@ public interface ReactInstanceEventListener
private volatile Boolean mHasStartedDestroying = false;
private final MemoryPressureRouter mMemoryPressureRouter;
private final @Nullable JSExceptionHandler mJSExceptionHandler;
private final @Nullable JSIModulePackage mJSIModulePackage;
private final @Nullable UIManagerProvider mUIManagerProvider;
private final @Nullable ReactPackageTurboModuleManagerDelegate.Builder mTMMDelegateBuilder;
private List<ViewManager> mViewManagers;
Expand Down Expand Up @@ -235,7 +232,6 @@ public static ReactInstanceManagerBuilder builder() {
@Nullable DevBundleDownloadListener devBundleDownloadListener,
int minNumShakes,
int minTimeLeftInFrameForNonBatchedOperationMs,
@Nullable JSIModulePackage jsiModulePackage,
@Nullable UIManagerProvider uIManagerProvider,
@Nullable Map<String, RequestHandler> customPackagerCommandHandlers,
@Nullable ReactPackageTurboModuleManagerDelegate.Builder tmmDelegateBuilder,
Expand Down Expand Up @@ -296,7 +292,6 @@ public void invokeDefaultOnBackPressed() {
}
mPackages.addAll(packages);
}
mJSIModulePackage = jsiModulePackage;
mUIManagerProvider = uIManagerProvider;

// Instantiate ReactChoreographer in UI thread.
Expand Down Expand Up @@ -1401,19 +1396,15 @@ private ReactApplicationContext createReactContext(
}
}

if (mJSIModulePackage != null) {
catalystInstance.addJSIModules(
mJSIModulePackage.getJSIModules(
reactContext, catalystInstance.getJavaScriptContextHolder()));
}
if (mUIManagerProvider != null) {
UIManager uiManager = mUIManagerProvider.createUIManager(reactContext);
if (uiManager != null) {
catalystInstance.setFabricUIManager(uiManager);

// Initialize the UIManager
uiManager.initialize();
catalystInstance.setFabricUIManager(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 @@ -20,7 +20,6 @@
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.bridge.JSBundleLoader;
import com.facebook.react.bridge.JSExceptionHandler;
import com.facebook.react.bridge.JSIModulePackage;
import com.facebook.react.bridge.JavaScriptExecutorFactory;
import com.facebook.react.bridge.NotThreadSafeBridgeIdleDebugListener;
import com.facebook.react.bridge.UIManagerProvider;
Expand Down Expand Up @@ -68,7 +67,6 @@ public class ReactInstanceManagerBuilder {
private @Nullable JavaScriptExecutorFactory mJavaScriptExecutorFactory;
private int mMinNumShakes = 1;
private int mMinTimeLeftInFrameForNonBatchedOperationMs = -1;
private @Nullable JSIModulePackage mJSIModulesPackage;
private @Nullable UIManagerProvider mUIManagerProvider;
private @Nullable Map<String, RequestHandler> mCustomPackagerCommandHandlers;
private @Nullable ReactPackageTurboModuleManagerDelegate.Builder mTMMDelegateBuilder;
Expand All @@ -79,12 +77,6 @@ public class ReactInstanceManagerBuilder {

/* package protected */ ReactInstanceManagerBuilder() {}

public ReactInstanceManagerBuilder setJSIModulesPackage(
@Nullable JSIModulePackage jsiModulePackage) {
mJSIModulesPackage = jsiModulePackage;
return this;
}

/** Factory for desired implementation of JavaScriptExecutor. */
public ReactInstanceManagerBuilder setJavaScriptExecutorFactory(
@Nullable JavaScriptExecutorFactory javaScriptExecutorFactory) {
Expand Down Expand Up @@ -361,7 +353,6 @@ public ReactInstanceManager build() {
mDevBundleDownloadListener,
mMinNumShakes,
mMinTimeLeftInFrameForNonBatchedOperationMs,
mJSIModulesPackage,
mUIManagerProvider,
mCustomPackagerCommandHandlers,
mTMMDelegateBuilder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import android.app.Application;
import androidx.annotation.Nullable;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.bridge.JSIModulePackage;
import com.facebook.react.bridge.JavaScriptExecutorFactory;
import com.facebook.react.bridge.ReactMarker;
import com.facebook.react.bridge.ReactMarkerConstants;
Expand Down Expand Up @@ -85,7 +84,6 @@ protected ReactInstanceManager createReactInstanceManager() {
.setLazyViewManagersEnabled(getLazyViewManagersEnabled())
.setRedBoxHandler(getRedBoxHandler())
.setJavaScriptExecutorFactory(getJavaScriptExecutorFactory())
.setJSIModulesPackage(getJSIModulePackage())
.setUIManagerProvider(getUIManagerProvider())
.setInitialLifecycleState(LifecycleState.BEFORE_CREATE)
.setReactPackageTurboModuleManagerDelegateBuilder(
Expand Down Expand Up @@ -127,10 +125,6 @@ protected final Application getApplication() {
return mApplication;
}

protected @Nullable JSIModulePackage getJSIModulePackage() {
return null;
}

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

0 comments on commit 6555205

Please sign in to comment.