-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
29 lines (26 loc) · 807 Bytes
/
index.js
File metadata and controls
29 lines (26 loc) · 807 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
/**
* @format
*/
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import 'react-native-reanimated';
import 'react-native-gesture-handler';
import messaging from '@react-native-firebase/messaging';
import crashlytics from '@react-native-firebase/crashlytics';
import {
appendNotificationToStorage,
buildNotificationPayload,
} from './src/Utils/notificationHelpers';
messaging().setBackgroundMessageHandler(async remoteMessage => {
try {
const payload = buildNotificationPayload(remoteMessage, false);
console.log('Payload:', payload);
if (payload) {
await appendNotificationToStorage(payload);
}
} catch (error) {
crashlytics().recordError(error);
}
});
AppRegistry.registerComponent(appName, () => App);