-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
34 lines (27 loc) · 845 Bytes
/
index.js
File metadata and controls
34 lines (27 loc) · 845 Bytes
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
/**
* @format
*/
import React from 'react';
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import notifee, {EventType} from '@notifee/react-native';
notifee.onBackgroundEvent(async ({type, detail}) => {
const {notification} = detail;
if (type === EventType.DISMISSED) {
console.log('DISMISS Notifee BG: ', detail.notification?.title);
// Remove the notification
return await notifee.cancelNotification(notification.id);
}
if (type === EventType.PRESS) {
console.log('PRESS Notifee BG: ', detail.notification?.title);
}
});
function HeadlessCheck({isHeadless}) {
if (isHeadless) {
// App has been launched in the background by iOS, ignore
return null;
}
return <App />;
}
AppRegistry.registerComponent(appName, () => HeadlessCheck);