-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNavigation.js
More file actions
169 lines (159 loc) · 7.37 KB
/
Navigation.js
File metadata and controls
169 lines (159 loc) · 7.37 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
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import { NavigationContainer } from '@react-navigation/native';
import React from 'react'
import { pickTheme } from './redux/actions'
import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs';
import { MaterialCommunityIcons } from '@expo/vector-icons';
import { useSelector, useDispatch } from 'react-redux';
import Dashboard from './components/Dashboard';
import Explore from './components/Explore/Explore';
import Chat from './components/Chat/Chat';
import ChatList from './components/Chat/ChatList';
import Connections from './components/Connections';
import Settings from './components/Settings/Settings';
import EasterEgg from './components/Settings/EasterEgg';
import ProfileSettings from './components/Settings/ProfileSettings';
import InterestSettings from './components/Settings/InterestSettings';
import ThemeSettings from './components/Settings/ThemeSettings';
import { createStackNavigator } from '@react-navigation/stack';
import SignUp from './components/SigningUp/SignUp'
import FirstLaunch from './components/FirstLaunch'
import GetUserInterests from './components/SigningUp/GetUserInterests'
import GetFacultyInfo from './components/SigningUp/GetFacultyInfo'
import GetUserInfo from './components/SigningUp/GetUserInfo'
import ProfCourseList from './components/ProfCourseList'
import AsyncStorage from '@react-native-community/async-storage'
const Tab = createMaterialBottomTabNavigator();
const DashboardStack = createStackNavigator();
// displays onboarding on first launch
export const FirstNav = () => (
<NavigationContainer>
<DashboardStack.Navigator screenOptions={{ headerShown: false }}>
<DashboardStack.Screen name="FirstLaunch" component = {FirstLaunch} />
<DashboardStack.Screen name="Dashboard" component = {TabNavigation} />
<DashboardStack.Screen name="SignUp" component = {SignUp} />
<DashboardStack.Screen name="GetUserInterests" component = {GetUserInterests} />
<DashboardStack.Screen name="GetUserInfo" component = {GetUserInfo} />
<DashboardStack.Screen name="GetFacultyInfo" component = {GetFacultyInfo} />
<DashboardStack.Screen name="IndivChat" component = {Chat} />
<DashboardStack.Screen name="ProfileSettings" component = {ProfileSettings} />
<DashboardStack.Screen name="InterestSettings" component = {InterestSettings} />
<DashboardStack.Screen name="ThemeSettings" component = {ThemeSettings} />
<DashboardStack.Screen name="ProfCourseList" component = {ProfCourseList} />
<DashboardStack.Screen name="EasterEgg" component = {EasterEgg} />
</DashboardStack.Navigator>
</NavigationContainer>
)
// displays dashboard otherwise
export const Navigation = () => (
<NavigationContainer>
<DashboardStack.Navigator screenOptions={{ headerShown: false }}>
<DashboardStack.Screen name="Dashboard" component = {TabNavigation} />
<DashboardStack.Screen name="SignUp" component = {SignUp} />
<DashboardStack.Screen name="IndivChat" component = {Chat} />
<DashboardStack.Screen name="ProfileSettings" component = {ProfileSettings} />
<DashboardStack.Screen name="InterestSettings" component = {InterestSettings} />
<DashboardStack.Screen name="ThemeSettings" component = {ThemeSettings} />
<DashboardStack.Screen name="GetUserInterests" component = {GetUserInterests} />
<DashboardStack.Screen name="GetUserInfo" component = {GetUserInfo} />
<DashboardStack.Screen name="GetFacultyInfo" component = {GetFacultyInfo} />
<DashboardStack.Screen name="ProfCourseList" component = {ProfCourseList} />
<DashboardStack.Screen name="EasterEgg" component = {EasterEgg} />
</DashboardStack.Navigator>
</NavigationContainer>
)
// displays dashboard otherwise
export const ReturningUser = () => (
<NavigationContainer>
<DashboardStack.Navigator screenOptions={{ headerShown: false }}>
<DashboardStack.Screen name="SignUp" component = {SignUp} />
<DashboardStack.Screen name="Dashboard" component = {TabNavigation} />
<DashboardStack.Screen name="IndivChat" component = {Chat} />
<DashboardStack.Screen name="ProfileSettings" component = {ProfileSettings} />
<DashboardStack.Screen name="InterestSettings" component = {InterestSettings} />
<DashboardStack.Screen name="ThemeSettings" component = {ThemeSettings} />
<DashboardStack.Screen name="GetUserInterests" component = {GetUserInterests} />
<DashboardStack.Screen name="GetUserInfo" component = {GetUserInfo} />
<DashboardStack.Screen name="GetFacultyInfo" component = {GetFacultyInfo} />
<DashboardStack.Screen name="ProfCourseList" component = {ProfCourseList} />
<DashboardStack.Screen name="EasterEgg" component = {EasterEgg} />
</DashboardStack.Navigator>
</NavigationContainer>
)
const TabNavigation = () => {
console.log(useSelector)
const primary = useSelector(state => state.themeReducer.theme.PRIMARY_COLOR);
const bg = useSelector(state => state.themeReducer.theme.BG_COLOR);
const dispatch = useDispatch()
console.log("BG")
console.log(bg)
React.useEffect(() => {
AsyncStorage.getItem('theme').then(value => {
let savedTheme = JSON.parse(value)
console.log("IN NAVIGATION!")
console.log(savedTheme)
dispatch(pickTheme(savedTheme))
})
}, []);
return(
<Tab.Navigator
initialRouteName="Dashboard"
activeColor="#f0edf6"
style={{backgroundColor: bg}}
labeled={true}
barStyle={{
backgroundColor: primary,
borderRadius: 30,
overflow: 'hidden',
padding: 5,
marginBottom: 25,
marginLeft: 15,
marginRight: 15,
flex: .07,
}}>
<Tab.Screen
name="Home"
component={Dashboard}
options={{
tabBarIcon: ({ color }) => (
<MaterialCommunityIcons name="home" color={color} size={26}/>
),
}} />
<Tab.Screen
name="Explore"
component={Explore}
options={{
tabBarIcon: ({ color }) => (
<MaterialCommunityIcons name="account-search" color={color} size={26}/>
),
}}
/>
<Tab.Screen
name="Chat"
component={ChatList}
options={{
tabBarIcon: ({ color }) => (
<MaterialCommunityIcons name="chat" color={color} size={26}/>
),
}}
/>
<Tab.Screen
name="Connections"
component={Connections}
options={{
tabBarIcon: ({ color }) => (
<MaterialCommunityIcons name="account-group" color={color} size={26} />
),
}}
/>
<Tab.Screen
name="Settings"
component={Settings}
options={{
tabBarIcon: ({ color }) => (
<MaterialCommunityIcons name="settings" color={color} size={26}/>
),
}}
/>
</Tab.Navigator>
)
}