parent
0e8ad43d2e
commit
93c1e23879
15 changed files with 167 additions and 94 deletions
@ -1,38 +1,31 @@ |
||||
import * as React from 'react'; |
||||
import { NavigationContainer } from '@react-navigation/native'; |
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack'; |
||||
import {NavigationContainer} from '@react-navigation/native'; |
||||
import {createNativeStackNavigator} from '@react-navigation/native-stack'; |
||||
import Splash from './src/screens/Splash'; |
||||
import Home from './src/screens/Home'; |
||||
import Login from './src/screens/Login'; |
||||
import Otp from './src/screens/Otp'; |
||||
import { connect } from 'react-redux'; |
||||
import {connect} from 'react-redux'; |
||||
|
||||
const mapStateToProps = state => { |
||||
return { |
||||
profile: state.profile |
||||
} |
||||
return { |
||||
profile: state.profile |
||||
} |
||||
} |
||||
|
||||
const Stack = createNativeStackNavigator(); |
||||
|
||||
function Navigator(props) { |
||||
return ( |
||||
<NavigationContainer> |
||||
<Stack.Navigator> |
||||
<Stack.Screen options={{headerShown: false}} name="Splash" component={Splash} /> |
||||
{!props.profile.token ? ( |
||||
<> |
||||
<Stack.Screen name="Login" component={Login} options={{headerShown: false}} /> |
||||
<Stack.Screen name="Otp" component={Otp} options={{headerShown: false}} /> |
||||
</> |
||||
) : ( |
||||
<> |
||||
<Stack.Screen name="Home" component={Home} /> |
||||
</> |
||||
)} |
||||
</Stack.Navigator> |
||||
</NavigationContainer> |
||||
); |
||||
return ( |
||||
<NavigationContainer> |
||||
<Stack.Navigator> |
||||
<Stack.Screen options={{headerShown: false}} name="Splash" component={Splash}/> |
||||
<Stack.Screen name="Login" component={Login} options={{headerShown: false}}/> |
||||
<Stack.Screen name="Otp" component={Otp} options={{headerShown: false}}/> |
||||
<Stack.Screen name="Home" component={Home}/> |
||||
</Stack.Navigator> |
||||
</NavigationContainer> |
||||
); |
||||
} |
||||
|
||||
export default connect(mapStateToProps)(Navigator); |
||||
|
Loading…
Reference in new issue