-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Replace deprecated local notification methods on iOS #1751
Replace deprecated local notification methods on iOS #1751
Conversation
docs: use package import
[other] Reduce npm package size
…Notification from react-native-push-notification-ios/push-notification-ios; alertAction has been deprecated as of iOS 10
…ests on iOS; swap getScheduledLocalNotifications for getPendingNotificationRequests on iOS
Hi @nbolender Thanks for this PR ! |
This is now ready for review; Requires @react-native-community/push-notification-ios@^1.7.4 |
index.js
Outdated
soundName: soundName, | ||
category: details.category, | ||
userInfo: details.userInfo, | ||
repeatInterval: details.repeatType, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parameter doesn't exist in the iOS library, it's repeats
now but it's not the same thing 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to repeats
, and updated the documentation to state that 'day' is the only available option for repeatType
on iOS. This would be another breaking change.
It is possible for the iOS library to specify other repeat intervals, but as explained here it is not as straightforward. For example, I could not set a fire date of 8 days from now and a weekly repeat; it would instead start firing 1 day from now.
… repeatType only supports 'day' on iOS
Will wait for an answer for this issue, there is no way to cancel a notification request by the id: Nice work, this is working great ! |
Hi, Just an error in the exemple code to take care. |
I've made this change, but also noted the documentation for I'm just not sure of the behavior on the Android side. |
I will dig into it this week-end 😉 |
Thanks for allo these changes ! Will look to another PR for Android and release a new version ASAP |
As of push-notification-ios@v1.7.0, these iOS methods are deprecated:
This PR replaces those methods appropriately on iOS without changing the API of react-native-push-notification.
This fixes #1716
2 Breaking Changes
alertAction is deprecated as of iOS 10 and is not available in the new addNotificationRequest method.
It should also be noted that push-notification-ios@v1.4.1 had an unmentioned breaking change, requiring users to update their AppDelegate to use UNUserNotificationCenter and to stop using
application:didReceiveLocalNotification:
to receive notifications (this caused undefined notification details similar to #1488). I opened an issue over there to hopefully update their documentation.These changes will require the same update, so it should be mentioned as a breaking change (though this has been true since 8/18/2020)
Depends on update to push-notification-ios
This depends on react-native-push-notification/ios#237 so I have this marked as draft for now.