Skip to content

fix: emit messaging_notification_opened only for default notification action on iOS.#8945

Open
mtjkln wants to merge 4 commits intoinvertase:mainfrom
mtjkln:fix/messaging-ios-notification-default-action
Open

fix: emit messaging_notification_opened only for default notification action on iOS.#8945
mtjkln wants to merge 4 commits intoinvertase:mainfrom
mtjkln:fix/messaging-ios-notification-default-action

Conversation

@mtjkln
Copy link
Copy Markdown

@mtjkln mtjkln commented Mar 28, 2026

Description

🔥 Fix: emit messaging_notification_opened only for default notification action on iOS.

Summary

Ensure messaging_notification_opened is emitted only when the default notification action is triggered on iOS.

Previously the event could be emitted for all UNNotificationResponse actions, including custom notification actions.

This change restricts the event emission to UNNotificationDefaultActionIdentifier, ensuring onNotificationOpenedApp is invoked only when the user taps the notification body.


Why

When notifications include custom actions (e.g. Reply, Mark as Read), selecting those actions previously triggered messaging_notification_opened.

This caused onNotificationOpenedApp to fire and often resulted in unintended navigation or redirection in apps that rely on the default notification tap behavior for routing.

By emitting the event only for UNNotificationDefaultActionIdentifier, custom actions no longer trigger onNotificationOpenedApp, aligning the behavior with expected iOS notification interaction patterns.


Related issues

N/A


Release Summary

Fix iOS behavior where messaging_notification_opened could be emitted for custom notification actions. The event is now emitted only for the default notification tap.


Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
    • Other (macOS, web)
  • My change includes tests;
    • e2e tests added or updated in packages/**/e2e
    • jest tests added or updated in packages/**/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan

  1. Send a push notification via Firebase Cloud Messaging with custom actions (e.g. Reply).
  2. Tap the notification body → onNotificationOpenedApp is triggered.
  3. Tap a custom action → onNotificationOpenedApp is not triggered.
  4. Verified behavior on a physical iOS device.

Think react-native-firebase is great? Please consider supporting the project with any of the below:

mtjkln added 4 commits March 28, 2026 17:06
…lt notification action

Ensure messaging_notification_opened is emitted only when the
UNNotificationDefaultActionIdentifier is triggered. This prevents
onNotificationOpened from being invoked for custom notification actions.
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 28, 2026

@mtjkln is attempting to deploy a commit to the Invertase Team on Vercel.

A member of the Team first needs to authorize it.

@mtjkln mtjkln changed the title Fix: emit messaging_notification_opened only for default notification action on iOS. fix: emit messaging_notification_opened only for default notification action on iOS. Mar 28, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the iOS messaging implementation to ensure that the 'messaging_notification_opened' event is only triggered when a notification is opened via the default action identifier. I have no feedback to provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant