-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
51 lines (46 loc) · 1.24 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
import React, {useEffect} from 'react';
import {
SafeAreaView,
StatusBar,
StyleSheet,
useColorScheme,
} from 'react-native';
import {Colors} from './src/constants/colors';
import {MainNavigator} from './src/navigation/MainNavigator';
import {
DarkTheme,
DefaultTheme,
NavigationContainer,
} from '@react-navigation/native';
import BootSplash from 'react-native-bootsplash';
import {darkTheme, lightTheme} from './src/constants/themes';
function App() {
const scheme = useColorScheme();
const theme = scheme === 'dark' ? darkTheme : lightTheme;
useEffect(() => {
const init = async () => {
// …do multiple sync or async tasks
};
init().finally(async () => {
await BootSplash.hide({fade: true});
console.log('BootSplash has been hidden successfully');
});
}, []);
return (
<SafeAreaView
style={{
flex: 1,
backgroundColor:
scheme === 'light' ? Colors.background : Colors.totalBlack,
}}>
<StatusBar
barStyle={scheme === 'dark' ? 'light-content' : 'dark-content'}
/>
<NavigationContainer theme={theme}>
<MainNavigator />
</NavigationContainer>
</SafeAreaView>
);
}
const styles = StyleSheet.create({});
export default App;