|
@@ -1,5 +1,7 @@
|
|
|
package com.strides.chargeco
|
|
package com.strides.chargeco
|
|
|
|
|
|
|
|
|
|
+import android.os.Bundle
|
|
|
|
|
+
|
|
|
import com.facebook.react.ReactActivity
|
|
import com.facebook.react.ReactActivity
|
|
|
import com.facebook.react.ReactActivityDelegate
|
|
import com.facebook.react.ReactActivityDelegate
|
|
|
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
|
|
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
|
|
@@ -19,4 +21,11 @@ class MainActivity : ReactActivity() {
|
|
|
*/
|
|
*/
|
|
|
override fun createReactActivityDelegate(): ReactActivityDelegate =
|
|
override fun createReactActivityDelegate(): ReactActivityDelegate =
|
|
|
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
|
|
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
|
|
|
|
|
+
|
|
|
|
|
+ override fun onSaveInstanceState(outState: Bundle) {
|
|
|
|
|
+ // 清空 Fragment 状态,防止 ScreenFragment crash
|
|
|
|
|
+ outState.putParcelable("android:support:fragments", null)
|
|
|
|
|
+ // 调用父类方法保存其他状态
|
|
|
|
|
+ super.onSaveInstanceState(outState)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|