Here is the working code block for createStackNavigator({...})
, with the block for initialRouteName
being commented out.
const navigator = createStackNavigator(
{
Event: Event,
Signup: Signup,
Verif1: Verif1,
Chat: {
screen: ChatWithSocket,
}
}, /*{
initialRouteName: Signup,
} */
);
const AppContainer = createAppContainer(navigator);
export default AppContainer;
The app is running with React Native 0.59.5
and react navigation 3.9.1
. If the block for initialRoutesName
is enabled (comments removed). then it popup an error:
Based on my reading online, the problem seems to be a config issue with the React Navigation
module.
I had to switch initalRouteName
to initialRouteParams
const navigator = createStackNavigator(
{
Event: Event,
Signup: Signup,
Verif1: Verif1,
Chat: {
screen: ChatWithSocket,
}
}, {
initialRouteParams: 'Signup',
}
);
const AppContainer = createAppContainer(navigator);
export default AppContainer;
Here is the working code. The name of initial route is a string:
const navigator = createStackNavigator(
{
Event: Event,
Signup: Signup,
Verif1: Verif1,
Chat: {
screen: ChatWithSocket,
}
}, {
initialRouteName: 'Signup',
}
);
const AppContainer = createAppContainer(navigator);
export default AppContainer;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With