From efdf73983cef1f371511b6e1efa5e01835ebcabb Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Fri, 4 Jul 2025 10:33:18 -0700 Subject: [PATCH] Deprecate the DefaultNewArchitectureEntryPoint.load(Boolean, Boolean, Boolean) (#52439) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52439 Users should not be passing true/false values for the 3 params in the `load()` method. The app template already uses the no param overload. I'm deprecating it so it can go in 0.81. Changelog: [Android] [Changed] - Deprecate the DefaultNewArchitectureEntryPoint.load(Boolean, Boolean, Boolean) Reviewed By: rubennorte Differential Revision: D77739268 fbshipit-source-id: c901d1ed2e9623b0fa39f4e2d79f25404c284b8d --- .../ReactAndroid/api/ReactAndroid.api | 2 + .../DefaultNewArchitectureEntryPoint.kt | 41 ++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index a73ae3675b3..deae6cb36b9 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -1867,6 +1867,8 @@ public final class com/facebook/react/defaults/DefaultNewArchitectureEntryPoint public static final fun load (Z)V public static final fun load (ZZ)V public static final fun load (ZZZ)V + public static synthetic fun load$default (ZILjava/lang/Object;)V + public static synthetic fun load$default (ZZILjava/lang/Object;)V public static synthetic fun load$default (ZZZILjava/lang/Object;)V public final fun setReleaseLevel (Lcom/facebook/react/common/ReleaseLevel;)V } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt index 9806fece9e8..8070e2d885d 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt @@ -33,8 +33,47 @@ public object DefaultNewArchitectureEntryPoint { public var releaseLevel: ReleaseLevel = ReleaseLevel.STABLE + /** + * Loads the React Native New Architecture entry point with the default configuration. + * + * This will load the app with TurboModules, Fabric and Bridgeless by default. + */ @JvmStatic - @JvmOverloads + public fun load() { + load(turboModulesEnabled = true, fabricEnabled = true, bridgelessEnabled = true) + } + + @JvmStatic + @Deprecated( + message = + "Loading the entry point with different flags for Fabric, TurboModule and Bridgeless is deprecated." + + "Please use load() instead when loading the New Architecture.", + replaceWith = ReplaceWith("load()")) + public fun load( + turboModulesEnabled: Boolean = true, + ) { + load(turboModulesEnabled, fabricEnabled = true, bridgelessEnabled = true) + } + + @JvmStatic + @Deprecated( + message = + "Loading the entry point with different flags for Fabric, TurboModule and Bridgeless is deprecated." + + "Please use load() instead when loading the New Architecture.", + replaceWith = ReplaceWith("load()")) + public fun load( + turboModulesEnabled: Boolean = true, + fabricEnabled: Boolean = true, + ) { + load(turboModulesEnabled, fabricEnabled, bridgelessEnabled = true) + } + + @JvmStatic + @Deprecated( + message = + "Loading the entry point with different flags for Fabric, TurboModule and Bridgeless is deprecated." + + "Please use load() instead when loading the New Architecture.", + replaceWith = ReplaceWith("load()")) public fun load( turboModulesEnabled: Boolean = true, fabricEnabled: Boolean = true,