{"action":"created","issue":{"url":"https://api.github.com/repos/kmagiera/react-native-screens/issues/17","repository_url":"https://api.github.com/repos/kmagiera/react-native-screens","labels_url":"https://api.github.com/repos/kmagiera/react-native-screens/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/kmagiera/react-native-screens/issues/17/comments","events_url":"https://api.github.com/repos/kmagiera/react-native-screens/issues/17/events","html_url":"https://github.com/kmagiera/react-native-screens/issues/17","id":363452137,"node_id":"MDU6SXNzdWUzNjM0NTIxMzc=","number":17,"title":"Android crashes nondeterministically when restoring from background","user":{"login":"ukasiu","id":816363,"node_id":"MDQ6VXNlcjgxNjM2Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/816363?v=4","gravatar_id":"","url":"https://api.github.com/users/ukasiu","html_url":"https://github.com/ukasiu","followers_url":"https://api.github.com/users/ukasiu/followers","following_url":"https://api.github.com/users/ukasiu/following{/other_user}","gists_url":"https://api.github.com/users/ukasiu/gists{/gist_id}","starred_url":"https://api.github.com/users/ukasiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ukasiu/subscriptions","organizations_url":"https://api.github.com/users/ukasiu/orgs","repos_url":"https://api.github.com/users/ukasiu/repos","events_url":"https://api.github.com/users/ukasiu/events{/privacy}","received_events_url":"https://api.github.com/users/ukasiu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-09-25T07:51:09Z","updated_at":"2018-09-28T09:07:21Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nat least in release builds I'm getting crashes when restoring app from background, but not always. I replaced `ReactActivity` with `ReactFragmentActivity`.\r\n\r\n`react-native: 0.57.0`\r\n\r\n```\r\nFatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com._redacted_.app/com._redacted_.app.MainActivity}: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.swmansion.rnscreens.Screen$ScreenFragment: calling Fragment constructor caused an exception\r\n       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2747)\r\n       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2808)\r\n       at android.app.ActivityThread.-wrap12(ActivityThread.java)\r\n       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)\r\n       at android.os.Handler.dispatchMessage(Handler.java:102)\r\n       at android.os.Looper.loop(Looper.java:165)\r\n       at android.app.ActivityThread.main(ActivityThread.java:6365)\r\n       at java.lang.reflect.Method.invoke(Method.java)\r\n       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:883)\r\n       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)\r\n       at android.support.v4.app.Fragment.instantiate(Fragment.java:386)\r\n       at android.support.v4.app.FragmentContainer.instantiate(FragmentContainer.java:33)\r\n       at android.support.v4.app.FragmentState.instantiate(FragmentState.java:79)\r\n       at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:3080)\r\n       at android.support.v4.app.FragmentController.restoreAllState(FragmentController.java:152)\r\n       at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:330)\r\n       at com.facebook.react.ReactFragmentActivity.onCreate(ReactFragmentActivity.java:54)\r\n       at com._redacted_.app.MainActivity.onCreate(MainActivity.java:19)\r\n       at android.app.Activity.performCreate(Activity.java:6852)\r\n       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)\r\n       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2700)\r\n       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2808)\r\n       at android.app.ActivityThread.-wrap12(ActivityThread.java)\r\n       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)\r\n       at android.os.Handler.dispatchMessage(Handler.java:102)\r\n       at android.os.Looper.loop(Looper.java:165)\r\n       at android.app.ActivityThread.main(ActivityThread.java:6365)\r\n       at java.lang.reflect.Method.invoke(Method.java)\r\n       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:883)\r\n       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)\r\nCaused by java.lang.reflect.InvocationTargetException\r\n       at java.lang.reflect.Constructor.newInstance0(Constructor.java)\r\n       at java.lang.reflect.Constructor.newInstance(Constructor.java:430)\r\n       at android.support.v4.app.Fragment.instantiate(Fragment.java:364)\r\n       at android.support.v4.app.FragmentContainer.instantiate(FragmentContainer.java:33)\r\n       at android.support.v4.app.FragmentState.instantiate(FragmentState.java:79)\r\n       at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:3080)\r\n       at android.support.v4.app.FragmentController.restoreAllState(FragmentController.java:152)\r\n       at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:330)\r\n       at com.facebook.react.ReactFragmentActivity.onCreate(ReactFragmentActivity.java:54)\r\n       at com._redacted_.app.MainActivity.onCreate(MainActivity.java:19)\r\n       at android.app.Activity.performCreate(Activity.java:6852)\r\n       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)\r\n       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2700)\r\n       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2808)\r\n       at android.app.ActivityThread.-wrap12(ActivityThread.java)\r\n       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)\r\n       at android.os.Handler.dispatchMessage(Handler.java:102)\r\n       at android.os.Looper.loop(Looper.java:165)\r\n       at android.app.ActivityThread.main(ActivityThread.java:6365)\r\n       at java.lang.reflect.Method.invoke(Method.java)\r\n       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:883)\r\n       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)\r\nCaused by java.lang.IllegalStateException: Screen fragments should never be restored\r\n       at com.swmansion.rnscreens.Screen$ScreenFragment.<init>(Screen.java:19)\r\n       at java.lang.reflect.Constructor.newInstance0(Constructor.java)\r\n       at java.lang.reflect.Constructor.newInstance(Constructor.java:430)\r\n       at android.support.v4.app.Fragment.instantiate(Fragment.java:364)\r\n       at android.support.v4.app.FragmentContainer.instantiate(FragmentContainer.java:33)\r\n       at android.support.v4.app.FragmentState.instantiate(FragmentState.java:79)\r\n       at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:3080)\r\n       at android.support.v4.app.FragmentController.restoreAllState(FragmentController.java:152)\r\n       at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:330)\r\n       at com.facebook.react.ReactFragmentActivity.onCreate(ReactFragmentActivity.java:54)\r\n       at com._redacted_.app.MainActivity.onCreate(MainActivity.java:19)\r\n       at android.app.Activity.performCreate(Activity.java:6852)\r\n       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)\r\n       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2700)\r\n       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2808)\r\n       at android.app.ActivityThread.-wrap12(ActivityThread.java)\r\n       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)\r\n       at android.os.Handler.dispatchMessage(Handler.java:102)\r\n       at android.os.Looper.loop(Looper.java:165)\r\n       at android.app.ActivityThread.main(ActivityThread.java:6365)\r\n       at java.lang.reflect.Method.invoke(Method.java)\r\n       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:883)\r\n       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)\r\n```\r\n\r\n```\r\nFatal Exception: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState\r\n       at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:2053)\r\n       at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:2079)\r\n       at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:678)\r\n       at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:632)\r\n       at com.swmansion.rnscreens.ScreenContainer.tryCommitTransaction(ScreenContainer.java:99)\r\n       at com.swmansion.rnscreens.ScreenContainer.updateIfNeeded(ScreenContainer.java:173)\r\n       at com.swmansion.rnscreens.ScreenContainer.access$000(ScreenContainer.java:21)\r\n       at com.swmansion.rnscreens.ScreenContainer$1.doFrame(ScreenContainer.java:34)\r\n       at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:134)\r\n       at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:105)\r\n       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:964)\r\n       at android.view.Choreographer.doCallbacks(Choreographer.java:778)\r\n       at android.view.Choreographer.doFrame(Choreographer.java:710)\r\n       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952)\r\n       at android.os.Handler.handleCallback(Handler.java:790)\r\n       at android.os.Handler.dispatchMessage(Handler.java:99)\r\n       at android.os.Looper.loop(Looper.java:172)\r\n       at android.app.ActivityThread.main(ActivityThread.java:6590)\r\n       at java.lang.reflect.Method.invoke(Method.java)\r\n       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)\r\n       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)\r\n```"},"comment":{"url":"https://api.github.com/repos/kmagiera/react-native-screens/issues/comments/425372744","html_url":"https://github.com/kmagiera/react-native-screens/issues/17#issuecomment-425372744","issue_url":"https://api.github.com/repos/kmagiera/react-native-screens/issues/17","id":425372744,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNTM3Mjc0NA==","user":{"login":"kmagiera","id":726445,"node_id":"MDQ6VXNlcjcyNjQ0NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/726445?v=4","gravatar_id":"","url":"https://api.github.com/users/kmagiera","html_url":"https://github.com/kmagiera","followers_url":"https://api.github.com/users/kmagiera/followers","following_url":"https://api.github.com/users/kmagiera/following{/other_user}","gists_url":"https://api.github.com/users/kmagiera/gists{/gist_id}","starred_url":"https://api.github.com/users/kmagiera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmagiera/subscriptions","organizations_url":"https://api.github.com/users/kmagiera/orgs","repos_url":"https://api.github.com/users/kmagiera/repos","events_url":"https://api.github.com/users/kmagiera/events{/privacy}","received_events_url":"https://api.github.com/users/kmagiera/received_events","type":"User","site_admin":false},"created_at":"2018-09-28T09:07:21Z","updated_at":"2018-09-28T09:07:21Z","author_association":"OWNER","body":"Thanks @hey99xx I think we are on the same page with regard to that"}}
{"actor":{"display_login":"kmagiera"}}