Screen fragments should never be restored. Follow instructions from https://github.com/software-mansion/react-native-screens/issues/17#issuecomment-424704067 to properly configure your main activity.
这是 react-native-screens 库导入后 可能触发的一个崩溃问题 官方集成时更改
import android.os.Bundle; public class MainActivity extends ReactActivity { //...code //react-native-screens override @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(null); } public static class MainActivityDelegate extends ReactActivityDelegate { //...code } }
但是你导入react-native-orientation 可能会出现白屏问题这里我的解决方法是 配置 AndroidManifest.xml 里activity的
android:configChanges(在运行时发生配置变更时,默认情况下会关闭 activity 并将其重启,但使用该属性声明配置将阻止 activity 重启。相反,activity 会保持运行状态,并且系统会调用其 onConfigurationChanged()
方法。)
<activity android:name=".RN容器Activity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:windowSoftInputMode="adjustResize" />