From bda6acf3b08779c0dae7bdadbc9913eea79acd0d Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Thu, 21 Aug 2025 04:51:13 -0700 Subject: [PATCH] Remove deprecated DefaultReactHost.getDefaultReactHost() overload - part 2 (#53374) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53374 This method was deprecated in React Native 0.79. We should be able to remove it without impact in 0.82. I also verified that there are no users of this API in OSS. There is also a 1:1 replacement for this API which is the other non-deprecated getDefaultReactHost() method. Changelog: [Android] [Removed] - Remove deprecated DefaultReactHost.getDefaultReactHost() overload - part 2 Reviewed By: mdvacca Differential Revision: D80623826 fbshipit-source-id: f201e99f7cd437a47919c36eced5637481151822 --- .../ReactAndroid/api/ReactAndroid.api | 2 - .../react/defaults/DefaultReactHost.kt | 66 ------------------- 2 files changed, 68 deletions(-) diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 44b1e7cfe73..53c415d9653 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -1865,11 +1865,9 @@ public final class com/facebook/react/defaults/DefaultReactHost { public static final fun getDefaultReactHost (Landroid/content/Context;Lcom/facebook/react/ReactNativeHost;Lcom/facebook/react/runtime/JSRuntimeFactory;)Lcom/facebook/react/ReactHost; public static final fun getDefaultReactHost (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/runtime/JSRuntimeFactory;ZLjava/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;Lcom/facebook/react/runtime/JSRuntimeFactory;ZLjava/util/List;Lkotlin/jvm/functions/Function1;Lcom/facebook/react/runtime/BindingsInstaller;)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/runtime/BindingsInstaller;)Lcom/facebook/react/ReactHost; public static synthetic fun getDefaultReactHost$default (Landroid/content/Context;Lcom/facebook/react/ReactNativeHost;Lcom/facebook/react/runtime/JSRuntimeFactory;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;Lcom/facebook/react/runtime/JSRuntimeFactory;ZLjava/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;Lcom/facebook/react/runtime/JSRuntimeFactory;ZLjava/util/List;Lkotlin/jvm/functions/Function1;Lcom/facebook/react/runtime/BindingsInstaller;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;Lcom/facebook/react/runtime/BindingsInstaller;ILjava/lang/Object;)Lcom/facebook/react/ReactHost; } public abstract class com/facebook/react/defaults/DefaultReactNativeHost : com/facebook/react/ReactNativeHost { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHost.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHost.kt index e6c62e17e73..712f29cd03c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHost.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHost.kt @@ -154,72 +154,6 @@ public object DefaultReactHost { return reactHost as ReactHost } - /** - * Util function to create a default [ReactHost] to be used in your application. This method is - * used by the New App template. - * - * @param context the Android [Context] to use for creating the [ReactHost] - * @param packageList the list of [ReactPackage]s to use for creating the [ReactHost] - * @param jsMainModulePath the path to your app's main module on Metro. Usually `index` or - * `index.` - * @param jsBundleAssetPath the path to the JS bundle relative to the assets directory. Will be - * composed in a `asset://...` URL - * @param jsBundleFilePath the path to the JS bundle on the filesystem. Will be composed in a - * `file://...` URL - * @param isHermesEnabled whether to use Hermes as the JS engine, default to true. - * @param useDevSupport whether to enable dev support, default to ReactBuildConfig.DEBUG. - * @param cxxReactPackageProviders a list of cxxreactpackage providers (to register c++ turbo - * modules) - * @param exceptionHandler Callback that can be used by React Native host applications to react to - * exceptions thrown by the internals of React Native. - * @param bindingsInstaller that can be used for installing bindings. - */ - @Deprecated( - message = "Use `getDefaultReactHost` with `jsRuntimeFactory` instead", - replaceWith = - ReplaceWith( - """ - fun getDefaultReactHost( - context: Context, - packageList: List, - jsMainModulePath: String, - jsBundleAssetPath: String, - jsBundleFilePath: String?, - jsRuntimeFactory: JSRuntimeFactory?, - useDevSupport: Boolean, - cxxReactPackageProviders: List<(ReactContext) -> CxxReactPackage>, - exceptionHandler: (Exception) -> Unit, - bindingsInstaller: BindingsInstaller?, - ): ReactHost - """ - ), - ) - @JvmStatic - public fun getDefaultReactHost( - context: Context, - packageList: List, - jsMainModulePath: String = "index", - jsBundleAssetPath: String = "index", - jsBundleFilePath: String? = null, - isHermesEnabled: Boolean = true, - useDevSupport: Boolean = ReactBuildConfig.DEBUG, - cxxReactPackageProviders: List<(ReactContext) -> CxxReactPackage> = emptyList(), - exceptionHandler: (Exception) -> Unit = { throw it }, - bindingsInstaller: BindingsInstaller? = null, - ): ReactHost = - getDefaultReactHost( - context, - packageList, - jsMainModulePath, - jsBundleAssetPath, - jsBundleFilePath, - HermesInstance(), - useDevSupport, - cxxReactPackageProviders, - exceptionHandler, - bindingsInstaller, - ) - /** * Util function to create a default [ReactHost] to be used in your application. This method is * used by the New App template.