Expo notifications help - local notifications scheduled.


I have been working on a react native app (first time building an app) and I am trying to add notifications for it. Part of the app requires users to take pictures and I would like to add a feature that reminds the user to take a new picture every 30 days. I have tried the code presented in the expo notifications guide, both the code that uses the expo server as well as the code right at the start of the docs that uses scheduleNotificationsAsync. Whilst the code that uses the server works, I am struggling to understand how to add the feature that schedules it to trigger in 30 days time. I also am not able to create a server due to limited resources. When I use the code with scheduleNotificationsAsync I then get these memory leak errors which I have not been able to fix.

Any guidance would be much appreciated, thank you.

Can you explain a little more on what’s not working with scheduleNotificationAsync? You should be able to use YearlyTriggerInputs for this case: https://docs.expo.io/versions/v40.0.0/sdk/notifications/#yearlytriggerinput

Hello, I have used the example code from the expo notifications documentation and I have found that sometimes, if I press the schedule notification button multiple times and then go about other parts of the app I get a warning. The warning says that it can’t perform a React state update on an unmounted component. I currently have the timer set to two seconds just for testing this warning. This error has only come about since I have added to notifications code.

The warning says that it can’t perform a React state update on an unmounted component.

This warning is due to React code, not the expo-notifications module. Are you using exactly the example from the docs?

Yes, I’m using the example given in the docs. The warning occurs sporadically but does seem to consistently happen if the schedule notification button is pressed a few times in a row on iOS.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.