react-native-notifications: 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',
});
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 15
- Comments: 46 (4 by maintainers)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
You need to give it an ISO date string. This works for me:
I was reading this thread, and I hate seeing multiple forked of the project. for me the elegant way is to use
patchfile and usingpatch-packagemodule to apply the changes to node_modules. Eventually this library is going to implement this feature and we simply remove the patch file. I have created a patch file based on @JaioSkura implementation. simply create a folder in your root project callpatchesand createreact-native-notifications+3.3.4.patchfile under it. Then use the content of this gist. make sure to add"postinstall": "patch-package"to your package.json’s scripts object.what are we waiting to integrate it? it seems like a critical feature.
@JaioSkura, this is pretty exciting. I was unable to use react-native-notifications in my current project as I need local scheduled notifications. You mention that there is “something that is not passing the tests” that is holding back a merge. Can you elaborate at all or is it a mystery to you as well?
Feb 6 this issue was opened. It’s Dec 3 today. Let’s get this merged! (@alinz @irondsd @hannojg et al.)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
@JaioSkura, yes, it does correspond to the date I want it to be fired.
EDIT: I managed to fix this by passing the date in ms.
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.
Is this resoved? As I am still facing the same issue that local notifications fired immediately independent of fireDate. Have tried with ISO String and unix time-stamp too. But no luck. Platform is Android. I can still see in documentation that fireDate not supported in android.
Can i know is it merged?
HI, I have done it in this fork: https://github.com/JaioSkura/react-native-notifications You can use it if you want. I need some time to merge it in the oficial project because of the tests, there is something that is not passing the tests and I need some time to analize it. Anyway it is working, with no problems. If you want to use it , I think that you will have to build locally: -Navigate to the root folder of the library -yarn install -run build
If you have any problem let me know and I will try to help!
hey @songsterq
It also fires immediately.
Solution to this is using the more up-to-date package:
expo-notificationsstill experiencing this
Surely this can be merged in now, it appears as though it is working for the people who have tried it. This functionality is highly desired and it would be amazing to be able to use this library.
Hi! I have done it in a fork, but still have to merge in the oficial repo. Hope to do it this week.