You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.1 KiB

import * as React from 'react';
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';
const mapStateToProps = state => {
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} />
<Stack.Screen name="Otp" component={Otp} />
</>
) : (
<>
<Stack.Screen name="Home" component={Home} />
</>
)}
</Stack.Navigator>
</NavigationContainer>
);
}
export default connect(mapStateToProps)(Navigator);