-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
141 lines (129 loc) · 4.17 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import { View } from 'react-native';
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome'
import { faHouse, faHouseChimney, faList, faBell, faMoneyBill1Wave } from '@fortawesome/free-solid-svg-icons';
import { HIGHLIGHT, ACCENT } from './assets/colors';
// Redux
import { Provider, useSelector } from 'react-redux';
import store from './redux/store';
// Firebase
import { authObserver } from './firebase/auth';
// React Navigation
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
// Screens
import Home from './screens/home';
import Todo from './screens/todo';
import SignIn from './screens/auth/signIn';
import SignUp from './screens/auth/signUp';
import WaitRoom from './screens/roomStart/waitRoom';
import CreateRoom from './screens/roomStart/createRoom';
import Status from './screens/status';
import Expenses from './screens/expenses';
const Tab = createBottomTabNavigator();
const Stack = createNativeStackNavigator();
const RoomStack = createNativeStackNavigator();
const HomeNav = () => {
return (
<Tab.Navigator initialRouteName='Home' screenOptions={{
tabBarStyle: {
paddingTop: '4%',
backgroundColor: HIGHLIGHT,
borderRadius: '30%',
height: '10%',
position: 'absolute',
},
tabBarActiveTintColor: 'white',
tabBarShowLabel: false,
}}>
<Tab.Screen
name="Home"
component={Home}
options={{
headerShown: false,
tabBarIcon: ({focused}) => {
return (
<View style={[{padding: '12%', borderRadius: '30%', backgroundColor: focused ? 'white' : HIGHLIGHT}]}>
<FontAwesomeIcon icon={faHouseChimney} size={25} color={focused ? HIGHLIGHT : 'white'}/>
</View>
)
}
}}
/>
<Tab.Screen
name="Status"
component={Status}
options={{
headerShown: false,
tabBarIcon: ({focused}) => {
return (
<View style={[{padding: '12%', borderRadius: '30%', backgroundColor: focused ? 'white' : HIGHLIGHT}]}>
<FontAwesomeIcon icon={faBell} size={25} color={focused ? HIGHLIGHT : 'white'}/>
</View>
)
}
}}
/>
<Tab.Screen
name="Todo"
component={Todo}
options={{
headerShown: false,
tabBarIcon: ({focused}) => {
return (
<View style={[{padding: '12%', borderRadius: '30%', backgroundColor: focused ? 'white' : HIGHLIGHT}]}>
<FontAwesomeIcon icon={faList} size={25} color={focused ? HIGHLIGHT : 'white'}/>
</View>
)
}
}}
/>
<Tab.Screen
name="Expenses"
component={Expenses}
options={{
headerShown: false,
tabBarIcon: ({focused}) => {
return (
<View style={[{padding: '12%', borderRadius: '30%', backgroundColor: focused ? 'white' : HIGHLIGHT}]}>
<FontAwesomeIcon icon={faMoneyBill1Wave} size={25} color={focused ? HIGHLIGHT : 'white'}/>
</View>
)
}
}}
/>
</Tab.Navigator>
);
}
const RoomNav = () => {
return (
<RoomStack.Navigator initialRouteName="Room">
<RoomStack.Screen name="Room" component={WaitRoom} options={{headerShown: false}}/>
<RoomStack.Screen name="Create" component={CreateRoom} options={{title: 'Create Room'}}/>
<RoomStack.Screen name="Main" component={HomeNav} options={{headerShown: false}}/>
</RoomStack.Navigator>
)
}
const AuthNav = () => {
return (
<Stack.Navigator initialRouteName='SignUp'>
<Stack.Screen name = "SignUp" component={SignUp} options={{headerShown: false}} />
<Stack.Screen name = "SignIn" component={SignIn} options={{headerShown: false}} />
</Stack.Navigator>
);
}
const App = () => {
const auth = authObserver()
return (
<Provider store={store}>
<NavigationContainer>
{auth ?
RoomNav()
:
AuthNav()
}
</NavigationContainer>
</Provider>
)
}
export default App;