text: import React from 'react';
  import {AppRegistry} from 'react-native';
  import App from './App';
  import {name as appName} from './app.json';
  import messaging from '@react-native-firebase/messaging';
  
  // Register background handler
  // Must return a promise once your logic has completed
  // DO NOT update any UI
  // DO perform network requests, update local storage etc.
  messaging().setBackgroundMessageHandler(async remoteMessage => {
    console.log('Message handled in the background!', remoteMessage);
  });
  
  // HeadlessCheck for Ios to prevent useEffects etc. from running when starting the app in the background
  function HeadlessCheck({ isHeadless }) {
    if (isHeadless) {
      // App has been launched in the background by iOS, ignore
      return null;
    }
  
    return <App />;
  }
  
  AppRegistry.registerComponent(appName, () => HeadlessCheck);
  