-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
93 lines (80 loc) · 2.78 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
84
85
86
87
88
89
90
91
92
93
import { StatusBar } from 'expo-status-bar';
import { NavigationContainer, useNavigation } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack'
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'
import Map from './screens/Map';
import SeenBirdsScreen from './screens/SeenBirdsScreen';
import FindBirdsScreen from './screens/FindBirdsScreen';
import DisplayBirds from './screens/DisplayBirds';
import BirdDetails from './screens/BirdDetails';
import WelcomeScreen from './screens/WelcomeScreen';
import SubmitBirdsScreen from './screens/SubmitBirdsScreen';
import { useEffect, useState} from 'react';
import { init } from './utils/database';
import { Ionicons } from '@expo/vector-icons'
export default function App() {
const [dbInit, setdbInit] = useState(false)
useEffect(() => {
const loadApp = async () => {
await init()
setdbInit(true)
}
}, []);
const Stack = createNativeStackNavigator()
const BottomTab = createBottomTabNavigator()
const homeButton = ({ navigation, route}) => ({
headerRight: () =>
<Ionicons
style={{paddingRight: 8}}
name={'home'}
size={24}
color={'white'}
onPress={() => {navigation.navigate('Home')}}
/>
})
const BottomNav = () => {
return (
<BottomTab.Navigator
screenOptions={{
headerStyle: { backgroundColor: 'darkgreen'},
headerTintColor: 'white',
contentStyle: { backgroundColor: 'darkgreen'}
}}
>
<BottomTab.Screen
name="Home"
component={WelcomeScreen}
/>
<BottomTab.Screen name="Submit Birds" component={SubmitBirdsScreen} options={homeButton} />
<BottomTab.Screen
name="Find Birds" component={FindBirdsScreen} options={homeButton} />
<BottomTab.Screen name="Bird List" component={SeenBirdsScreen} options={homeButton} />
</BottomTab.Navigator>)
}
return (
<>
<StatusBar style='light' />
<NavigationContainer>
<Stack.Navigator
screenOptions={ {
headerStyle: { backgroundColor: 'darkgreen'},
headerTintColor: 'white',
contentStyle: { backgroundColor: 'darkgreen'},
}}
>
<Stack.Screen
name='Nav'
component={BottomNav}
options={{headerShown: false}} />
<Stack.Screen
name="DisplayBirds"
component={DisplayBirds}
options={homeButton}
/>
<Stack.Screen name="Pick Location" component={Map} />
<Stack.Screen name="Bird Details" component={BirdDetails} options={{presentation: 'modal'}} />
</Stack.Navigator>
</NavigationContainer>
</>
);
}