React native 反应本机推送通知启用/禁用

React native 反应本机推送通知启用/禁用,react-native,react-native-push-notification,React Native,React Native Push Notification,大家好,我在我的应用软件包中设置了react native push notification import PushNotification from 'react-native-push-notification'; import PushNotificationIOS from '@react-native-community/push-notification-ios'; import firebase from '@react-native-firebase/app'; impor

大家好,我在我的应用软件包中设置了
react native push notification

import PushNotification from 'react-native-push-notification';
 import PushNotificationIOS from '@react-native-community/push-notification-ios';

import firebase from '@react-native-firebase/app';
import '@react-native-firebase/messaging';
我不能发送、显示和单击通知,这都没关系

我只想禁用在消息屏幕中显示应用程序时的通知

银幕上

import PushNotification from 'react-native-push-notification';
import firebase from '@react-native-firebase/app';
import '@react-native-firebase/messaging';

  componentDidMount() {
     this._unsubscribe = this.props.navigation.addListener('focus', () => {     
      this.getMessageUsersList();
      //PushNotification.abandonPermissions()
      Orientation.lockToPortrait();
    });
    
    PushNotification.abandonPermissions()
作用

 requestPermissions  () {
    firebase
      .messaging()
      .requestPermission()
      .then((status: FirebaseMessagingTypes.AuthorizationStatus) => {
        console.log('requestPermissions')
        if (status === 1) {
          console.log('Authorized');
        //  onMessage();
        } else {
          console.log('Not authorized');
        }
      })
      .catch((e) => console.log(e));
  };
卸载

  componentWillUnmount() {
 
    this.requestPermissions()
  }
它确实禁用了通知,但当我打开另一个屏幕时,它仍然禁用,所以我无法显示通知

我该换什么。多谢各位