-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
69 lines (66 loc) · 1.7 KB
/
App.js
File metadata and controls
69 lines (66 loc) · 1.7 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
import React, { useEffect } from 'react';
import { MapView, Home, Login, Register, Game, Message } from './components';
import * as SecureStore from 'expo-secure-store';
import { Scene, Router, Actions, Stack } from 'react-native-router-flux';
import { StyleSheet } from 'react-native';
import { background, brightGreen } from './styles';
export default function App() {
useEffect(() => {
SecureStore.getItemAsync('token').then(token => {
if (!token) {
Actions.Login();
}
});
});
return (
<Router>
<Stack key='root' headerLayoutPreset='center'>
<Scene
key='Home'
component={Home}
title='Home'
hideNavBar={true}
titleStyle={styles.title}
navigationBarStyle={styles.navbar}
/>
<Scene
key='Map'
leftButtonStyle={{ color: 'white' }}
component={MapView}
title='Map'
titleStyle={styles.title}
navigationBarStyle={styles.navbar}
/>
<Scene
key='Login'
component={Login}
title='Login'
titleStyle={styles.title}
navigationBarStyle={styles.navbar}
/>
<Scene
key='Register'
component={Register}
title='Register'
titleStyle={styles.title}
navigationBarStyle={styles.navbar}
/>
<Scene
key='Game'
component={Game}
title='Game'
titleStyle={styles.title}
navigationBarStyle={styles.navbar}
/>
</Stack>
</Router>
);
}
const styles = StyleSheet.create({
navbar: {
backgroundColor: background,
},
title: {
color: brightGreen,
},
});