-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
51 lines (36 loc) · 1.35 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
import { StatusBar } from 'expo-status-bar';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import Navigator from './navigation';
import { registerForPushNotificationsAsync } from "./services/Notification";
import { useEffect, useState, useRef, useContext } from 'react';
import { LogBox } from 'react-native';
import { InfoProvider } from './Context/InfoContext';
import * as Notifications from 'expo-notifications';
Notifications.setNotificationHandler({
handleNotification: async () => ({
shouldShowAlert: true,
shouldPlaySound: true,
shouldSetBadge: true,
}),
});
export default function App() {
const notificationListener = useRef();
const responseListener = useRef();
useEffect(() => {
notificationListener.current = Notifications.addNotificationReceivedListener(notification => {});
responseListener.current = Notifications.addNotificationResponseReceivedListener(response => {});
return () => {
Notifications.removeNotificationSubscription(notificationListener.current);
Notifications.removeNotificationSubscription(responseListener.current);
};
}, []);
return (
<InfoProvider>
<SafeAreaProvider>
<Navigator />
<StatusBar />
</SafeAreaProvider>
</InfoProvider>
);
}
LogBox.ignoreLogs(['Setting a timer for a long period of time'])