import { useNotifications } from "stream-chat-react-native";
const notifications = useNotifications({
filter: (n) => n.severity === "error",
});useNotifications
useNotifications returns a live list from the client notification store. It re-renders the consumer when notifications are added, removed, or updated, and can optionally filter to an exact notification target.
Usage
By default (no target and no requireTarget: true), the hook returns every notification in the store. This is useful for global analytics or debug views. Pass an exact target to scope to a specific channel, thread, channel list, or thread list. This hook does not infer NotificationTargetProvider context on its own; use useNotificationTargetContext or useResolvedNotificationTarget when you need the surrounding target.
Options
| Option | Type | Description |
|---|---|---|
filter | (notification: Notification) => boolean | Predicate run after target filtering. Returns the notifications you want to read. |
requireTarget | boolean | When true, return an empty array if no target is provided. Used by NotificationList to guarantee panel-scoped reads even when the call site has no context. |
target | { hostId: string; panel: NotificationTargetPanel } | Restrict results to notifications tagged for this exact target. Use useResolvedNotificationTarget to derive one from context. |
Returns
Notification[]: a stable reference that changes when the matching notifications change. See the Notification type in stream-chat for the full shape.
Related
useSystemNotificationsreads only notifications taggedsystem.useNotificationListControllerwrapsuseNotificationswith snackbar selection + timeout logic.