-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
104 lines (93 loc) · 3.77 KB
/
App.js
File metadata and controls
104 lines (93 loc) · 3.77 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
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
94
95
96
97
98
99
100
101
102
103
104
import * as React from 'react';
import { Platform, StatusBar, StyleSheet, View, Text } from 'react-native';
import { SplashScreen } from 'expo';
import * as Font from 'expo-font';
import { MaterialCommunityIcons, Entypo, SimpleLineIcons } from '@expo/vector-icons';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator, TransitionPresets } from '@react-navigation/stack';
import Colors from './constants/Colors';
import MusemModal from './components/MusemModal';
import BottomTabNavigator from './navigation/BottomTabNavigator';
import useLinking from './navigation/useLinking';
import MuseiMapScreen from './screens/MuseiMapScreen';
import WelcomeScreen from './screens/WelcomeScreen';
import LoginScreen from './screens/LoginScreen';
const Stack = createStackNavigator();
const IS_PROD = false;
export default function App(props) {
const [isLoadingComplete, setLoadingComplete] = React.useState(false);
const [initialNavigationState, setInitialNavigationState] = React.useState();
const containerRef = React.useRef();
const { getInitialState } = useLinking(containerRef);
React.useEffect(() => {
async function loadResourcesAndDataAsync() {
try {
SplashScreen.preventAutoHide();
setInitialNavigationState(await getInitialState());
await Font.loadAsync({
...MaterialCommunityIcons.font,
...Entypo.font,
...SimpleLineIcons.font,
'space-mono': require('./assets/fonts/SpaceMono-Regular.ttf'),
'gilroy-bold': require('./assets/fonts/Gilroy-Bold.ttf'),
'gilroy-regular': require('./assets/fonts/Gilroy-Regular.ttf'),
'gt-super-medium': require('./assets/fonts/GT-Super-Display-Medium.ttf'),
});
} catch (e) {
console.warn(e);
} finally {
setLoadingComplete(true);
SplashScreen.hide();
}
}
loadResourcesAndDataAsync();
}, []);
if (!isLoadingComplete && !props.skipLoadingScreen) {
return null;
} else {
return (
<View style={styles.container}>
{Platform.OS === 'ios' && <StatusBar barStyle="dark-content" />}
<NavigationContainer ref={containerRef} initialState={initialNavigationState}>
<Stack.Navigator initialRouteName="Welcome">
<Stack.Screen name="Welcome" component={WelcomeScreen} options={{
headerShown: false,
gestureEnabled: false,
}} />
<Stack.Screen name="Login" component={LoginScreen} options={{
...TransitionPresets.ModalSlideFromBottomIOS,
header: undefined,
cardOverlayEnabled: true,
gestureEnabled: false,
headerStatusBarHeight: 0,
headerShown: false
}} />
<Stack.Screen name="Root" component={BottomTabNavigator} options={{
headerShown: false,
gestureEnabled: false,
}} />
<Stack.Screen name="Mappa" component={MuseiMapScreen} options={{
...TransitionPresets.ModalPresentationIOS,
headerShown: false
}} />
<Stack.Screen name="Modal" component={MusemModal} options={{
...TransitionPresets.ModalPresentationIOS,
header: undefined,
cardOverlayEnabled: true,
gestureEnabled: true,
headerStatusBarHeight: 0,
headerShown: false
}} />
</Stack.Navigator>
</NavigationContainer>
{IS_PROD && <Text style={{ fontSize: 8, left: 20, bottom: 15, fontWeight: "700", position: "absolute" }}>made with<Text style={{ fontSize: 10, }}> ❤ </Text>by bwg</Text>}
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.green,
},
});