react-native-push-notification / ios

React Native Push Notification API for iOS.
MIT License
734 stars 282 forks source link

react native expo #333

Open saqlain455 opened 2 years ago

saqlain455 commented 2 years ago

Invariant Violation: Native module cannot be null. how I can solve this issue

akinncar commented 2 years ago

this package is not compatible with expo, try expo-notifications

berkaygurbuz commented 2 years ago

Clean your node modules and remove react-native-push-notification/ios package. You can eject your expo project to bare workflow using expo eject command. After that install package and follow guide.

charleschenster commented 10 months ago

You can actually have an expo managed build by doing the following

  1. In your app.json, edit your ios.infoPlist to include the following:
    {
    ...
    "ios": {
    "infoPlist": {
      ...
      "UIBackgroundModes": ["remote-notification", ...]
    }
    }
  2. Create a custom plugin to modify your AppDelegate.mm per the readme's instructions
  3. Create a custom base modifier to enable plugins to modify the AppDelegate.h. Then create another custom plugin to modify AppDelegate.h

This is a helpful article on how to create a custom plugin