Skip to content

Commit

Permalink
Enable Template with Bridgeless (facebook#39661)
Browse files Browse the repository at this point in the history
Summary:

Changelog:
[Android][Changed] - Enable Template with Bridgeless

Reviewed By: cortinico

Differential Revision: D49464580
  • Loading branch information
luluwu2032 authored and facebook-github-bot committed Sep 26, 2023
1 parent 35a6630 commit 687438a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand All @@ -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()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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)
Expand Down

0 comments on commit 687438a

Please sign in to comment.