-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavigation.js
107 lines (97 loc) · 4.08 KB
/
navigation.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
import React, { useContext,useEffect} from "react";
import { createStackNavigator } from "@react-navigation/stack";
import { NavigationContainer, NavigationContext, } from "@react-navigation/native";
import { Provider as ReduxProvider } from "react-redux";
import configureStore from "./redux/store";
import FirstScreen from "./screens/FirstScreen";
import FlashMessage from 'react-native-flash-message';
import MapView from './screens/MapView';
import Home from "./screens/Home";
import BookingOne from "./screens/BookingOne";
import BookingTwo from "./screens/BookingTwo";
import BookingThree from "./screens/BookingThree";
import BookingFour from "./screens/BookingFour";
import BookingSummary from "./screens/BookingSummary";
import AuthScreen from "./screens/AuthScreen";
import LoginScreen from "./screens/LoginScreen";
import AppointmentsScreen from "./screens/Appointments";
import Onboarding from "./screens/Onboarding";
import AccountScreen from "./screens/AccountScreen";
import ChatScreen from "./screens/ChatScreen"
import DoctorContactsList from "./screens/DoctorContactsList"
import * as Notifications from "expo-notifications";
import { NotificationsHandler } from "./utils/notifications";
import Medicine from "./screens/Medicine";
import MedicineDetails from "./screens/MedicineDetails";
import DeliMap from "./screens/DeliMap";
//Screens
const store = configureStore();
export default function RootNavigation() {
const Stack = createStackNavigator();
const screenOptions = {
headerShown: false,
};
//======== ============================================================
const { registerForPushNotificationsAsync, handleNotificationResponse } =
NotificationsHandler();
useEffect(() => {
registerForPushNotificationsAsync();
Notifications.setNotificationHandler({
handleNotification: async () => ({
shouldShowAlert: true,
shouldPlaySound: true,
shouldSetBadge: true,
}),
});
const responseListener =
Notifications.addNotificationResponseReceivedListener(
handleNotificationResponse
);
const schedulingOptions = {
content: {
title: "Doctor.Go",
body: "You have 1 appointment today",
},
trigger: {
seconds: 10,
},
};
// Schedule the notification
Notifications.scheduleNotificationAsync(schedulingOptions);
return () => {
if (responseListener)
Notifications.removeNotificationSubscription(responseListener);
};
}, []);
//=======================================================================
const navigation = useContext(NavigationContext)
return (
<ReduxProvider store={store}>
<NavigationContainer>
<Stack.Navigator initialRouteName="FirstScreen" screenOptions={screenOptions}>
<Stack.Screen name="FirstScreen" component={FirstScreen} />
<Stack.Screen name="MapView" component={MapView} />
<Stack.Screen name="Home" component={Home} />
<Stack.Screen name="BookingOne" component={BookingOne} />
<Stack.Screen name="BookingTwo" component={BookingTwo} />
<Stack.Screen name="BookingThree" component={BookingThree} />
<Stack.Screen name="BookingFour" component={BookingFour} />
<Stack.Screen name="BookingSummary" component={BookingSummary} />
<Stack.Screen name="AuthScreen" component={AuthScreen} />
<Stack.Screen name="LoginScreen" component={LoginScreen} />
<Stack.Screen name="Appointments" component={AppointmentsScreen} />
<Stack.Screen name="Onboarding" component={Onboarding} />
<Stack.Screen name="AccountScreen" component={AccountScreen} />
<Stack.Screen name="ChatScreen" component={ChatScreen} />
<Stack.Screen name="DoctorContactsList" component={DoctorContactsList} />
<Stack.Screen name="Medicine" component={Medicine} />
<Stack.Screen name="MedicineDetails" component={MedicineDetails} />
<Stack.Screen name="DeliMap" component={DeliMap} />
</Stack.Navigator>
<FlashMessage
position="top"
/>
</NavigationContainer>
</ReduxProvider>
);
}