1
1
import * as React from 'react' ;
2
2
import { NavigationContainer } from '@react-navigation/native' ;
3
3
import { createNativeStackNavigator } from '@react-navigation/native-stack' ;
4
- import type { RootStackParamList } from './types' ;
4
+ import { createBottomTabNavigator } from '@react-navigation/bottom-tabs' ;
5
+ import Ionicons from '@expo/vector-icons/Ionicons' ;
6
+ import { Fontisto , AntDesign } from '@expo/vector-icons' ;
7
+ import Colors from '../../assets/colorConstants' ;
5
8
import HomeScreen from '../screens/home' ;
6
9
import LogInScreen from '../screens/login' ;
7
10
import SignUpScreen from '../screens/signup' ;
8
11
import DashBoardScreen from '../screens/dashboard' ;
9
12
import Forum from '../screens/forum' ;
10
- import CommunityHub from '../screens/communityHub' ;
11
13
import FoodForum from '../screens/Food/foodForum' ;
12
14
import EnergyForum from '../screens/Energy/energyForum' ;
13
15
import TransportationForum from '../screens/Transportation/transportationForum' ;
@@ -17,34 +19,118 @@ import TransportationHistory from '../screens/Transportation/transportationHisto
17
19
import EnergyHistory from '../screens/Energy/energyHistory' ;
18
20
import EnergyEntryEdit from '../screens/Energy/energyEntryEdit' ;
19
21
import FoodEntryEdit from '../screens/Food/foodEntryEdit' ;
22
+ import SettingsScreen from '../screens/settings' ;
23
+ import YourForms from '../screens/yourForms' ;
24
+ import CommunityHub from '../screens/communityHub' ;
20
25
21
- const Stack = createNativeStackNavigator < RootStackParamList > ( ) ;
26
+ const Stack = createNativeStackNavigator ( ) ;
27
+ const Tab = createBottomTabNavigator ( ) ;
22
28
23
29
const AppNavigation = ( ) : JSX . Element => {
24
30
return (
31
+
25
32
< NavigationContainer >
26
- < Stack . Navigator screenOptions = { { headerShown : false } } >
27
- < Stack . Screen name = "Home" component = { HomeScreen } />
28
- < Stack . Screen name = "LogIn" component = { LogInScreen } />
29
- < Stack . Screen name = "SignUp" component = { SignUpScreen } />
30
- < Stack . Screen name = "DashBoard" component = { DashBoardScreen } />
31
- < Stack . Screen name = "Forum" component = { Forum } />
32
- < Stack . Screen name = "CommunityHub" component = { CommunityHub } />
33
-
34
- < Stack . Screen name = "TransportationForum" component = { TransportationForum } />
35
- < Stack . Screen name = "TransportationEntryEdit" component = { TransportationEntryEdit } />
36
- < Stack . Screen name = "TransportationHistory" component = { TransportationHistory } />
37
-
38
- < Stack . Screen name = "FoodForum" component = { FoodForum } />
39
- < Stack . Screen name = "FoodEntryEdit" component = { FoodEntryEdit } />
40
- < Stack . Screen name = "FoodHistory" component = { FoodHistory } />
41
-
42
- < Stack . Screen name = "EnergyForum" component = { EnergyForum } />
43
- < Stack . Screen name = "EnergyEntryEdit" component = { EnergyEntryEdit } />
44
- < Stack . Screen name = "EnergyHistory" component = { EnergyHistory } />
33
+ < Stack . Navigator >
34
+ < Stack . Screen name = "Home" component = { HomeScreen } options = { { headerShown : false } } />
35
+ < Stack . Screen name = "LogIn" component = { LogInScreen } options = { { headerShown : false } } />
36
+ < Stack . Screen name = "SignUp" component = { SignUpScreen } options = { { headerShown : false } } />
37
+ < Stack . Screen name = "Settings" component = { SettingsScreen } />
38
+ < Stack . Screen name = "MainApp" component = { MainAppTabs } options = { { headerShown : false } } />
39
+
40
+ < Stack . Screen name = "Forum" component = { Forum } options = { { headerShown : false } } />
41
+
42
+ < Stack . Screen name = "TransportationForum" component = { TransportationForum } options = { { headerShown : false } } />
43
+ < Stack . Screen name = "TransportationEntryEdit" component = { TransportationEntryEdit } options = { { headerShown : false } } />
44
+ < Stack . Screen name = "TransportationHistory" component = { TransportationHistory } options = { { headerShown : false } } />
45
+
46
+ < Stack . Screen name = "FoodForum" component = { FoodForum } options = { { headerShown : false } } />
47
+ < Stack . Screen name = "FoodEntryEdit" component = { FoodEntryEdit } options = { { headerShown : false } } />
48
+ < Stack . Screen name = "FoodHistory" component = { FoodHistory } options = { { headerShown : false } } />
49
+
50
+ < Stack . Screen name = "EnergyForum" component = { EnergyForum } options = { { headerShown : false } } />
51
+ < Stack . Screen name = "EnergyEntryEdit" component = { EnergyEntryEdit } options = { { headerShown : false } } />
52
+ < Stack . Screen name = "EnergyHistory" component = { EnergyHistory } options = { { headerShown : false } } />
53
+
45
54
</ Stack . Navigator >
46
- </ NavigationContainer >
55
+ </ NavigationContainer >
56
+ ) ;
57
+ }
58
+
59
+ const MainAppTabs = ( ) : JSX . Element => {
60
+ return (
61
+ < Tab . Navigator
62
+ screenOptions = { {
63
+ tabBarActiveTintColor : Colors . LIGHTFGREEN ,
64
+ tabBarInactiveTintColor : Colors . WHITE ,
65
+ tabBarStyle : {
66
+ backgroundColor : Colors . DARKGREEN ,
67
+ } ,
68
+ } }
69
+ >
70
+
71
+ < Tab . Screen name = "Dashboard" component = { DashboardStack }
72
+ options = { {
73
+ headerShown : false ,
74
+ tabBarIcon : ( { focused } ) => (
75
+ < Ionicons
76
+ name = { 'home-sharp' }
77
+ size = { 24 }
78
+ style = { { color : ( focused as boolean ) ? Colors . LIGHTFGREEN : Colors . WHITE } }
79
+ />
80
+ ) ,
81
+ } }
82
+ />
83
+ < Tab . Screen name = "SettingsPage" component = { SettingsScreen }
84
+ options = { {
85
+ title : 'Settings' ,
86
+ headerStyle : { backgroundColor : Colors . DARKGREEN } ,
87
+ headerTintColor : '#fff' ,
88
+ headerTitleStyle : { fontWeight : 'bold' } ,
89
+ tabBarIcon : ( { focused } ) => (
90
+ < Ionicons
91
+ name = { 'settings' }
92
+ size = { 24 }
93
+ style = { { color : ( focused as boolean ) ? Colors . LIGHTFGREEN : Colors . WHITE } }
94
+ />
95
+ ) ,
96
+ } } />
97
+ < Tab . Screen name = "YourForms" component = { YourForms }
98
+ options = { {
99
+ title : 'My Forms' ,
100
+ headerStyle : { backgroundColor : Colors . DARKGREEN } ,
101
+ headerTintColor : '#fff' ,
102
+ headerTitleStyle : { fontWeight : 'bold' } ,
103
+ tabBarIcon : ( { focused } ) => (
104
+ < AntDesign name = "form" size = { 24 } color = "black" style = { { color : ( focused as boolean ) ? Colors . LIGHTFGREEN : Colors . WHITE } } />
105
+ ) ,
106
+ } } />
107
+ < Tab . Screen name = "CommunityHub" component = { CommunityHub }
108
+ options = { {
109
+ title : 'Community Hub' ,
110
+ headerStyle : { backgroundColor : Colors . DARKGREEN } ,
111
+ headerTintColor : '#fff' ,
112
+ headerTitleStyle : { fontWeight : 'bold' } ,
113
+ tabBarIcon : ( { focused } ) => (
114
+ < Fontisto name = "world-o" size = { 24 } color = "black" style = { { color : ( focused as boolean ) ? Colors . LIGHTFGREEN : Colors . WHITE } } />
115
+ ) ,
116
+ } } />
117
+ </ Tab . Navigator >
47
118
) ;
48
119
} ;
49
120
121
+ const DashboardStack = ( ) : React . JSX . Element => (
122
+ < Stack . Navigator >
123
+ < Stack . Screen
124
+ name = "DashBoard"
125
+ component = { DashBoardScreen }
126
+ options = { {
127
+ title : 'Dashboard' ,
128
+ headerStyle : { backgroundColor : Colors . DARKGREEN } ,
129
+ headerTintColor : '#fff' ,
130
+ headerTitleStyle : { fontWeight : 'bold' } ,
131
+ } }
132
+ />
133
+ </ Stack . Navigator >
134
+ ) ;
135
+
50
136
export default AppNavigation ;
0 commit comments