-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
29 lines (24 loc) · 857 Bytes
/
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
/**
* @format
*/
import messaging from '@react-native-firebase/messaging';
import {AppRegistry, Text} from 'react-native';
import 'react-native-gesture-handler';
import 'react-native-reanimated';
import App from './App';
import {name as appName} from './app.json';
import {onDisplayNotification} from './Src/Components/onDisplayNotification';
Text.defaultProps = Text.defaultProps || {};
Text.defaultProps.allowFontScaling = false;
if (!__DEV__) {
console.log = () => {};
}
messaging().setBackgroundMessageHandler(async remoteMessage => {
console.log('setBackgroundMessageHandler remoteMessage', remoteMessage);
const title = remoteMessage.notification?.title || '';
const body = remoteMessage.notification?.body || '';
if (title && body) {
onDisplayNotification(title, body);
}
});
AppRegistry.registerComponent(appName, () => App);