messaging().onMessage(async remoteMessage => { console.log('[FCMService] a new FCM message arrived!', remoteMessage); if (remoteMessage) { let notification = null; if (Platform.OS === 'ios') { notification = remoteMessage.data.notification; } else { notification = remoteMessage.notification; } onNotification(notification); } })