-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
34 lines (27 loc) · 1.05 KB
/
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
34
import {AppRegistry} from 'react-native';
import App from './src/App';
import {name as appName} from './app.json';
import {ONESIGNAL_APP_ID} from '@env';
import OneSignal from 'react-native-onesignal';
OneSignal.setLogLevel(6, 0);
OneSignal.setAppId(ONESIGNAL_APP_ID);
// OneSignal.promptForPushNotificationsWithUserResponse(response => {
// console.log('Prompt response:', response);
// });
OneSignal.setNotificationWillShowInForegroundHandler(
notificationReceivedEvent => {
// console.log(
// 'OneSignal: notification will show in foreground:',
// notificationReceivedEvent,
// );
let notification = notificationReceivedEvent.getNotification();
// console.log('notification: ', notification);
// const data = notification.additionalData;
// console.log('additionalData: ', data);
notificationReceivedEvent.complete(notification);
},
);
OneSignal.setNotificationOpenedHandler(notification => {
// console.log('OneSignal: notification opened:', notification);
});
AppRegistry.registerComponent(appName, () => App);