Skip to content

Commit

Permalink
Remove jsBundleLoader from DefaultReactHost.getDefaultReactHost (#47684)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #47684

jsBundleLoader parameter was added into DefaultReactHost.getDefaultReactHost but we decided to revert this change.
We want to keep DefaultReactHost.getDefaultReactHost as simple as possible and we don't want to include this change in 0.77

changelog: [Android][Breaking] Remove jsBundleLoader from DefaultReactHost.getDefaultReactHost()

Reviewed By: shwanton

Differential Revision: D66131197

fbshipit-source-id: 7451bb55d7953d3282b23d23ad15e91bae71ff24
  • Loading branch information
mdvacca authored and facebook-github-bot committed Nov 19, 2024
1 parent cc5f17d commit fbe4c0e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
8 changes: 4 additions & 4 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -2037,10 +2037,10 @@ public class com/facebook/react/defaults/DefaultReactActivityDelegate : com/face
public final class com/facebook/react/defaults/DefaultReactHost {
public static final field INSTANCE Lcom/facebook/react/defaults/DefaultReactHost;
public static final fun getDefaultReactHost (Landroid/content/Context;Lcom/facebook/react/ReactNativeHost;)Lcom/facebook/react/ReactHost;
public static final fun getDefaultReactHost (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZLjava/util/List;Lcom/facebook/react/bridge/JSBundleLoader;)Lcom/facebook/react/ReactHost;
public static final fun getDefaultReactHost (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZLjava/util/List;Lcom/facebook/react/bridge/JSBundleLoader;Lkotlin/jvm/functions/Function1;)Lcom/facebook/react/ReactHost;
public static synthetic fun getDefaultReactHost$default (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZLjava/util/List;Lcom/facebook/react/bridge/JSBundleLoader;ILjava/lang/Object;)Lcom/facebook/react/ReactHost;
public static synthetic fun getDefaultReactHost$default (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZLjava/util/List;Lcom/facebook/react/bridge/JSBundleLoader;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/facebook/react/ReactHost;
public static final fun getDefaultReactHost (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZLjava/util/List;)Lcom/facebook/react/ReactHost;
public static final fun getDefaultReactHost (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZLjava/util/List;Lkotlin/jvm/functions/Function1;)Lcom/facebook/react/ReactHost;
public static synthetic fun getDefaultReactHost$default (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZLjava/util/List;ILjava/lang/Object;)Lcom/facebook/react/ReactHost;
public static synthetic fun getDefaultReactHost$default (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZLjava/util/List;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/facebook/react/ReactHost;
}

public abstract class com/facebook/react/defaults/DefaultReactNativeHost : com/facebook/react/ReactNativeHost {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public object DefaultReactHost {
isHermesEnabled: Boolean = true,
useDevSupport: Boolean = ReactBuildConfig.DEBUG,
cxxReactPackageProviders: List<(ReactContext) -> CxxReactPackage> = emptyList(),
jsBundleLoader: JSBundleLoader? = null,
): ReactHost =
getDefaultReactHost(
context,
Expand All @@ -71,8 +70,7 @@ public object DefaultReactHost {
jsBundleFilePath,
isHermesEnabled,
useDevSupport,
cxxReactPackageProviders,
jsBundleLoader) {
cxxReactPackageProviders) {
throw it
}

Expand Down Expand Up @@ -107,22 +105,20 @@ public object DefaultReactHost {
isHermesEnabled: Boolean = true,
useDevSupport: Boolean = ReactBuildConfig.DEBUG,
cxxReactPackageProviders: List<(ReactContext) -> CxxReactPackage> = emptyList(),
jsBundleLoader: JSBundleLoader? = null,
exceptionHandler: (Exception) -> Unit = { throw it },
): ReactHost {
if (reactHost == null) {

val bundleLoader =
jsBundleLoader
?: if (jsBundleFilePath != null) {
if (jsBundleFilePath.startsWith("assets://")) {
JSBundleLoader.createAssetLoader(context, jsBundleFilePath, true)
} else {
JSBundleLoader.createFileLoader(jsBundleFilePath)
}
} else {
JSBundleLoader.createAssetLoader(context, "assets://$jsBundleAssetPath", true)
}
if (jsBundleFilePath != null) {
if (jsBundleFilePath.startsWith("assets://")) {
JSBundleLoader.createAssetLoader(context, jsBundleFilePath, true)
} else {
JSBundleLoader.createFileLoader(jsBundleFilePath)
}
} else {
JSBundleLoader.createAssetLoader(context, "assets://$jsBundleAssetPath", true)
}
val jsRuntimeFactory = if (isHermesEnabled) HermesInstance() else JSCInstance()
val defaultTmmDelegateBuilder = DefaultTurboModuleManagerDelegate.Builder()
cxxReactPackageProviders.forEach { defaultTmmDelegateBuilder.addCxxReactPackage(it) }
Expand Down

0 comments on commit fbe4c0e

Please sign in to comment.