-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
57 lines (50 loc) · 1.92 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { StyleSheet, Text, View } from 'react-native'
import React, {useEffect,useState} from 'react'
import { API_TOKEN, API_URL } from '@env'
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import LoginScreen from './src/Screens/auth/LoginScreen';
import OnBoardingScreen from './src/Screens/onBoarding/OnBoardingScreen';
import { getItem } from './src/utils/asyncStorage';
import SignupScreen from './src/Screens/auth/SignupScreen';
import WelcomeScreen from './src/Screens/auth/WelcomeScreen';
import HomeScreen from './src/Screens/auth/HomeScreen';
import ForgetPassScreen from './src/Screens/auth/ForgetPassScreen';
const Stack = createNativeStackNavigator();
const App = () => {
const [showOnBoarding, setShowOnBoarding] = useState(null)
useEffect(() => {
console.log(API_TOKEN, API_URL);
checkIfAlreadyOnBoarding();
}, [])
const checkIfAlreadyOnBoarding = async() => {
let onBoarding = await getItem('onBoarding')
console.log("onBoarding",onBoarding);
if(onBoarding){
// hideOnBoarding
setShowOnBoarding(false)
} else {
// showOnBoarding
setShowOnBoarding(true)
}
}
if(showOnBoarding == null){
return null;
}
return (
<NavigationContainer>
<Stack.Navigator initialRouteName= {showOnBoarding ? 'OnBoarding' : 'Welcome'}>
<Stack.Screen name="OnBoarding" component={OnBoardingScreen} />
<Stack.Screen name="Login" component={LoginScreen} />
<Stack.Screen name="Singup" component={SignupScreen} />
<Stack.Screen name="ForgetPass" component={ForgetPassScreen} />
<Stack.Screen options={{
headerShown:false
}} name="Welcome" component={WelcomeScreen} />
<Stack.Screen name="Home" component={HomeScreen} />
</Stack.Navigator>
</NavigationContainer>
)
}
export default App
const styles = StyleSheet.create({})