java.lang.IllegalStateException: Fragment already added: ScreenFragment{f66d9a8 (6cf05e1a-394b-40f5-a359-9198df78c3b1) id=0x61}
at androidx.fragment.app.FragmentManagerImpl.addFragment(FragmentManagerImpl.java:1379)
at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:399)
at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2079)
at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1869)
at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1830)
at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
at androidx.fragment.app.FragmentManagerImpl$2.run(FragmentManagerImpl.java:150)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Platform: Android
Using React Hooks for screens
The exact same issue here. Using react-native-screens version 2.0.0-alpha.29
I had a different issue with a similar stack trace. When going back with the back button on Android from stack navigator inside another stack navigator resulted in a crash. When I replaced the root navigator with native stack everything is fine again. Tested on alpha.32. Probably appeared on version 29.
The exact same issue here. Using react-native-screens version 2.0.0-alpha.29
Issue gone after downgrading to 2.0.0-alpha.17
The exact same issue here. Using react-native-screens version 2.0.0-alpha.29
Issue gone after downgrading to 2.0.0-alpha.17
Issue is still coming after downgrading.
I had this issue as well. When navigating to a new page right after going back from a pop up screen(which itself is a stack-navigator), the app crashes on Android with the similar stack trace.
The way I solved it is to wrap navigating to the new page in a setTimeout like this:
onFocus() {
if (some condition) {
setTimeout(() => {
this.props.navigation.push('new page');
}, 0);
}
}
Hope it helps!
Thanks for reporting and thank you all for the comments. I've seen this issue being reported in other places as well and would like to investigate it and fix. Can you share the code of the app and repro steps for the issue? Or better, prepare a minimum repro app that I could use to investigate.
There were a couple of issues related that got fixed in the most recent version. I'm going to close this one and consider resolved as there is no repro scenario here I could use to verify, just the stacktrace that matches issues we resolved. In case you still experience this problem with 2.0.0-beta.8 please comment below or start a new issue.
@kmagiera I am still facing the same issue with latest version. I will try to provide repro soon.
Any updates here @kamleshh-bms
Most helpful comment
Issue gone after downgrading to 2.0.0-alpha.17