-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
46 lines (38 loc) · 1.11 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
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/
import React, {useEffect, useState} from 'react';
import MainNavigation from './src/navigation/main';
import {StyleSheet} from 'react-native';
import {GestureHandlerRootView} from 'react-native-gesture-handler';
import {Host} from 'react-native-portalize';
import {useAppDispatch} from './src/state/hooks';
import {setColorMode} from './src/state/store/colors/colorsSlice';
import {localStorage} from './utils/helpers';
function App(): React.JSX.Element {
const [init, setInit] = useState(false);
const dispatch = useAppDispatch();
useEffect(() => {
const mode = localStorage.get(localStorage.keys.COLOR_MODE);
if (mode) {
dispatch(setColorMode(mode));
}
setInit(true);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
if (!init) {
return <></>;
}
return (
<GestureHandlerRootView style={styles.container}>
<Host>
<MainNavigation />
</Host>
</GestureHandlerRootView>
);
}
const styles = StyleSheet.create({container: {flex: 1}});
export default App;