Skip to content

Commit 89eed1c

Browse files
committed
fix: revert devmanager
1 parent 340356d commit 89eed1c

8 files changed

+16
-220
lines changed

android/app/src/main/java/com/tarodemo/MainActivity.kt

-13
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,10 @@ import expo.modules.ReactActivityDelegateWrapper
33

44
import com.facebook.react.ReactActivity
55
import com.facebook.react.ReactActivityDelegate
6-
import com.tarodemo.devmanager.TaroDevManager
7-
import android.os.Bundle
8-
import org.devio.rn.splashscreen.SplashScreen
96
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
107
import com.facebook.react.defaults.DefaultReactActivityDelegate
118

129
class MainActivity : ReactActivity() {
13-
override fun onCreate(savedInstanceState: Bundle?) {
14-
SplashScreen.show(this)
15-
super.onCreate(null)
16-
}
17-
18-
override fun finish() {
19-
// clear ReactNativeHost on Activity finish
20-
TaroDevManager.clearReactNativeHost()
21-
super.finish()
22-
}
2310

2411
/**
2512
* Returns the name of the main component registered from JavaScript. This is used to schedule

android/app/src/main/java/com/tarodemo/MainApplication.kt

+15-13
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,29 @@ import com.facebook.react.defaults.DefaultReactNativeHost
1515
import com.facebook.react.flipper.ReactNativeFlipper
1616
import com.facebook.soloader.SoLoader
1717

18-
import com.tarodemo.devmanager.TaroDevManager
19-
import com.tarodemo.devmanager.TaroReactNativeHost
20-
2118
class MainApplication : Application(), ReactApplication {
2219

23-
companion object {
24-
lateinit var instance: MainApplication
25-
private set
26-
}
20+
override val reactNativeHost: ReactNativeHost =
21+
ReactNativeHostWrapper(this, object : DefaultReactNativeHost(this) {
22+
override fun getPackages(): List<ReactPackage> {
23+
// Packages that cannot be autolinked yet can be added manually here, for example:
24+
// packages.add(new MyReactNativePackage());
25+
return PackageList(this).packages
26+
}
27+
28+
override fun getJSMainModuleName(): String = "index"
2729

28-
private val mTaroReactNativeHost: TaroReactNativeHost = TaroReactNativeHost(this)
29-
private val mReactNativeHost: ReactNativeHost = ReactNativeHostWrapper(this, mTaroReactNativeHost)
30+
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
3031

31-
override val reactNativeHost: ReactNativeHost get() = mReactNativeHost
32+
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
33+
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
34+
})
3235

33-
fun getTaroReactNativeHost(): TaroReactNativeHost = mTaroReactNativeHost
36+
override val reactHost: ReactHost
37+
get() = getDefaultReactHost(this.applicationContext, reactNativeHost)
3438

3539
override fun onCreate() {
3640
super.onCreate()
37-
instance = this
38-
TaroDevManager.init()
3941
SoLoader.init(this, false)
4042
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
4143
// If you opted-in for the New Architecture, we load the native entry point for this app.

android/app/src/main/java/com/tarodemo/devmanager/DevManagerPackage.kt

-16
This file was deleted.

android/app/src/main/java/com/tarodemo/devmanager/RNDevManagerModule.kt

-22
This file was deleted.

android/app/src/main/java/com/tarodemo/devmanager/SourceCodeModule.kt

-29
This file was deleted.

android/app/src/main/java/com/tarodemo/devmanager/TaroDevManager.kt

-99
This file was deleted.

android/app/src/main/java/com/tarodemo/devmanager/TaroReactNativeHost.kt

-27
This file was deleted.

android/settings.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
rootProject.name = 'taroDemo'
22
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
33
include ':app'
4-
includeBuild('../node_modules/@react-native/gradle-plugin')
4+
includeBuild(file('../node_modules/@react-native/gradle-plugin').toPath().toRealPath().toAbsolutePath().toString())
55

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

0 commit comments

Comments
 (0)