-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
37 lines (32 loc) · 1.27 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
35
36
37
/**
* @format
*/
import {AppRegistry} from 'react-native';
import React from 'react';
import messaging from '@react-native-firebase/messaging';
import notifee from '@notifee/react-native';
import App from './App';
import {name as appName} from './app.json';
messaging().setBackgroundMessageHandler(async remoteMessage => {
const {notification, data} = remoteMessage;
notifee.onBackgroundEvent(async ({type, details}) => {
return notifee.displayNotification({
title: `<p style="color: #212121; font-size: 15px; font-weight: 500; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;">${notification.title}</p>`,
body: `<p style="color: #212121; font-size: 13px; font-weight: 400; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;">${notification.body}</p>`,
android: {
largeIcon:
'https://res.cloudinary.com/omodauda/image/upload/v1667560065/icon_gdhwdi.jpg',
},
data,
});
});
});
function HeadlessCheck({isHeadless}) {
if (isHeadless) {
return null;
}
return <App />;
}
AppRegistry.registerComponent(appName, () => HeadlessCheck);