forked from TATA-V/fromnow-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
33 lines (28 loc) · 935 Bytes
/
index.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
/**
* @format
*/
import React from 'react';
import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';
import messaging from '@react-native-firebase/messaging';
import { clientNotiMessage } from '@utils/clientNoti';
import notifee, { EventType } from '@notifee/react-native';
import { clientNotiClick } from '@utils/clientNoti';
notifee.onBackgroundEvent(async ({ type, detail }) => {
if (type === EventType.PRESS) {
await clientNotiClick(detail);
} else if (type === EventType.DISMISSED) {
notifee.cancelNotification(detail.notification.id);
notifee.cancelDisplayedNotification(detail.notification.id);
}
});
// Background 알림
messaging().setBackgroundMessageHandler(clientNotiMessage);
function HeadlessCheck({ isHeadless }) {
if (isHeadless) {
return null;
}
return <App />;
}
AppRegistry.registerComponent(appName, () => HeadlessCheck);