React native 收到通知后从后台启动React本机应用程序

React native 收到通知后从后台启动React本机应用程序,react-native,React Native,我正在处理react本机应用程序,我的要求是在收到通知时启动特定屏幕 通知在所有状态下都可以正常工作,即前台或后台 我正在使用以下库: react-navigation @react-native-firebase/messaging react-native-push-notification 以下是处理通知的代码: messaging().setBackgroundMessageHandler(async remoteMessage => { console.log('Messa

我正在处理react本机应用程序,我的要求是在收到通知时启动特定屏幕

通知在所有状态下都可以正常工作,即前台或后台

我正在使用以下库:

react-navigation
@react-native-firebase/messaging
react-native-push-notification
以下是处理通知的代码:

messaging().setBackgroundMessageHandler(async remoteMessage => {
  console.log('Message handled in the background!', remoteMessage);
  let text = {
    title: remoteMessage.data.title,
    body: remoteMessage.data.body,
  }
  notif.cancelAll();
  notif.localNotif(text);
  NavigationService.navigate('Contact', { userName: 'Lucy' })
});
还编写了一个导航代码,说明收到通知的方法

我可以看到应用程序导航到特定屏幕,但它并没有启动应用程序


有人能帮我吗?

嗨,你解决了这个问题吗?谢谢你好,你解决了吗?非常感谢。