App not opening in react-native on click of notification

I am using React Native Notifee for displaying notifications and encountering an issue where the app does not open upon clicking a notification.

This problem occurs in two specific scenarios:

When the app is in the background.
When the app is in the quit state.
In both cases, the notification is successfully received. However, clicking on the notification causes it to simply disappear without launching the app.

This is my index.js code

 /**
 * @format
 */
import {AppRegistry} from 'react-native';
import 'react-native-get-random-values';
import 'react-native-url-polyfill/auto';

import {ReadableStream} from 'web-streams-polyfill';

import notifee, {AndroidImportance, AndroidStyle, EventType} from '@notifee/react-native';
import messaging from '@react-native-firebase/messaging';

import App from './App';
import {name as appName} from './app.json';

globalThis.ReadableStream = ReadableStream;
// Register background handler

const displayNotification = async remoteMessage => {
  
};

messaging().setBackgroundMessageHandler(async remoteMessage => {
  console.log('Message handled in the background! na', remoteMessage);
  displayNotification(remoteMessage);
});

notifee.onBackgroundEvent(async ({type, detail}) => {
  if (type === EventType.ACTION_PRESS) {
    console.log('Notification clicked in background new:', detail);
    global.notificationData = detail;
  }
});


messaging()
  .getInitialNotification()
  .then(remoteMessage => {
    if (remoteMessage) {
      console.log('Notification clicked in quit state:', remoteMessage);
      global.notificationData = remoteMessage.data;
    }
  });

AppRegistry.registerComponent(appName, () => App);

Now using global.notificationData, I am using this data for navigation to specific screen.