BuzActivity.kt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package com.trust.ywx
  2. import android.os.Bundle
  3. import android.widget.Toast
  4. import com.facebook.react.ReactActivity
  5. import com.facebook.react.ReactActivityDelegate
  6. import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
  7. import com.facebook.react.defaults.DefaultReactActivityDelegate
  8. import com.trust.ywx.multiple.MultipleReactActivityDelegate
  9. import com.trust.ywx.specs.navigation.NavigationHelper
  10. class BuzActivity : ReactActivity() {
  11. /**
  12. * Returns the name of the main component registered from JavaScript. This is used to schedule
  13. * rendering of the component.
  14. */
  15. override fun getMainComponentName(): String = NavigationHelper.routerName
  16. /**
  17. * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
  18. * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
  19. */
  20. override fun createReactActivityDelegate(): ReactActivityDelegate =
  21. if (BuildConfig.DEBUG) DefaultReactActivityDelegate(
  22. this,
  23. mainComponentName,
  24. fabricEnabled
  25. ) else
  26. MultipleReactActivityDelegate(this, NavigationHelper.routerName, fabricEnabled)
  27. override fun onCreate(savedInstanceState: Bundle?) {
  28. super.onCreate(savedInstanceState)
  29. AppManager.addActivity(this)
  30. }
  31. override fun onResume() {
  32. super.onResume()
  33. }
  34. override fun onDestroy() {
  35. AppManager.removeActivity(this)
  36. super.onDestroy()
  37. }
  38. }