Handling foreground notifications

Handling notifications when the application is foregrounded is more complex, and requires us to add a listener that checks for new notifications and afterward, these notifications should be stored somewhere. Expo's Notifications API has a listener available that can help you to check for new notifications, while the notifications can be stored using Apollo by having a local state. This local state extends the data returned by the GraphQL server by adding any new notifications that were found by the listener.

When the notifications are stored in the local state, this data can be queried and shown in either a component or a screen in your application. Let's create a notifications screen that will display these ...

Get React Projects now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.