|
1 |
| -import { NavigationContainer } from "@react-navigation/native"; |
2 |
| -import { createNativeStackNavigator } from "@react-navigation/native-stack"; |
3 |
| -import { SafeAreaProvider } from "react-native-safe-area-context"; |
4 |
| -import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; |
5 | 1 | import React, { useState } from 'react';
|
6 | 2 | import { MaterialIcons } from "@expo/vector-icons";
|
7 | 3 | import BackButton from "./src/components/BackButton";
|
8 | 4 |
|
9 | 5 | // Welcome Screens
|
10 |
| -import StudentWelcomeScreen from "./src/screens/Student WelcomeScreen"; |
11 |
| -import StudentSignIn from "./src/screens/Student SignIn"; |
12 |
| -import StudentSignUp from "./src/screens/Student SignUp"; |
13 |
| -import ResetPasswordScreen from "./src/screens/ResetPasswordScreen"; |
14 |
| -import Home from "./src/screens/HomeScreen"; |
15 |
| -import HomeScreen from "./src/screens/HomeScreen1"; |
16 |
| - |
17 |
| -// App Screens |
18 |
| -import BookingScreen from "./src/screens/BookingScreen"; |
19 |
| -import Payment from "./src/screens/PaymentScreen"; |
20 |
| -import Summary from "./src/screens/SummaryScreen"; |
21 |
| -import ProfileScreen from "./src/screens/Pro"; |
22 |
| -import HostelBookingInfo from "./src/screens/Booking Info"; |
23 |
| -import Manage from "./src/screens/ManageScreen"; |
24 |
| -import HostelInfo from "./src/screens/HostelInfoScreen"; |
25 |
| -import AddRoom from "./src/screens/AddRoomScreen"; |
26 |
| -import Congratulation from "./src/screens/CongratulationScreen"; |
27 |
| -import Congrat from "./src/screens/Congratulation"; |
28 |
| -import Splash from "./src/screens/splash"; |
29 |
| -import Hostel from "./src/screens/Hostel"; |
30 |
| -import ManagerUpload from "./src/screens/Manager Upload"; |
31 |
| -import ViewScreen from "./src/screens/View"; |
32 |
| -import UploadHostelScreen from "./src/screens/UploadHostelForm"; |
33 |
| -import Hdetails from "./src/screens/Hdetails"; |
34 |
| -import UploadHdetails from "./src/screens/UploadHdetails"; |
35 |
| -import BackCongratulation from "./src/screens/BackToHome"; |
36 |
| -import ResetPassword from "./src/screens/ResetPasswordScreen"; |
37 |
| -import { AuthProvider } from "./src/components/AuthContext"; |
38 |
| -import RoomCapacity from "./src/screens/RoomCapacity"; |
39 |
| -import Rooms from "./src/screens/Rooms"; |
40 |
| -import Facilities from "./src/screens/Facilities"; |
41 |
| -import Fdetails from "./src/screens/Fdetails"; |
42 |
| - |
43 |
| -import UploadRoomScreen from "./src/screens/UploadRoomForm"; |
44 |
| -import UploadRoom from "./src/screens/UploadRoom"; |
45 |
| -import Reviews from "./src/screens/Reviews"; |
46 |
| -import Occupants from "./src/screens/Occupants"; |
47 |
| - |
48 |
| - |
49 |
| -import ManagerWelcomeScreen from "./src/screens/Manager WelcomeScreen"; |
50 |
| -import ManagerSignIn from "./src/screens/Manager SignIn"; |
51 |
| - |
52 |
| - |
53 |
| -const Stack = createNativeStackNavigator(); |
54 |
| -const Tab = createBottomTabNavigator(); |
55 |
| - |
56 |
| -const TabNavigator = () => ( |
57 |
| - <AuthProvider> |
58 |
| - <Tab.Navigator> |
59 |
| - <Tab.Screen |
60 |
| - name="Hostel" |
61 |
| - component={Hostel} |
62 |
| - options={{ |
63 |
| - headerShown: false, |
64 |
| - tabBarIcon: ({ color, size }) => ( |
65 |
| - <MaterialIcons name="home" color={color} size={size} /> |
66 |
| - ), |
67 |
| - }} |
68 |
| - /> |
69 |
| - <Tab.Screen |
70 |
| - name="Book" |
71 |
| - component={BookingScreen} |
72 |
| - options={{ |
73 |
| - headerShown: false, |
74 |
| - tabBarIcon: ({ color, size }) => ( |
75 |
| - <MaterialIcons name="book" color={color} size={size} /> |
76 |
| - ), |
77 |
| - }} |
78 |
| - /> |
79 |
| - <Tab.Screen |
80 |
| - name="Profile" |
81 |
| - component={ProfileScreen} |
82 |
| - options={{ |
83 |
| - headerShown: false, |
84 |
| - tabBarIcon: ({ color, size }) => ( |
85 |
| - <MaterialIcons name="person" color={color} size={size} /> |
86 |
| - ), |
87 |
| - }} |
88 |
| - /> |
89 |
| - </Tab.Navigator> |
90 |
| - </AuthProvider> |
91 |
| -); |
92 |
| - |
| 6 | +import RootNavigation from "./src/navigation"; |
| 7 | +import { NavigationContainer } from '@react-navigation/native'; |
| 8 | +import { AuthProvider } from './src/Hooks/AuthContext'; |
| 9 | +import { HostelContext } from './src/Hooks/HostelContext'; |
93 | 10 | function App() {
|
94 | 11 | const [isLoggedIn, setIsLoggedIn] = useState(false);
|
95 | 12 |
|
96 | 13 | return (
|
97 |
| - <AuthProvider> |
98 |
| - <SafeAreaProvider> |
99 |
| - <NavigationContainer> |
100 |
| - <Stack.Navigator initialRouteName="Splash"> |
101 |
| - <Stack.Screen |
102 |
| - name="Splash" |
103 |
| - component={Splash} |
104 |
| - options={{ headerShown: false }} |
105 |
| - /> |
106 |
| - <Stack.Screen |
107 |
| - name="RoomCapacity" |
108 |
| - component={RoomCapacity} |
109 |
| - options={{ headerShown: false }} |
110 |
| - /> |
111 |
| - <Stack.Screen |
112 |
| - name="Rooms" |
113 |
| - component={Rooms} |
114 |
| - options={{ headerShown: false }} |
115 |
| - /> |
116 |
| - <Stack.Screen |
117 |
| - name="Facilities" |
118 |
| - component={Facilities} |
119 |
| - options={{ headerShown: false }} |
120 |
| - /> |
121 |
| - <Stack.Screen |
122 |
| - name="Fdetails" |
123 |
| - component={Fdetails} |
124 |
| - options={{ headerShown: false }} |
125 |
| - /> |
126 |
| - <Stack.Screen |
127 |
| - name="HomeScreen" |
128 |
| - component={HomeScreen} |
129 |
| - options={{ headerShown: false }} |
130 |
| - /> |
131 |
| - <Stack.Screen |
132 |
| - name="Home" |
133 |
| - component={Home} |
134 |
| - options={{ headerShown: false }} |
135 |
| - /> |
136 |
| - <Stack.Screen |
137 |
| - options={{ headerShown: false }} |
138 |
| - name="ManagerWelcomeScreen" |
139 |
| - component={ManagerWelcomeScreen} |
140 |
| - /> |
141 |
| - <Stack.Screen |
142 |
| - name="TabNavigator" |
143 |
| - component={TabNavigator} |
144 |
| - options={{ headerShown: false }} |
145 |
| - /> |
146 |
| - <Stack.Screen |
147 |
| - name="Reviews" |
148 |
| - component={Reviews} |
149 |
| - options={{ headerShown: false }} |
150 |
| - /> |
151 |
| - <Stack.Screen |
152 |
| - options={{ headerShown: false }} |
153 |
| - name="StudentSignUp" |
154 |
| - component={StudentSignUp} |
155 |
| - /> |
156 |
| - <Stack.Screen |
157 |
| - name="Occupants" |
158 |
| - component={Occupants} |
159 |
| - options={{ headerShown: false }} |
160 |
| - /> |
161 |
| - <Stack.Screen |
162 |
| - options={{ headerShown: false }} |
163 |
| - name="StudentSignIn" |
164 |
| - component={StudentSignIn} |
165 |
| - /> |
166 |
| - <Stack.Screen |
167 |
| - options={{ headerShown: false }} |
168 |
| - name="ManagerSignIn" |
169 |
| - component={ManagerSignIn} |
170 |
| - /> |
171 |
| - <Stack.Screen |
172 |
| - options={{ headerShown: false }} |
173 |
| - name="ResetPasswordScreen" |
174 |
| - component={ResetPasswordScreen} |
175 |
| - /> |
176 |
| - <Stack.Screen |
177 |
| - options={{ headerShown: false }} |
178 |
| - name="StudentWelcomeScreen" |
179 |
| - component={StudentWelcomeScreen} |
180 |
| - /> |
181 |
| - <Stack.Screen |
182 |
| - name="Summary" |
183 |
| - component={Summary} |
184 |
| - options={{ headerShown: true }} |
185 |
| - /> |
186 |
| - <Stack.Screen |
187 |
| - name="Payment" |
188 |
| - component={Payment} |
189 |
| - options={{ headerShown: true }} |
190 |
| - /> |
191 |
| - <Stack.Screen |
192 |
| - name="HostelBookingInfo" |
193 |
| - component={HostelBookingInfo} |
194 |
| - options={{ headerShown: true }} |
195 |
| - /> |
196 |
| - <Stack.Screen |
197 |
| - name="ManagerUpload" |
198 |
| - component={ManagerUpload} |
199 |
| - options={{ headerShown: false }} |
200 |
| - /> |
201 |
| - <Stack.Screen |
202 |
| - name="UploadHostelScreen" |
203 |
| - component={UploadHostelScreen} |
204 |
| - options={{ headerShown: false }} |
205 |
| - /> |
206 |
| - <Stack.Screen |
207 |
| - name="UploadRoom" |
208 |
| - component={UploadRoom} |
209 |
| - options={{ headerShown: false }} |
210 |
| - /> |
211 |
| - <Stack.Screen |
212 |
| - name="UploadRoomScreen" |
213 |
| - component={UploadRoomScreen} |
214 |
| - options={{ headerShown: false }} |
215 |
| - /> |
216 |
| - <Stack.Screen |
217 |
| - name="Manage" |
218 |
| - component={Manage} |
219 |
| - options={{ |
220 |
| - headerShown: false, |
221 |
| - headerTitle: 'My Hostels', |
222 |
| - headerTitleAlign: 'center', |
223 |
| - headerTitleStyle: { |
224 |
| - fontWeight: 'bold', |
225 |
| - fontSize: 24, |
226 |
| - }, |
227 |
| - }} |
228 |
| - /> |
229 |
| - <Stack.Screen |
230 |
| - name="View" |
231 |
| - component={ViewScreen} |
232 |
| - options={({ navigation }) => ({ |
233 |
| - headerTitle: 'Hostel Name 1', // Or fetch the hostel name dynamically |
234 |
| - headerLeft: () => <BackButton goBack={navigation.goBack} />, |
235 |
| - })} |
236 |
| - /> |
237 |
| - <Stack.Screen |
238 |
| - options={{ headerShown: false }} |
239 |
| - name="AddRoom" |
240 |
| - component={AddRoom} |
241 |
| - /> |
242 |
| - <Stack.Screen |
243 |
| - options={{ headerShown: false }} |
244 |
| - name="Congrat" |
245 |
| - component={Congrat} |
246 |
| - /> |
247 |
| - <Stack.Screen |
248 |
| - options={{ headerShown: false }} |
249 |
| - name="Hdetails" |
250 |
| - component={Hdetails} |
251 |
| - /> |
252 |
| - <Stack.Screen |
253 |
| - options={{ headerShown: false }} |
254 |
| - name="UploadHdetails" |
255 |
| - component={UploadHdetails} |
256 |
| - /> |
257 |
| - <Stack.Screen |
258 |
| - options={{ headerShown: false }} |
259 |
| - name="BackCongratulation" |
260 |
| - component={BackCongratulation} |
261 |
| - /> |
262 |
| - <Stack.Screen |
263 |
| - options={{ headerShown: false }} |
264 |
| - name="HostelInfo" |
265 |
| - component={HostelInfo} |
266 |
| - /> |
267 |
| - <Stack.Screen |
268 |
| - options={{ headerShown: false }} |
269 |
| - name="ResetPassword" |
270 |
| - component={ResetPassword} |
271 |
| - /> |
272 |
| - </Stack.Navigator> |
273 |
| - </NavigationContainer> |
274 |
| - </SafeAreaProvider> |
275 |
| - </AuthProvider> |
| 14 | + <NavigationContainer> |
| 15 | + <AuthProvider> |
| 16 | + <HostelContext> |
| 17 | + <RootNavigation /> |
| 18 | + </HostelContext> |
| 19 | + </AuthProvider> |
| 20 | + </NavigationContainer> |
276 | 21 | );
|
277 | 22 | };
|
278 | 23 |
|
|
0 commit comments