Search code examples
react-nativepush-notificationapple-push-notificationsreact-native-push-notification

When do you use react-native-push-notification vs @react-native-community/push-notification-ios?


I'm reading the installation instructions for react-native-push-notification and it indicates that for iOS, you use @react-native-community/push-notification-ios. It seems as though you have to add both of these modules separately. However, I don't understand which to use in my actual code. Do you use var PushNotification = require("react-native-push-notification"); as it says in react-native-push-notification, or do you use import PushNotificationIOS from "@react-native-community/push-notification-ios"; from @react-native-community/push-notification-ios?


Solution

  • You do have to have both packages in your package.json but you do not need to use PushNotificationIOS for anything other than a finish handler as shown in the usage section here.

    Generally though, you would only need to use var PushNotification = require("react-native-push-notification") and call your handlers on that.