-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathApp.js
More file actions
47 lines (39 loc) · 1.08 KB
/
App.js
File metadata and controls
47 lines (39 loc) · 1.08 KB
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
import 'react-native-gesture-handler';
import React, {useState, useEffect} from 'react';
import { NavigationContainer } from '@react-navigation/native';
import type {Node} from 'react';
import {
AsyncStorage,
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
useColorScheme,
View,
} from 'react-native';
import AppNavigator from './src/navigation/AppNavigator'
import Login from "./src/screens/Login";
import AuthNavigator from "./src/navigation/AuthNavigator";
const App: () => Node = () => {
const [isLogin, setIsLogin] = useState(false)
const [token, setToken] = useState('')
useEffect(async () => {
try {
const token = await AsyncStorage.getItem('token');
setToken(token)
} catch (error) {
console.log(error);
}
}, [])
console.log('token', token);
return (
<NavigationContainer
initialRouteName={'AuthStack'}>
{token.length > 0 || isLogin ? <AppNavigator /> : <AuthNavigator setIsLogin={setIsLogin} /> }
</NavigationContainer>
);
};
const styles = StyleSheet.create({
});
export default App;