Local Notifications register once per file save

I’ve just started playing with LocalNotifications, and I have an annoying bug. Whenever I use LocalNotify.now or LocalNotify.later, the callback is called as mnay times as I saved the project (without rebuilding). So it can quickly add up, and the way around it is to rebuild the project, which slows down the iteration cycle quite a bit.

The example straight from the doc should be enough to reproduce. I haven’t tested on device, but it’s the behaviour I get from the iOS simulator on Mac OS.

Well are you calling LocalNotify.now() and LocalNotify.later() everytime onload meaning in your js its literally just:

...
LocalNotify.now();
...

Then of course it’ll be called all the time, for testing you might want to tie it a button click:

module.exports = {
 notifyNow: function() {
   LocalNotify.now();
 }
}

<Button Clicked="{notifyNow} Text="Notify" />

No I’m literally using the example from the docs, and it’s tied to a button there (more or less exactly like you wrote it).

Say I save once, click the button, and log a string, I’ll get the logged string once.

Say I now edit the string, save again, and click the button, I’ll get the new string, logged twice.

The new string logged twice? or two logs one old, and one new?

Plus its the way js is reloaded, try doing a save in ux instead. I forget how the js reloading works, but if that doesn’t happen when you save on ux then you know its the way js reloads, so someone who knows will be able to explain.

The new one, twice. See attached video: https://fuseweb.azureedge.net/forum-user-uploads/2016/08/22/MpZUyYLpJdvt-legacy-files-OmZP1werIH1ROEdq-_WGnKcV-oC8xQVvSGIm1CZG3.mov

Seems like a bug, hopefully someone can figure it out

Hey folks,

This defintely sounds like a bug. I’ve raised an issue for it internally and will get back to you here when I have some details.

Sorry this one has bitten you and thanks for reporting!

Sorry we forgot to close this when it was fixed