diff --git a/packages/react-native/ReactAndroid/flipper-integration/src/debug/java/com/facebook/react/flipper/ReactNativeFlipper.kt b/packages/react-native/ReactAndroid/flipper-integration/src/debug/java/com/facebook/react/flipper/ReactNativeFlipper.kt index ecbef22f773105..e4bad1d94ed439 100644 --- a/packages/react-native/ReactAndroid/flipper-integration/src/debug/java/com/facebook/react/flipper/ReactNativeFlipper.kt +++ b/packages/react-native/ReactAndroid/flipper-integration/src/debug/java/com/facebook/react/flipper/ReactNativeFlipper.kt @@ -21,6 +21,7 @@ import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPl import com.facebook.react.ReactInstanceEventListener import com.facebook.react.ReactInstanceManager import com.facebook.react.bridge.ReactContext +import com.facebook.react.config.ReactFeatureFlags import com.facebook.react.modules.network.NetworkingModule /** @@ -30,6 +31,9 @@ import com.facebook.react.modules.network.NetworkingModule object ReactNativeFlipper { @JvmStatic fun initializeFlipper(context: Context, reactInstanceManager: ReactInstanceManager) { + if (ReactFeatureFlags.enableBridgelessArchitecture) { + return + } if (FlipperUtils.shouldEnableFlipper(context)) { val client = AndroidFlipperClient.getInstance(context) client.addPlugin(InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())) diff --git a/packages/react-native/template/android/app/src/main/java/com/helloworld/MainApplication.kt b/packages/react-native/template/android/app/src/main/java/com/helloworld/MainApplication.kt index 77a64826ad98c7..7314ad2aad3084 100644 --- a/packages/react-native/template/android/app/src/main/java/com/helloworld/MainApplication.kt +++ b/packages/react-native/template/android/app/src/main/java/com/helloworld/MainApplication.kt @@ -5,11 +5,15 @@ import com.facebook.react.PackageList import com.facebook.react.ReactApplication import com.facebook.react.ReactNativeHost import com.facebook.react.ReactPackage +import com.facebook.react.common.annotations.UnstableReactNativeAPI import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load +import com.facebook.react.defaults.DefaultReactHost import com.facebook.react.defaults.DefaultReactNativeHost import com.facebook.react.flipper.ReactNativeFlipper +import com.facebook.react.interfaces.ReactHost import com.facebook.soloader.SoLoader +@UnstableReactNativeAPI class MainApplication : Application(), ReactApplication { override val reactNativeHost: ReactNativeHost = @@ -28,6 +32,14 @@ class MainApplication : Application(), ReactApplication { override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED } + override val reactHost: ReactHost + get() = + DefaultReactHost.getDefaultReactHost( + context = this, + packageList = PackageList(this).packages, + jsMainModulePath = "index", + isHermesEnabled = BuildConfig.IS_HERMES_ENABLED) + override fun onCreate() { super.onCreate() SoLoader.init(this, false)