Skip to main content

Overview

useNotificationPreferences reads and updates the signed-in user’s push notification preferences — the set of event types they’ve disabled for push. Use it to build a notification-settings screen with a per-type toggle. Disabling a type suppresses push only — the in-app notification is still written, so the bell/inbox is unaffected. A user with no preferences is all-on (disabledTypes is []).
Requires an authenticated user and the push bundle installed on the project.
Not the same as useAccountPushToggle. This hook controls which event types the signed-in user receives. That one controls whether an account is bound to this device at all — and works on any stored account, not just the active one. An account silenced there receives nothing on that device regardless of what is set here, and these preferences are left untouched, applying again as soon as it is turned back on.

Usage Example

Returns

The hook returns an object:
PushEventType[] | undefined
The event types the user has disabled for push. undefined until the read resolves; [] when nothing is disabled (all-on).
boolean
true while the initial read is in flight.
boolean
true while an update is in flight.
unknown
The read error, if any.
() => void
Re-fetch the preferences.
(disabledTypes: PushEventType[]) => Promise<void>
Replace the disabled-types set (upsert). Pass the complete set you want stored, not a delta. Only valid event type names are accepted; unknown names are rejected server-side.

Notes

  • Available on @sublay/react-js, @sublay/react-native, and @sublay/expo (inherited from @sublay/core).
  • The full list of valid type names is exported as PUSH_EVENT_TYPES. See the event palette.
  • For per-conversation muting, see useMuteConversation.