yarn add expo-notifee-plugin
npm install --save expo-notifee-plugin
- Add it to your pluginsin yourapp.jsonfile:
{
  "expo": {
    "plugins": [
      [
        "expo-notifee-plugin",
        {
          "developmentTeam": "MYDEVTEAMID"
        }
      ]
    ]
  }
}- Run npx expo prebuild -p ios
- Run yarn ios
If you use app.config.ts for example:
import { ExpoConfig } from 'expo/config';
import { TExpoNotifeeRemote } from 'expo-notifee-plugin';
const notifeeOptions: TExpoNotifeeRemote = {
  /**
   * Apple App Groups. If none specified, it will create one: `group.${bundleIdentifier}`.
   * @example appGroups: ['com.app.company']
   * @link https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_application-groups
   */
  appGroups: string[];
  /**
   * @description
   * Use a custom relative (from project root) path for the NotifeeNotificationService.
   * - You can adapt `expo-notifee-plugin/ios/NotifeeNotificationService.swift`
   * - Warning! It should be named `NotifeeNotificationService`! Doesn't matter if you use
   * Swift or Objective-C!
   *
   * @examples
   * - src/notifications/NotifeeNotificationService.swift
   * - src/notifications/NotifeeNotificationService.m
   */
  customNotificationServicePath?: string;
  developmentTeam: string;
  /**
   * An array containing the sound file names (including file extensions)
   * @example soundFiles: ['dm.aiff']
   * */
  soundFiles?: string[];
  /** Path of the folder that contains the sound. Relative to the app.config.js file.
   * @example soundFilesPath: 'assets/audio'
   */
  soundFilesPath?: string;
};
export const plugins: ExpoConfig['plugins'] = [
  'expo-localization',
  ['expo-screen-orientation', { initialOrientation: 'PORTRAIT_UP' }],
  '@react-native-firebase/app',
  ['expo-notifee-plugin', notifeeOptions],
];Example with Firebase Node SDK:
import type {Notification} from '@notifee/react-native/src/types/Notification';
import {AndroidImportance} from '@notifee/react-native/src/types/NotificationAndroid';
import {MulticastMessage} from 'firebase-admin/lib/messaging/messaging-api';
import admin from '../src/firebase-admin';
/**
 * @link https://notifee.app/react-native/reference/notification
 */
const notifeeOptions: Notification = {
  title: 'Title',
  subtitle: 'Subtitle',
  body: 'Main body content of the notification',
  android: {
    channelId: 'default',
    importance: AndroidImportance.HIGH,
    lightUpScreen: true,
    pressAction: {
      id: 'default',
    },
    sound: 'default',
  },
  ios: {
    sound: 'default',
    // Adding `foregroundPresentationOptions` controls how to
    // behave when app is UP AND RUNNING, not terminated,
    // AND not in background!
    foregroundPresentationOptions: {
      badge: true,
      banner: true,
      list: true,
      sound: true,
    },
  },
};
/** 
 * @description Firebase Message
 * @link https://firebase.google.com/docs/reference/admin/node/firebase-admin.messaging.basemessage.md#basemessage_interface
 */
const message: MulticastMessage = {
  // β
 We can continue using local/data-only notification for Android
  // π while triggering iOS remote notifications from `apns`
  data: {notifee_options: JSON.stringify(notifeeOptions)},
  tokens: [],
  android: {
    priority: 'high', // Needed to trigger data-only notifications
  },
  apns: {
    payload: {
      notifee_options: notifeeOptions,
      aps: {
        alert: {
          // π§ This is needed to trigger an alert/remote notification only for iOS
          // π but Android will continue using data-only notifications
          title: 'ANY_DUMMY_STRING',
        },
        mutableContent: true,
      },
    },
  },
};
try {
  admin.messaging().sendEachForMulticast(message)
  res.status(200).end();
} catch (e) {
  res.status(400).end();
}This plugin handles moving the necessary NotifeeNSE files into their respective iOS directories.
- Updates entitlements
- Sets the app group to group.<identifier>if applicable
- Adds the extension plist
- Adds the view controller
- Adds the NotifeeCore pod in Podfile
- Adds the sounds (if any) in the iOS project
- Updates the xcode project's build phases
- Notifee issues: invertase/notifee#1118
π This project is released under the MIT License.
π» By contributing, you agree that your contributions will be licensed under its MIT License.
Adapted from:
- 
https://github.com/OneSignal/onesignal-expo-plugin/blob/main/onesignal/withOneSignalIos.ts 
- 
https://github.com/bluesky-social/social-app/tree/main/plugins/notificationsExtension 
- 
https://github.com/andrew-levy/react-native-safari-extension 
|  |