Open devinjameson opened 3 years ago
@johnschoeman see above for notification delivery issue.
Any ideas on this? Additionally, if the fireDate
is for the same day, the notification triggers once but does not repeat even if repeats
is set to true.
same issue :/
try using PushNotificationIOS.scheduleLocalNotification until its resolved
I wrote my own native module to get around this @solo29. You can find it here: https://github.com/johnschoeman/building-habits-rn/tree/master/src/notifications.
And the Swift implementation: https://github.com/johnschoeman/building-habits-rn/blob/master/ios/NotificationsManager.swift
facing a similar issue where the notification is only triggered when addNotificationRequest is called without fireDate field in it. any Date mentioned the notification is not triggered.
So I have just encountered this same issue. The other issue is that the notification never repeats on susbsequent days either. I am pretty sure I have found the cause. In RCTConvert+Notification.m there is logic that transforms the JSON config into Objective-C types. https://github.com/react-native-push-notification-ios/push-notification-ios/blob/9fa4ff7763c099ce04bd76f3cd2d7fdbd5e8ea13/ios/RCTConvert%2BNotification.m#L120-L125 To create the trigger for the notification it uses the UNCalendarNotificationTrigger class. If you read the documentation for this it's clear that the conversion used won't work. It sets the notification to run on a specific year + month + day + hour + minute + second. As such it will never run again. To make this run daily, the year, month, and day values need to be removed from the calendar definition. This is simmilar to cron logic in a way, except with this class you need to ommit a metric to make it a wild card. For instance if you wanted a notification to be sent at 8:30am on the 2nd of each month you would specify day = 2, hour = 8, minute = 30, and second = 0, but not the month or year.
I'm going to have a go at fixing this.
any update?
When using
addNotificationRequest
, if thefireDate
is not within the current day, the notification never triggers.