Skip to content

Commit

Permalink
fix: revert devmanager
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqingchen committed Nov 5, 2024
1 parent 340356d commit 89eed1c
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 220 deletions.
13 changes: 0 additions & 13 deletions android/app/src/main/java/com/tarodemo/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,10 @@ import expo.modules.ReactActivityDelegateWrapper

import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.tarodemo.devmanager.TaroDevManager
import android.os.Bundle
import org.devio.rn.splashscreen.SplashScreen
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate

class MainActivity : ReactActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
SplashScreen.show(this)
super.onCreate(null)
}

override fun finish() {
// clear ReactNativeHost on Activity finish
TaroDevManager.clearReactNativeHost()
super.finish()
}

/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
Expand Down
28 changes: 15 additions & 13 deletions android/app/src/main/java/com/tarodemo/MainApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,29 @@ import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.flipper.ReactNativeFlipper
import com.facebook.soloader.SoLoader

import com.tarodemo.devmanager.TaroDevManager
import com.tarodemo.devmanager.TaroReactNativeHost

class MainApplication : Application(), ReactApplication {

companion object {
lateinit var instance: MainApplication
private set
}
override val reactNativeHost: ReactNativeHost =
ReactNativeHostWrapper(this, object : DefaultReactNativeHost(this) {
override fun getPackages(): List<ReactPackage> {
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return PackageList(this).packages
}

override fun getJSMainModuleName(): String = "index"

private val mTaroReactNativeHost: TaroReactNativeHost = TaroReactNativeHost(this)
private val mReactNativeHost: ReactNativeHost = ReactNativeHostWrapper(this, mTaroReactNativeHost)
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG

override val reactNativeHost: ReactNativeHost get() = mReactNativeHost
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
})

fun getTaroReactNativeHost(): TaroReactNativeHost = mTaroReactNativeHost
override val reactHost: ReactHost
get() = getDefaultReactHost(this.applicationContext, reactNativeHost)

override fun onCreate() {
super.onCreate()
instance = this
TaroDevManager.init()
SoLoader.init(this, false)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
rootProject.name = 'taroDemo'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')
includeBuild(file('../node_modules/@react-native/gradle-plugin').toPath().toRealPath().toAbsolutePath().toString())

apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
useExpoModules()

0 comments on commit 89eed1c

Please sign in to comment.