forked from remik2212/epns-mobile-app
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
34 lines (26 loc) · 1.01 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 { registerRootComponent } from 'expo';
import React from 'react';
import { AppRegistry } from 'react-native';
import messaging from '@react-native-firebase/messaging';
import Notify from 'src/singletons/Notify';
import App from './App';
// Register background handler
messaging().setBackgroundMessageHandler(async remoteMessage => {
return new Promise(async (resolve, reject) => {
//console.log('Message handled in the background!', remoteMessage);
await Notify.instance.handleIncomingPushAppInBG(remoteMessage);
resolve(true);
});
});
function HeadlessCheck({ isHeadless }) {
if (isHeadless) {
// App has been launched in the background by iOS, ignore
return null;
}
return <App />;
}
AppRegistry.registerComponent('main', () => HeadlessCheck);
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in the Expo client or in a native build,
// the environment is set up appropriately
// registerRootComponent(App);