Assuming what what you want to implement is an App that has a different navigation if you are logged in or out, I would suggest using the Switch navigator. In your case, your error it is most likely caused because the signup screen does not exist in the tree of both stack navigators. I'll post the entire main code but the part you should take a look is this:
const Navigator = createSwitchNavigator({
Main: MainTabNavigator,
Auth: AuthNavigator,
SplashScreen: SplashScreen,
Onboarding: Onboarding,
}, {
initialRouteName: 'SplashScreen',
headerMode: 'none'
});
The rest:
import React from "react";
import { createStackNavigator, createBottomTabNavigator, createSwitchNavigator, createAppContainer } from 'react-navigation';
import {ThemeProvider} from 'styled-components'
import {configureStore} from "./redux/store"
import { Provider } from 'react-redux'
const theme = {
primaryColor: '#3F51B5',
darkPrimaryColor: '#303F9F',
containerBackgroundColor: '#FFFFFF',
lightPrimaryColor: '#C5CAE9',
accentColor: '#FF5722',
backgroundColor: 'white',
font: 'Lato-Regular',
fontBold: 'Lato-Bold'
}
const ConfigNavigator = createStackNavigator({
Config: ConfigScreen,
SettingsScreen: SettingsScreen,
...coreRoutes
}, {
initialRouteName: 'Config',
headerMode: 'none'
});
const HomeNavigator = createStackNavigator({
...coreRoutes
}, {
initialRouteName: 'HomeScreen',
headerMode: 'none'
});
const PlacesNavigator = createStackNavigator({
Places: PlacesScreen,
POI: POIScreen,
}, {
initialRouteName: 'Places',
headerMode: 'none'
});
const PinnedNavigator = createStackNavigator({
Pinned: PinnedScreen,
POI: POIScreen,
}, {
initialRouteName: 'Pinned',
headerMode: 'none'
});
const MainTabNavigator = createBottomTabNavigator({
Home: HomeNavigator,
Places: PlacesNavigator,
Pinned: PinnedNavigator,
Chat: ChatScreen,
Config: ConfigNavigator,
}, {
initialRouteName: 'Home',
tabBarPosition: "bottom",
swipeEnabled: false,
tabBarComponent: props => {
return <TabNavigation {...props}
items={[
{
text: Strings['home'], icon: { name: "home", type: "MaterialCommunityIcons" },
route: "Home"
},
{
text: Strings['places'], icon: { name: "map-marker-multiple", type: "MaterialCommunityIcons"},
route: "Places"
},
{
text: Strings['pinned'], icon: { name: "pin", type: "MaterialCommunityIcons" },
route: "Pinned"
},
{
text: Strings['chat'], icon: { name: "wechat", type: "MaterialCommunityIcons" },
route: "Chat"
},
{
text: Strings['settings'], icon: { name: "settings", type: "MaterialCommunityIcons" },
route: "Config"
}
]}
/>
}
});
const AuthNavigator = createStackNavigator({
Registration: RegistrationScreen,
}, {
initialRouteName: 'Registration',
headerMode: 'none'
});
const Navigator = createSwitchNavigator({
Main: MainTabNavigator,
Auth: AuthNavigator,
SplashScreen: SplashScreen,
Onboarding: Onboarding,
}, {
initialRouteName: 'SplashScreen',
headerMode: 'none'
});
const AppContainer = createAppContainer(Navigator)
let store = configureStore();
class App extends React.Component {
constructor(){
super();
this.theme = new Theme(theme);
}
render(){
return <Provider store={store}>
<ThemeProvider theme={this.theme.getTheme()}>
<AppContainer/>
</ThemeProvider>
</Provider>
}
};
export default App;
From then, you just navigate to Auth or Main and the entire navigator tree changes.