-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
107 lines (99 loc) · 4.35 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
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
105
106
107
import React from 'react';
import LoginScreen from './Views/LoginScreen';
import MyRaces from './Views/MyRaces'
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import Home from './Views/Home'
import CreateAcct from './Views/CreateAcct';
import ActiveRaces from './Views/ActiveRaces';
import ProfilePage from './Views/ProfilePage';
import AidStation from './Views/AidStation';
import CompletedRaces from './Views/CompletedRaces';
import CreateRace from './Views/CreateRace';
import CreateAid from './Views/CreateAid';
import CompletedRaceStats from './Views/CompletedRaceStats';
import { RootSiblingParent } from 'react-native-root-siblings';
import ActiveRaceStats from './Views/ActiveRaceStats';
import AidStationStats from './Views/AidStationStats';
import { UserContext } from './context/user-context';
import Settings from './Views/Settings';
import Ionicons from 'react-native-vector-icons/Ionicons';
const Stack = createNativeStackNavigator();
const Tab = createBottomTabNavigator();
const raceData = "./assets/data/mocj-race-data.json";
const defaultUser = {
firstName: 'Samantha',
LastName: 'Claus',
MiddleInitial: 'C',
phone: '5555555555',
email: 'SClaus@yopmail.com',
password: 'password123!',
races: [
...raceData
]
}
function HomeTabs() {
return (
<Tab.Navigator screenOptions={({ route }) => ({
headerShown: false,
tabBarIcon: ({ focused, color, size }) => {
let iconName;
if (route.name === 'Home') {
iconName = focused
? 'home'
: 'home-outline';
} else if (route.name === "Races") {
iconName = focused ? 'barbell' : 'barbell-outline'
} else if (route.name === "Profile") {
iconName = focused ? 'person-circle' : 'person-circle-outline'
} else if (route.name === 'Settings') {
iconName = focused ? 'ios-list' : 'ios-list-outline';
}
// You can return any component that you like here!
return <Ionicons name={iconName} size={size} color={color} />;
},
tabBarActiveTintColor: 'tomato',
tabBarInactiveTintColor: 'gray',
})}>
<Tab.Screen name="Home" component={Home} />
<Tab.Screen name="Races" component={ActiveRaces} />
<Tab.Screen name="Profile" component={ProfilePage} />
<Tab.Screen name="Settings" component={Settings} />
</Tab.Navigator>
)
}
export default function App({navigation}) {
return(
<UserContext.Provider value={defaultUser}>
<RootSiblingParent>
<NavigationContainer>
<Stack.Navigator
initialRouteName="Login"
screenOptions={{
headerStyle: {
backgroundColor: "lightgray",
},
headerTitleStyle: {
fontWeight: 'bold',
},
}}>
<Stack.Screen options={{headerShown: false}} name="Login" component={LoginScreen} />
<Stack.Screen name="MyRaces" component={MyRaces} options={{ title: 'My Races'}} />
<Stack.Screen name="Home" component={HomeTabs} options={{ title: 'Home'}} />
<Stack.Screen name="CreateAcct" component={CreateAcct} options={{ title: 'Create Account'}} />
<Stack.Screen name="CreateAid" component={CreateAid} options={{ title: 'Create Aid Station'}} />
<Stack.Screen name="ActiveRaces" component={ActiveRaces} options={{ title: 'Active Races'}} />
<Stack.Screen name="CreateRace" component={CreateRace} options={{ title: 'Create Race'}} />
<Stack.Screen name="CompletedRaces" component={CompletedRaces} options={{ title: 'Completed Races'}} />
<Stack.Screen name="ProfilePage" component={ProfilePage} options={{ title: 'My Profile'}} />
<Stack.Screen name="AidStation" component={AidStation} options={{ title: 'Aid Station'}} />
<Stack.Screen name="CompletedRaceStats" component={CompletedRaceStats} options={{ title: 'Completed Race Stats'}} />
<Stack.Screen name="AidStationStats" component={AidStationStats} options={{ title: 'Aid Station Stats'}} />
<Stack.Screen name="ActiveRaceStats" component={ActiveRaceStats} options={{ title: 'Active Race Stats'}} />
</Stack.Navigator>
</NavigationContainer>
</RootSiblingParent>
</UserContext.Provider>
)
};