I have a following stack and switch navigator. Here is code:
Parent Stack
const ParentStack = createStackNavigator(
{
Screen1,
Screen2,
Screen3,
},
{headerMode: 'none', initialRouteName: 'Screen1'},
);
User Stack
const UserStack = createStackNavigator(
{
Screen11,
Screen22,
Screen33,
},
{headerMode: 'none', initialRouteName: 'Screen11'},
);
Switch Stack
const AppNavigator = createSwitchNavigator(
{
Auth,
ParentStack,
UserStack,
},
{
initialRouteName: 'Auth',
},
);
When I am on 'Auth' Screen, and I start the Screen2
using below code:
this.props.navigation.navigate('Screen2')
Screen2 started successfully. But when I press Back, then Screen1 also present in stack. But I had only started the Screen2.
- Is this default react native behavior to start the first screen in stack automatically?
- Is there any way to start only Screen2?
screen1
toscreen2
soscreen1
is there in stack – RaviScreen2
fromAuth
. So whyScreen1
started, just because of first entry in stack? – Dev_1initialRouteName
inAuth
stack – Ravi