-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
62 lines (59 loc) · 1.73 KB
/
Copy pathApp.js
File metadata and controls
62 lines (59 loc) · 1.73 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import React, { useEffect, useState } from 'react';
import { StyleSheet, SafeAreaView, Platform, StatusBar } from 'react-native';
import { Loading, Game, Home, Modal } from './screens/Screens';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { primary } from './constants/Color';
const Stack = createStackNavigator();
const RootStack = createStackNavigator();
export default function App() {
const [load, setLoad] = useState(true);
useEffect(() => {
setTimeout(() => setLoad(false), 1000);
}, []);
if (load) {
return <Loading />;
}
const MainStack = () => (
<Stack.Navigator
screenOptions={{
headerTintColor: primary,
}}
>
<Stack.Screen name="Home" component={Home} />
<Stack.Screen
name="Game"
component={Game}
options={({ route }) => ({ title: route.params.title })}
/>
</Stack.Navigator>
);
const DARK_CONTENT = 'dark-content';
const LIGHT_CONTENT = 'light-content';
const ContentColor = Platform.OS === 'android' ? LIGHT_CONTENT : DARK_CONTENT;
return (
<SafeAreaView style={styles.container}>
<StatusBar barStyle={ContentColor} />
<NavigationContainer>
<RootStack.Navigator>
<RootStack.Screen
name="Main"
component={MainStack}
options={{ headerShown: false }}
/>
<RootStack.Screen
name="Modal"
component={Modal}
options={{ headerShown: false }}
/>
</RootStack.Navigator>
</NavigationContainer>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
},
});