[Android] Pushing to a new independent stack on android shows the back button
See original GitHub issuePushing to the following independent navigation container, I’d expect the back button to be hidden as it’s at the start of the stack. I can work around it at the moment by forcing headerHideBackButton, however this is a bit of a hack.
<NavigationContainer independent>
<Navigator screenOptions={defaultNavigationOptions} initialRouteName={RouteUrls.home}>
<Stack.Screen
name={RouteUrls.home}
options={{...routes[RouteUrls.home].options, headerHideBackButton: true}}
component={routes[RouteUrls.home].component}
/>
<Stack.Screen
name={RouteUrls.generic}
options={routes[RouteUrls.generic].options}
component={routes[RouteUrls.generic].component}
/>
<Stack.Screen
name={RouteUrls.stack}
options={routes[RouteUrls.stack].options}
component={routes[RouteUrls.stack].component}
/>
</Navigator>
</NavigationContainer>
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Tasks and the back stack | Android Developers
When the current activity starts another, the new activity is pushed on the top of the stack and takes focus. The previous activity...
Read more >how to go back to previous fragment on pressing manually ...
You can call the popFragments() whenever you click the back button in a fragment and call pushFragments() whenever you navigate from one Fragment...
Read more >Multiple back stacks. A deep dive | by Ian Lake - Medium
If a 'back stack' is a set of screens that you can navigate back through via the system back button, 'multiple back stacks'...
Read more >Handling Back Button in Android without implementing ...
I have used a boolean flag to get to know that if back button is kept pressed from last screen, it won't exit...
Read more >How to Implement Press Back Again to Exit in Android?
In the above code, when the user presses the 'BACK' button once, they are greeted with a toast asking them to press it...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for looking at this, by the way I have to say so far this is an outstanding package! Glad so far to be transitioning away from react-native-navigation to this.
In https://github.com/software-mansion/react-native-screens/blob/master/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.java#L189 you can change that if to
return ((ScreenStack) container).getRootScreen() != getScreen();
and comment the code below it. I will look at why it is implemented like that.