当后台模式/应用未打开时,使用rnfirebase(https://rnfirebase.io)在react native中显示Heads-up通知时出现问题,我尝试查找许多示例,但都失败了,这是我的脚本:
bgMessaging.js
// @flow
import firebase from 'react-native-firebase';
// Optional flow type
import type, { RemoteMessage } from 'react-native-firebase';
export default async (RemoteMessage) => {
// handle your message
return Promise.resolve();
}
index.js
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import bgMessaging from './apps/components/bgMessaging';
AppRegistry.registerComponent(appName, () => App);
AppRegistry.registerHeadlessTask('RNFirebaseBackgroundMessage', () => bgMessaging);
请大家帮我在后台模式下创建平视通知,因为我非常需要它。
谢谢。