mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Move defaults for DevSupportManagerFactory.create() into the interface signature (#57429)
Summary: Pull Request resolved: https://github.com/react/react-native/pull/57429 The optional parameters on `DevSupportManagerFactory.create()` (the New Architecture overload) all have canonical defaults, but callers were forced to pass every one explicitly. Move the defaults into the interface signature so callers only specify the parameters that vary — `applicationContext`, `reactInstanceManagerHelper`, `packagerPathForJSBundleName`, and `useDevSupport`. This also lets external factories inject a `customPackagerCommandHandlers` map without having to repeat the eleven other arguments. `ReactHostImpl` is updated to use the shorter form. JVM signatures are unchanged (Kotlin default values on abstract interface methods don't emit bridge methods), so no ABI change for Java callers. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D110599799 fbshipit-source-id: 02d4b886f3131b47ed830a7e603cb60cbdd96b02
This commit is contained in:
1 parent
4cd278242b
commit
f5dc3991a2
3 files changed
+20
-18
No files matched your search
@@ -1950,6 +1950,11 @@ public final class com/facebook/react/devsupport/DevSupportManagerBase$Companion
|
||||
public abstract interface class com/facebook/react/devsupport/DevSupportManagerFactory {
|
||||
public abstract fun create (Landroid/content/Context;Lcom/facebook/react/devsupport/ReactInstanceDevHelper;Ljava/lang/String;ZLcom/facebook/react/devsupport/interfaces/RedBoxHandler;Lcom/facebook/react/devsupport/interfaces/DevBundleDownloadListener;ILjava/util/Map;Lcom/facebook/react/common/SurfaceDelegateFactory;Lcom/facebook/react/devsupport/interfaces/DevLoadingViewManager;Lcom/facebook/react/devsupport/interfaces/PausedInDebuggerOverlayManager;)Lcom/facebook/react/devsupport/interfaces/DevSupportManager;
|
||||
public abstract fun create (Landroid/content/Context;Lcom/facebook/react/devsupport/ReactInstanceDevHelper;Ljava/lang/String;ZLcom/facebook/react/devsupport/interfaces/RedBoxHandler;Lcom/facebook/react/devsupport/interfaces/DevBundleDownloadListener;ILjava/util/Map;Lcom/facebook/react/common/SurfaceDelegateFactory;Lcom/facebook/react/devsupport/interfaces/DevLoadingViewManager;Lcom/facebook/react/devsupport/interfaces/PausedInDebuggerOverlayManager;Z)Lcom/facebook/react/devsupport/interfaces/DevSupportManager;
|
||||
public static synthetic fun create$default (Lcom/facebook/react/devsupport/DevSupportManagerFactory;Landroid/content/Context;Lcom/facebook/react/devsupport/ReactInstanceDevHelper;Ljava/lang/String;ZLcom/facebook/react/devsupport/interfaces/RedBoxHandler;Lcom/facebook/react/devsupport/interfaces/DevBundleDownloadListener;ILjava/util/Map;Lcom/facebook/react/common/SurfaceDelegateFactory;Lcom/facebook/react/devsupport/interfaces/DevLoadingViewManager;Lcom/facebook/react/devsupport/interfaces/PausedInDebuggerOverlayManager;ZILjava/lang/Object;)Lcom/facebook/react/devsupport/interfaces/DevSupportManager;
|
||||
}
|
||||
|
||||
public final class com/facebook/react/devsupport/DevSupportManagerFactory$DefaultImpls {
|
||||
public static synthetic fun create$default (Lcom/facebook/react/devsupport/DevSupportManagerFactory;Landroid/content/Context;Lcom/facebook/react/devsupport/ReactInstanceDevHelper;Ljava/lang/String;ZLcom/facebook/react/devsupport/interfaces/RedBoxHandler;Lcom/facebook/react/devsupport/interfaces/DevBundleDownloadListener;ILjava/util/Map;Lcom/facebook/react/common/SurfaceDelegateFactory;Lcom/facebook/react/devsupport/interfaces/DevLoadingViewManager;Lcom/facebook/react/devsupport/interfaces/PausedInDebuggerOverlayManager;ZILjava/lang/Object;)Lcom/facebook/react/devsupport/interfaces/DevSupportManager;
|
||||
}
|
||||
|
||||
public final class com/facebook/react/devsupport/DoubleTapReloadRecognizer {
|
||||
@@ -3017,6 +3022,8 @@ public final class com/facebook/react/runtime/ReactHostImpl : com/facebook/react
|
||||
public fun <init> (Landroid/content/Context;Lcom/facebook/react/runtime/ReactHostDelegate;Lcom/facebook/react/fabric/ComponentFactory;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;ZZLcom/facebook/react/devsupport/DevSupportManagerFactory;)V
|
||||
public synthetic fun <init> (Landroid/content/Context;Lcom/facebook/react/runtime/ReactHostDelegate;Lcom/facebook/react/fabric/ComponentFactory;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;ZZLcom/facebook/react/devsupport/DevSupportManagerFactory;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun <init> (Landroid/content/Context;Lcom/facebook/react/runtime/ReactHostDelegate;Lcom/facebook/react/fabric/ComponentFactory;ZZ)V
|
||||
public fun <init> (Landroid/content/Context;Lcom/facebook/react/runtime/ReactHostDelegate;Lcom/facebook/react/fabric/ComponentFactory;ZZLcom/facebook/react/devsupport/DevSupportManagerFactory;)V
|
||||
public synthetic fun <init> (Landroid/content/Context;Lcom/facebook/react/runtime/ReactHostDelegate;Lcom/facebook/react/fabric/ComponentFactory;ZZLcom/facebook/react/devsupport/DevSupportManagerFactory;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun addBeforeDestroyListener (Lkotlin/jvm/functions/Function0;)V
|
||||
public fun addReactInstanceEventListener (Lcom/facebook/react/ReactInstanceEventListener;)V
|
||||
public fun createSurface (Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;)Lcom/facebook/react/interfaces/fabric/ReactSurface;
|
||||
|
||||
+10
-10
@@ -48,15 +48,15 @@ public interface DevSupportManagerFactory {
|
||||
public fun create(
|
||||
applicationContext: Context,
|
||||
reactInstanceManagerHelper: ReactInstanceDevHelper,
|
||||
packagerPathForJSBundleName: String?,
|
||||
enableOnCreate: Boolean,
|
||||
redBoxHandler: RedBoxHandler?,
|
||||
devBundleDownloadListener: DevBundleDownloadListener?,
|
||||
minNumShakes: Int,
|
||||
customPackagerCommandHandlers: Map<String, RequestHandler>?,
|
||||
surfaceDelegateFactory: SurfaceDelegateFactory?,
|
||||
devLoadingViewManager: DevLoadingViewManager?,
|
||||
pausedInDebuggerOverlayManager: PausedInDebuggerOverlayManager?,
|
||||
useDevSupport: Boolean,
|
||||
packagerPathForJSBundleName: String? = null,
|
||||
enableOnCreate: Boolean = true,
|
||||
redBoxHandler: RedBoxHandler? = null,
|
||||
devBundleDownloadListener: DevBundleDownloadListener? = null,
|
||||
minNumShakes: Int = 2,
|
||||
customPackagerCommandHandlers: Map<String, RequestHandler>? = null,
|
||||
surfaceDelegateFactory: SurfaceDelegateFactory? = null,
|
||||
devLoadingViewManager: DevLoadingViewManager? = null,
|
||||
pausedInDebuggerOverlayManager: PausedInDebuggerOverlayManager? = null,
|
||||
useDevSupport: Boolean = true,
|
||||
): DevSupportManager
|
||||
}
|
||||
+3
-8
@@ -113,14 +113,6 @@ public class ReactHostImpl(
|
||||
applicationContext = context.applicationContext,
|
||||
reactInstanceManagerHelper = reactHostImplDevHelper,
|
||||
packagerPathForJSBundleName = reactHostDelegate.jsMainModulePath,
|
||||
enableOnCreate = true,
|
||||
redBoxHandler = null,
|
||||
devBundleDownloadListener = null,
|
||||
minNumShakes = 2,
|
||||
customPackagerCommandHandlers = null,
|
||||
surfaceDelegateFactory = null,
|
||||
devLoadingViewManager = null,
|
||||
pausedInDebuggerOverlayManager = null,
|
||||
useDevSupport = useDevSupport,
|
||||
)
|
||||
.also { devSupportManager ->
|
||||
@@ -156,12 +148,14 @@ public class ReactHostImpl(
|
||||
|
||||
@Volatile private var hostInvalidated = false
|
||||
|
||||
@JvmOverloads
|
||||
public constructor(
|
||||
context: Context,
|
||||
delegate: ReactHostDelegate,
|
||||
componentFactory: ComponentFactory,
|
||||
allowPackagerServerAccess: Boolean,
|
||||
useDevSupport: Boolean,
|
||||
devSupportManagerFactory: DevSupportManagerFactory? = null,
|
||||
) : this(
|
||||
context,
|
||||
delegate,
|
||||
@@ -170,6 +164,7 @@ public class ReactHostImpl(
|
||||
Task.UI_THREAD_EXECUTOR,
|
||||
allowPackagerServerAccess,
|
||||
useDevSupport,
|
||||
devSupportManagerFactory,
|
||||
)
|
||||
|
||||
public override val lifecycleState: LifecycleState
|
||||
|
||||
Reference in new issue
Block a user