Skip to content

Instantly share code, notes, and snippets.

@qrobin qrobin/Router.js
Last active Jun 24, 2017

Embed
What would you like to do?
import React from 'react';
import { View, Text } from 'react-native';
import { StackNavigator } from 'react-navigation';
/*
Level 1
*/
const Router = StackNavigator({
AuthStack: {
screen: (props) => <AuthStack {...props} />,
navigationOptions: {
headerMode: 'none'
}
},
ApplicationStack: {
screen: (props) => <ApplicationStack {...props} />
}
}, {
initialRouteName : 'AuthStack'
});
/*
Level 2
Authorization
*/
const AuthStack = StackNavigator({
GuideStack: {
screen: (props) => <GuideStack {...props} />,
navigationOptions: {
headerMode: 'none'
}
},
LoginStack: {
screen: (props) => <LoginStack {...props} />,
navigationOptions: {
headerMode: 'none'
}
},
RegistrationStack: {
screen: (props) => <RegistrationStack {...props} />,
navigationOptions: {
headerMode: 'none'
}
}
}, {
initialRouteName : 'GuideStack'
});
/*
Level 3
Authorization
*/
const GuideStack = StackNavigator({
GuideStep1: {
screen: (props) => <GuideStep1 {...props} />
},
GuideStep2: {
screen: (props) => <GuideStep2 {...props} />
},
GuideStep3: {
screen: (props) => <GuideStep3 {...props} />
}
}, {
initialRouteName : 'GuideStep1'
});
const LoginStack = StackNavigator({
Login: {
screen: (props) => <Login {...props} />
},
ResetPassword: {
screen: (props) => <ResetPassword {...props} />,
mode: 'modal'
}
}, {
initialRouteName : 'Login'
});
const RegistrationStack = StackNavigator({
AskForSertificate: {
screen: (props) => <AskForSertificate {...props} />
},
RegistrationWithSert: {
screen: (props) => <RegistrationWithSert {...props} />
},
RegistrationStep1: {
screen: (props) => <RegistrationStep1 {...props} />
},
RegistrationStep2: {
screen: (props) => <RegistrationStep2 {...props} />
},
RegistrationStep3: {
screen: (props) => <RegistrationStep3 {...props} />
}
}, {
initialRouteName : 'AskForSertificate'
});
/*
Level 2
Application
*/
const ApplicationStack = StackNavigator({
Main: {
screen: (props) => <Main {...props} />
},
Chat: {
screen: (props) => <Chat {...props} />
},
Deals: {
screen: (props) => <Deals {...props} />
},
Deal: {
screen: (props) => <Deal {...props} />
},
DealWithDocuments: {
screen: (props) => <DealWithDocuments {...props} />
},
Profile: {
screen: (props) => <Profile {...props} />
},
Options: {
screen: (props) => <Options {...props} />
},
Option: {
screen: (props) => <Option {...props} />
},
Progress: {
screen: (props) => <Progress {...props} />
},
Quizes: {
screen: (props) => <Quizes {...props} />
},
Quiz: {
screen: (props) => <Quiz {...props} />
},
Settings: {
screen: (props) => <Settings {...props} />,
mode: 'modal'
}
}, {
initialRouteName : 'Main'
});
const GuideStep1 = () => <Text>GuideStep1</Text>;
const GuideStep2 = () => <Text>GuideStep2</Text>;
const GuideStep3 = () => <Text>GuideStep3</Text>;
const Login = () => <Text>Login</Text>;
const ResetPassword = () => <Text>ResetPassword</Text>;
const AskForSertificate = () => <Text>AskForSertificate</Text>;
const RegistrationWithSert = () => <Text>RegistrationWithSert</Text>;
const RegistrationStep1 = () => <Text>RegistrationStep1</Text>;
const RegistrationStep2 = () => <Text>RegistrationStep2</Text>;
const RegistrationStep3 = () => <Text>RegistrationStep3</Text>;
const Main = () => <Text>Main</Text>;
const Chat = () => <Text>Chat</Text>;
const Deals = () => <Text>Deals</Text>;
const Deal = () => <Text>Deal</Text>;
const DealWithDocuments = () => <Text>DealWithDocuments</Text>;
const Profile = () => <Text>Profile</Text>;
const Options = () => <Text>Options</Text>;
const Option = () => <Text>Option</Text>;
const Progress = () => <Text>Progress</Text>;
const Quizes = () => <Text>Quizes</Text>;
const Quiz = () => <Text>Quiz</Text>;
const Settings = () => <Text>Settings</Text>;
export default Router;
AuthStack
|
|______ GuideStack
| |______ screens: Guide_step1, Guide_step2, Guide_step3
|
|
|______ LoginStack
| |______ screens: Login, ResetPassword(modal route)
|
|
|______ RegistrationStack
|______ screens: AskForSertificate, RegistrationWithSert, Registration_step1, Registration_step2, Registration_step3
ApplicationStack
|
|______ screens: Main, Chat, Deals, :Deal, DealWithDocuments, Profile, Options, :Option, Progress, Quizes, :Quiz, Settings(modal route)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.