Skip to content

fix: duplicate foreground notification on iOS#7391

Merged
olerass merged 2 commits intodevelopfrom
@ole/fcm-foreground-banner-fix
Apr 27, 2026
Merged

fix: duplicate foreground notification on iOS#7391
olerass merged 2 commits intodevelopfrom
@ole/fcm-foreground-banner-fix

Conversation

@olerass
Copy link
Copy Markdown
Contributor

@olerass olerass commented Apr 27, 2026

After bumping @react-native-firebase/* from 20.1.0 to 23.8.8 in #7319 (Apr 2026), iOS users see both a system banner AND a notifee-displayed local notification when a push arrives while the app is foregrounded. Pre-bump behavior was the notifee notification only.

The cause is upstream: invertase/react-native-firebase#8786 (merged Feb 2026, shipped in v23.8.5) reordered RNFB's iOS willPresent delegate so the original AppDelegate handler is called first. Previously, RNFB consumed the one-shot completionHandler with its own default options (empty, since we don't have a firebase.json) before forwarding to AppDelegate, making AppDelegate's completionHandler([.sound, .badge, .list, .banner]) a no-op. With the new order, AppDelegate wins and iOS now honors the full [.sound, .badge, .list, .banner] set the handler has been quietly asking for since #6607 (Aug 2025).

This change updates AppDelegate's willPresent to call completionHandler([]), which suppresses all iOS-side presentation for the FCM remote when foregrounded. Rainbow's user-visible foreground notification UI is rendered by notifee from the separate onMessage JS handler (src/notifications/foregroundHandler.tsnotifee.displayNotification). Letting iOS also present the FCM payload would duplicate Notification Center entries and add badge increments that pre-bump prod never had. Returning [] matches the pre-RNFB-23.8.5 default of UNNotificationPresentationOptionNone. Background and killed-app notifications are unaffected since this delegate only runs in the foreground case.

@olerass olerass requested a review from janicduplessis April 27, 2026 12:28
@olerass olerass changed the title fix(notifications): duplicate foreground notification on iOS fix: duplicate foreground notification on iOS Apr 27, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2026

🧪 Flashlight Performance Report (AWS Device Farm)

🔀 Commit: 551a1fc

📎 View Artifacts

Metric Current Δ vs Baseline
Time to Interactive (TTI) 5516 ms ⚪ -10.4 ms (-0.2%)
Average FPS 56.78 ⚪ -0.0 (-0.1%)
Average RAM 386.9 MB ⚪ +3.3 MB (+0.9%)

@github-actions
Copy link
Copy Markdown

Launch in simulator or device for dc33dd4

Copy link
Copy Markdown
Contributor

@janicduplessis janicduplessis left a comment

Choose a reason for hiding this comment

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

Should we return [] instead of badge + list so it matches what we had before? It seems to be the default in the firebase library, unless we're passing messaging_ios_foreground_presentation_options?

@olerass
Copy link
Copy Markdown
Contributor Author

olerass commented Apr 27, 2026

Should we return [] instead of badge + list so it matches what we had before? It seems to be the default in the firebase library, unless we're passing messaging_ios_foreground_presentation_options?

Good catch. Pushed fix

@olerass olerass requested a review from janicduplessis April 27, 2026 21:28
@github-actions
Copy link
Copy Markdown

Launch in simulator or device for 551a1fc

Copy link
Copy Markdown
Contributor

@ibrahimtaveras00 ibrahimtaveras00 left a comment

Choose a reason for hiding this comment

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

Looks good, QA Passed 👍🏽

@olerass olerass merged commit f6c0313 into develop Apr 27, 2026
25 of 26 checks passed
@olerass olerass deleted the @ole/fcm-foreground-banner-fix branch April 27, 2026 22:25
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.

3 participants