Notifications Module
Quick Answer
The notifications module lives in src/core/notifications. It renders in-app notification lists and reads notification records from the active backend. It is separate from native push notification setup, but most production apps use both together.
Use the Push Notifications docs for APNs/FCM setup. Use this page when changing the notification UI or the data module that displays notifications inside the app.
Source Map
src/core/notifications
|-- IMNotificationScreen
|-- Notification
|-- firebase/notification.js
|-- redux
`-- index.js
Important pieces:
| File or folder | Purpose |
|---|---|
IMNotificationScreen | Full screen notification list. |
Notification/IMNotificationItem.js | Individual notification row UI. |
firebase/notification.js | Firebase notification read/write helper. |
redux | Notification state for apps that use Redux. |
index.js | Public module exports. |
Native Push vs In-App Notifications
There are two related layers:
| Layer | Purpose |
|---|---|
| Native push | APNs/FCM delivery to the device lock screen or notification center. |
| In-app notifications | App UI that lists notification records after the user opens the app. |
Native push can work even if the in-app notification list is empty, and the in-app list can show database records even if push delivery is not configured. Test both.
Firebase Requirements
For Firebase-backed apps:
- Firebase Messaging must be configured for push delivery.
- Firestore should store notification records if the app shows an in-app list.
- Rules should prevent users from reading another user's notification feed.
- Functions that create notifications should validate sender, recipient, and object IDs.
Verification Checklist
Test:
- notification list opens;
- empty state appears when there are no notifications;
- current user's notifications load;
- another user's notifications are not readable;
- tapping a notification navigates correctly if deep linking is supported;
- push arrives in foreground, background, and killed states;
- notification records do not grow without retention or cleanup strategy.
Troubleshooting
| Problem | Fix |
|---|---|
| Push arrives but list is empty | Check Firestore notification records and the in-app notification query. |
| List loads forever | Return an empty state on listener errors and inspect Firestore rules. |
| User sees another user's notifications | Tighten Firestore rules and query by authenticated user ID. |
| Tapping notification opens wrong screen | Check notification payload shape and navigation mapping. |
| Push does not arrive | Follow the platform-specific push notification guides. |