-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
33 lines (28 loc) Β· 1.01 KB
/
index.js
File metadata and controls
33 lines (28 loc) Β· 1.01 KB
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 { AppRegistry } from 'react-native';
import notifee, { EventType } from '@notifee/react-native';
import App from './App';
import { name as appName } from './app.json';
// messaging().setBackgroundMessageHandler(async (remoteMessage) => {
// console.log('FCM message received in background:', remoteMessage);
// // λ°λ‘ notifeeλ‘ νμ
// await notifee.displayNotification({
// title: remoteMessage.notification?.title || 'Background Message',
// body: remoteMessage.notification?.body || 'You received a new background message.',
// android: { channelId: 'default' },
// });
// });
notifee.onBackgroundEvent(async ({ type, detail }) => {
switch (type) {
case EventType.DISMISSED:
console.log('Notification dismissed:', detail.notification?.id);
break;
case EventType.PRESS:
console.log('Notification pressed:', detail.notification?.id);
// TODO: λ€λΉκ²μ΄μ
μ΄λ
break;
}
});
AppRegistry.registerComponent(appName, () => App);