Interface: Notification

Defined in: packages/react-native/src/types/Notification.ts:22

Interface for building a local notification for both Android & iOS devices.

To learn more about displaying a notification, view the Displaying a Notification documentation.

Properties

android?

optional android?: NotificationAndroid

Defined in: packages/react-native/src/types/Notification.ts:93

Android specific notification options. See the NotificationAndroid interface for more information and default options which are applied to a notification.

Platform

android

body?

optional body?: string

Defined in: packages/react-native/src/types/Notification.ts:46

The main body content of a notification.

data?

optional data?: object

Defined in: packages/react-native/src/types/Notification.ts:85

Additional data to associate with the notification.

On Android, when populated by getDisplayedNotifications(), the data field reflects custom keys present in the underlying Notification.extras, with the following keys filtered out: prefixes android., google., gcm., fcm. (with trailing dot — fcmRegion survives), and notifee (no trailing dot — library's reserved namespace, notifeeFoo is also filtered), plus exact keys from, collapse_key, message_type, message_id, aps, fcm_options.

Important FCM platform limitation on Android: when the FCM Android SDK auto-displays a notification+data push while the app is in background or killed, custom data fields are placed only on the tap-action PendingIntent and never on Notification.extras. This is FCM's design (see CommonNotificationBuilder.createContentIntent in the firebase-android-sdk source) and cannot be worked around from any library — the PendingIntent's extras are sealed by Android's security model. Tracked in firebase-android-sdk#2639 (open since 2021).

The data field DOES surface custom keys for: notifications created via notifee.displayNotification({ data }), FCM data-only messages handled in onMessageReceived followed by an explicit displayNotification(), custom FirebaseMessagingService.handleIntent overrides that inject extras before display, and notifications posted by other libraries that call NotificationCompat.Builder.addExtras(bundle).

Recommended pattern for full control over FCM push notifications on Android: send FCM data-only messages (no notification field server-side), handle them in onMessageReceived, and render the notification via notifee.displayNotification().

Note: the fcm filter diverges from iOS, which uses a broader bare-fcm* prefix filter (deliberately, to catch fcm_options). On Android, only fcm. (with dot) and the exact key fcm_options are filtered — custom keys like fcmRegion are preserved on Android but filtered on iOS.

Index Signature

[key: string]: string | number | object

id?

optional id?: string

Defined in: packages/react-native/src/types/Notification.ts:31

A unique identifier for your notification.

Notifications with the same ID will be created as the same instance, allowing you to update a notification which already exists on the device.

Defaults to a random string if not provided.

ios?

optional ios?: NotificationIOS

Defined in: packages/react-native/src/types/Notification.ts:101

iOS specific notification options. See the NotificationIOS interface for more information and default options which are applied to a notification.

Platform

ios

remote?

readonly optional remote?: object

Defined in: packages/react-native/src/types/Notification.ts:108

Will be populated if it's a remote notification

contentAvailable?

optional contentAvailable?: number

messageId

messageId: string

mutableContent?

optional mutableContent?: number

senderId

senderId: string

Platform

ios

subtitle?

optional subtitle?: string

Defined in: packages/react-native/src/types/Notification.ts:41

The notification subtitle, which appears on a new line below/next the title.

title?

optional title?: string

Defined in: packages/react-native/src/types/Notification.ts:36

The notification title which appears above the body text.