postLocalNotification - fireDate ignored
In React Native 0.61.5 react-native-notifications 3.1.1
On android it doesn't matter what date i pass as fireDate, the notifications is fired immediately.
const someLocalNotification = Notifications.postLocalNotification({
fireDate: addSeconds(new Date(), 15),
body: 'Local notificiation!',
title: 'Local Notification Title',
});
You need to give it an ISO date string. This works for me:
const payload = {
body: details.message,
title: details.title,
sound: details.soundName,
userInfo: details.data,
};
if (details.fireDate) {
payload['fireDate'] = details.fireDate.toISOString();
}
Notifications.postLocalNotification(payload);
hey @songsterq
const date = new Date('Apr 30, 2022');
const fireDate = date.toISOString();
Notifications.postLocalNotification({
fireDate,
body: 'Local notificiation!',
title: 'Local Notification Title',
}, hash);
It also fires immediately.
I am also experiencing this problem
same here. notification fired immediately android "react-native": "0.61.5", "react-native-notifications": "^3.1.2",
looking at the source code for android, I dont think fireDate is implemented
Same problem. Any workaround?
+1
+1 Does it work on iOS?
@irondsd i manage to implement local scheduled notification using react-native-firebase 5 instead.
https://rnfirebase.io/docs/v5.x.x/notifications/scheduling-notifications
+1 Does it work on iOS?
Didnt test it myself, but seems like it does, only android has this issue
Any fix for this?
Same here
Ran into this yesterday. It looks like fireDate isn't even in the payload format, which also caused my Typescript compiler to complain. I'm switching to Promises anyway else I'd fix this.
lib/src/DTO/Notification.ts
If we look at the documentation: https://wix.github.io/react-native-notifications/docs/localNotifications
We can see that for postLocalNotification the fireDate attribute is only in the iOS section (small apple icon in the title)
So, I guess, it really isn't implemented for android yet
any update?
Hi! I have done it in a fork, but still have to merge in the oficial repo. Hope to do it this week.
glad to hear that!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Hello everyone! Any news on that? I'm not familiar with developing native modules, but I would love to help testing it, as I am currently developing an Android app and I have just found out (the hard way haha) that the lib does not support it yet..
btw I've updated the docs to show that scheduled notifications are not implemented on android yet. The bug being "unclear docs" is fixed. The bigger issue that this feature is not implemented yet, is not fixed though. That makes this issue a feature request instead of a bug report.
Any idea of when this will be implemented?