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