-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
83 lines (78 loc) · 2.89 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
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
/**
* Sample React Native App
* https://github.com/facebook/react-native
* https://dribbble.com/shots/5726952-Bingo-App-UI-Kit/attachments/11021810?mode=media
* https://github.dev/itzpradip/react-navigation-v6-mix
* https://github.com/NyashaNziramasanga/react-native-horizontal-scroll-menu
* @format
* @flow strict-local
*/
import {LogBox} from 'react-native';
import React, {useEffect} from 'react';
import {SafeAreaProvider, SafeAreaView} from 'react-native-safe-area-context';
import DrawerNavigation from './src/Navigation/drawer.navigation';
import {
colorModeManager,
NativeBaseTheme,
PreferencesContext,
} from './src/Theme';
import {NativeBaseProvider} from 'native-base';
import {colors} from './src/Theme/colors';
import {StatusBar} from 'rn-status-bar';
import './src/Language/DCSLocalize';
function App(props) {
/* -------------------------------------------------------------------------- */
/* UseEffect Section */
/* -------------------------------------------------------------------------- */
useEffect(() => {
getData();
}, []);
/* -------------------------------------------------------------------------- */
/* Log Section */
/* -------------------------------------------------------------------------- */
LogBox.ignoreLogs(['Setting a timer for a long period of time']);
LogBox.ignoreLogs(['NativeBase: The contrast ratio of']);
LogBox.ignoreAllLogs(true);
LogBox.ignoreLogs([
"[react-native-gesture-handler] Seems like you're using an old API with gesture components, check out new Gestures system!",
]);
/* -------------------------------------------------------------------------- */
/* Theme Section */
/* -------------------------------------------------------------------------- */
const [isThemeDark, setIsThemeDark] = React.useState();
const getData = async () => {
const theme = await colorModeManager.get();
setIsThemeDark(theme === 'dark' ? true : false);
};
const toggleTheme = React.useCallback(async () => {
return setIsThemeDark(!isThemeDark);
}, [isThemeDark]);
const preferences = React.useMemo(
() => ({
toggleTheme,
isThemeDark,
}),
[toggleTheme, isThemeDark],
);
return (
<SafeAreaProvider>
<StatusBar
barStyle="light-content"
backgroundColor={colors.light.primaryColorLight}
/>
<SafeAreaView
style={{
flex: 1,
}}>
<NativeBaseProvider
theme={NativeBaseTheme}
colorModeManager={colorModeManager}>
<PreferencesContext.Provider value={preferences}>
<DrawerNavigation />
</PreferencesContext.Provider>
</NativeBaseProvider>
</SafeAreaView>
</SafeAreaProvider>
);
}
export default App;