Reputation: 89
I have the next route of code:
const Main = DrawerNavigator({
Dashboard: {screen: TopNavigation},
SetupSignUp: {screen: SetupSignUp},
},{
initialRouteName: "Dashboard",
});
export const App = StackNavigator({
Welcome: {screen: Welcome},
Main: {screen: Main},
Login: {screen: Login},
SignUp: {screen: SignUp},
Content: {screen: MainStack},
SetupSignUp: {screen: }
},{
initialRouteName: "Welcome",
});
My app start in App.
What i want is in the route of SetupSignUp from App, go to Main but in SetupSignUp, this without change the initialRouteName because i need this for use in Content.
How can i do this?
Upvotes: 2
Views: 812
Reputation: 116
One alternative is to externalize your route definitions and create two similar drawer navigators with different initial routes:
const mainConfig = {};
const mainRoutes = {
Dashboard: {screen: TopNavigation},
SetupSignUp: {screen: SetupSignUp},
};
const Main = DrawerNavigator(mainRoutes, {
...mainConfig
initialRouteName: "Dashboard",
});
const AlternativeMain = DrawerNavigator(mainRoutes, {
...mainConfig
initialRouteName: "SetupSignUp",
});
Then, you will be able to navigate to Main or to AlternativeMain with different initial routes.
Upvotes: 0
Reputation: 668
I think you're combining Drawer and StackNavigator in the wrong way.
I made this example to try to help: https://github.com/juliancorrea/react-native-navigation-example/tree/master
Upvotes: 2