-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.tsx
93 lines (87 loc) · 2.81 KB
/
App.tsx
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/
import Toast from 'react-native-toast-message';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {DefaultTheme, NavigationContainer} from '@react-navigation/native';
import RNBootSplash from 'react-native-bootsplash';
import 'react-native-gesture-handler';
import React, {useEffect} from 'react';
import {View} from 'react-native';
import LaunchScreen from './src/screens/LaunchScreen';
import {setCustomText} from 'react-native-global-props';
import {RecoilRoot} from 'recoil';
import LoginScreen from './src/screens/LoginScreen';
import designToken from './src/assets/design-tokens';
import RegisterScreen from './src/screens/Register/RegisterScreen';
import {
DefaultTheme as PaperDefaultThme,
Provider as PaperProvider,
} from 'react-native-paper';
import MainScreen from './src/screens/MainScreen';
const Stack = createNativeStackNavigator();
const Theme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
background: designToken.color.Grary.White,
primary: designToken.color.Green,
},
};
const ThemePaper = {
...PaperDefaultThme,
colors: {
...PaperDefaultThme.colors,
background: designToken.color.Grary.White,
primary: designToken.color.Green,
},
};
function App(): JSX.Element {
// const [initScreen, setInitScreen] = React.useState('LaunchScreen');
const customTextProps = {
style: {
fontFamily: 'SUIT-Regular',
},
};
setCustomText(customTextProps);
useEffect(() => {
const init = async () => {
// const userCode = await AsyncStorage.getItem('military_serial_number');
// const autoLogin = await AsyncStorage.getItem('autoLogin');
// if (userCode && autoLogin) {
// setInitScreen('MainScreen');
// }
};
init().finally(async () => {
await RNBootSplash.hide({fade: true, duration: 500});
});
}, []);
return (
<PaperProvider theme={ThemePaper}>
<RecoilRoot>
<View style={{height: '100%'}}>
<NavigationContainer theme={Theme}>
<Stack.Navigator
initialRouteName="LaunchScreen"
// initialRouteName={initScreen}
screenOptions={{
headerShown: false,
animation: 'fade',
headerShadowVisible: false,
}}>
<Stack.Screen name="LaunchScreen" component={LaunchScreen} />
<Stack.Screen name="LoginScreen" component={LoginScreen} />
<Stack.Screen name="RegisterScreen" component={RegisterScreen} />
<Stack.Screen name="MainScreen" component={MainScreen} />
</Stack.Navigator>
</NavigationContainer>
<Toast />
</View>
</RecoilRoot>
</PaperProvider>
);
}
export default App;