question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash on Android with react-navigation stack

See original GitHub issue

When I navigate to this specific screen the app is crashing. It works fine on iOS and it works fine if I comment out enableScreens() and not use react-native-screens

It’s a pretty standard screen, apollo hooks + SectionList and some Text View TouchableOpacity (from react-native-gesture-handler)

Here is the log collected by Sentry, is there anything I can do to debug and help finding the root cause?

java.lang.IllegalStateException: Fragment already added: ScreenFragment{e9e00a9 (89d81b03-c200-4966-881c-38bb9e88da42) id=0x175}
    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:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6669)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:17
  • Comments:28 (9 by maintainers)

github_iconTop GitHub Comments

11reactions
DovletAmanovcommented, Feb 11, 2020

Same issue with react-navigation v5 and react-native-screens v2.0.0-beta.2 Happens when going back to previous screen

5reactions
tomffeecommented, Feb 19, 2020

Quick workaround for production if necessary: what helped us was actually removing useScreens method while using android platform for now.

import {useScreens} from 'react-native-screens';
// TODO: Remove condition after react-navigation this issue is fixed
if (Platform.OS === 'ios') {
  useScreens();
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

App crashes while navigating (Android Only) #10290 - GitHub
Current behavior After upgrading navigation v6 from v5, sometimes app crashing while animating. I investigated this a lot, and i think its ...
Read more >
How to avoid having createStackNavigator crash react-native ...
So the navigation.navigate in the docs isnt working but when you change that to push it works. However, it just pushes another screen...
Read more >
Crash when used with react-navigation
The YoutubePlayer causes a crash immediately on navigating to another screen, and also sometimes when navigating to the screen that contains the component....
Read more >
Stack Navigator | React Navigation
Stack Navigator provides a way for your app to transition between screens where each new screen is placed on top of a stack....
Read more >
react-native-screens v3.18.0 - npm.io
To take advantage of the native stack navigator primitive for React Navigation that leverages UINavigationController on iOS and Fragment on Android, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found