title: React Native: Firebase notification not showing
body: <p>When trying to send test notification from Firebase my app does not receive any event. In the notification composer I am picking specifically the <code>fcmToken</code> of my iOS device:</p>
  
  <p><a href="https://i.stack.imgur.com/qUxgi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qUxgi.png" alt="Notification composer"></a></p>
  
  <p>I have checked that I am using the right <code>fcmToken</code> and authentication keys.</p>
  
  <p>Could it have something to do with the version of <code>react-native-firebase</code> that I am using? Or that the initialization routine is in the <code>react-navigator</code>?</p>
  
  <ul>
  <li>react-native-firebase@5.5.6</li>
  <li>react-navigation@3.11.1</li>
  </ul>
  
  <p><code>Navigator.js</code></p>
  
  <pre><code>export default class Navigator extends Component {
      constructor(props) {
          super(props)
      }
  
      async componentDidMount() {
          FirebaseService.checkPermission();
  </code></pre>
  
  <p>FirebaseService.createNotificationListeners();
          }</p>
  
  <pre><code>    //Remove listeners allocated in createNotificationListeners()
      componentWillUnmount() {
          FirebaseService.notificationListener();
          FirebaseService.notificationOpenedListener();
      }
  
      render() {
          return (
              &lt;View style={{ flex: 1 }}&gt;
                      &lt;Route
                          onNavigationStateChange={(prevState, currentState) =&gt; {
                              const currentScreen = getActiveRouteName(currentState);
                              const prevScreen = getActiveRouteName(prevState);
                              nav.activeRouteName = currentScreen;
  
                              if (prevScreen !== currentScreen) {
  
                                  if (currentScreen == "captureView") {
                                      this.resetSafearea("never")
                                  } else {
                                      this.resetSafearea("always")
                                  }
                              }
                          }}
                      /&gt;
              &lt;/View&gt;
          );
      }
  }
  </code></pre>
  
  <p><code>FirebaseService.js</code></p>
  
  <pre><code>import AsyncStorage from '@react-native-community/async-storage';
  import Firebase from "react-native-firebase";
  
  export default class FirebaseService {
  
      //1
      static checkPermission = async () =&gt; {
          const enabled = await Firebase.messaging().hasPermission();
          if (enabled) {
              FirebaseService.getToken();
          } else {
              FirebaseService.requestPermission();
          }
      }
  
      //2
      static requestPermission = async () =&gt; {
          try {
              await Firebase.messaging().requestPermission();
              // User has authorised
              FirebaseService.getToken();
          } catch (error) {
              // User has rejected permissions
              console.log('permission rejected');
          }
      }
  
      //3
      static getToken = async () =&gt; {
          let fcmToken = await AsyncStorage.getItem('fcmToken');
          if (!fcmToken) {
              fcmToken = await Firebase.messaging().getToken();
              if (fcmToken) {
                  // user has a device token
                  await AsyncStorage.setItem('fcmToken', fcmToken);
              }
          }
          return fcmToken;
      }
  
      static createNotificationListeners = async () =&gt; {
          /*
          * Triggered when a particular notification has been received in foreground
          * */
          FirebaseService.notificationListener = Firebase.notifications().onNotification((notification) =&gt; {
              const { title, body } = notification;
              console.log("notification", notification);
          });
  
          /*
          * If your app is in background, you can listen for when a notification is clicked / tapped / opened as follows:
          * */
          FirebaseService.notificationOpenedListener = Firebase.notifications().onNotificationOpened((notificationOpen) =&gt; {
              const { title, body } = notificationOpen.notification;
              console.log("notification", notification);
          });
  
          /*
          * If your app is closed, you can check if it was opened by a notification being clicked / tapped / opened as follows:
          * */
          const notificationOpen = await Firebase.notifications().getInitialNotification();
          if (notificationOpen) {
              const { title, body } = notificationOpen.notification;
              console.log("notification", notification);
          }
          /*
          * Triggered for data only payload in foreground
          * */
          FirebaseService.messageListener = Firebase.messaging().onMessage((message) =&gt; {
              //process data message
              console.log("message", JSON.stringify(message));
          });
  
          console.log("Notification listeners created.");
      }       
  }
  </code></pre>