docs(rn): React Native push notification guides for @cometchat/push-notifications-react-native (Android + iOS) - #486
suraj-chauhan-cometchat wants to merge 18 commits into
Conversation
Replace the split android/ios RN push guides with one unified notifications/react-native-push-notifications.mdx documenting the JS-first @cometchat/push-notifications-react-native package (FCM + APNs/VoIP, CallKit/lock-screen call UI, killed-state handling). Mirrors the Flutter restructure (#440): - delete react-native-push-notifications-{android,ios}.mdx - docs.json: collapse the two nav entries into one; redirect the old split paths (and /extensions/... ) to the unified page - repoint cross-links in notifications.mdx, push-overview.mdx, calls/v4/react-native/overview.mdx, and the SDK html-stripping guide Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
The push-getting-started page is introduced by the still-open Flutter PR #440; until it merges, link the shared setup prerequisite to the existing notifications/push-overview page so the RN guide has no dead links on main. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Matches the convention used across the React Native UI Kit pages: a machine-readable Field/Value table in an accordion directly after the frontmatter, so agents and skills can generate correct typed code without inferring the API from prose. Covers the surface the narrative guide left implicit: exported type names and their union values, the full PNConfiguration defaults, the complete PNCallInfo / PNNotificationTapInfo / PNCallEndEvent field lists, dispose(), isCometChatNotification(), the cold-start replay behaviour, and the Android permission set. Generated from the package type definitions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…isterPushOnLogout Android and iOS both document this as a dedicated numbered step titled 'Unregister the token on logout'. The RN guide had it buried inside the token-registration step under an invented name (teardownPush), so align it: own section 5, house-style name, remaining sections renumbered and the troubleshooting cross-reference updated. Keeps the unsubscribe step (which the other platforms don't need) and now says why: the package holds callbacks in a set that survives unregister(), so skipping it double-fires handlers after a re-login. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pairs with unregisterPushOnLogout, so both names state when to call them. Matches the reference app, which uses the same two names. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The reference still said 'Teardown' and named neither function, so it disagreed with the 'Unregister the token on logout' section and the reference app. Name setupPushOnLogin / unregisterPushOnLogout in the Initialize and logout rows so an agent reading only the accordion generates the same names the guide and sample app use. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ixes from QA Bring the React Native push guide in line with what was verified on device during ENG-38228 QA. - init sample: showInForeground: true (one chat notification while the app is open) and notificationSmallIcon (otherwise Android shows a solid square). - Correct what showInForeground does: it gates chat notifications only. The troubleshooting row claimed it prevents foreground calls showing twice; the package suppresses CallKit / the system ring in the foreground on its own. - Notification taps: when a tap launches a killed app it arrives before NavigationContainer mounts, so the example now waits for navigationRef isReady() / the 'ready' event before navigating. - Troubleshooting: duplicate chat notifications (a leftover RNFirebase receiver), no foreground notification, cold-start tap not opening the chat. - Fix two references to the OEM section that still said 6 after renumbering. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Match what shipped and what QA found on a fresh install. - setupPushOnLogin() now returns its cleanup, wired to a useEffect keyed on the logged-in state, replacing the module-level `subscriptions` array and unregisterPushOnLogout(). Handlers subscribe before init() so a tap that launched the app is delivered. - Document that every permission request must be awaited before the next one: Android allows one pending request per activity, and a second request cancels the open dialog and is reported as denied without the user seeing it. On a fresh install that silently left the app with no notification permission. - Document that requestNotificationPermission() rejects (ERR_NO_ACTIVITY, ERR_PERMISSION_IN_FLIGHT, ERR_ACTIVITY_NOT_PERMISSION_AWARE) when it could not ask at all — distinct from the user declining, and not a reason to skip init(). - Spell out that unregister() must precede logout() because it needs the session's auth token, and that swallowing its error leaves the device on push. - Two troubleshooting rows: fresh-install-only failures, and push after logout. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two modify/delete conflicts: this branch replaces the split React Native guides with one unified page, while main edited both old pages since (c17fd96, ffc2172, c3f27ec) — adding an optional `parentId` to the payload example and switching the fence to `jsonc`. Resolved by keeping both deleted. Nothing is lost: the unified guide documents the same field as `parentMessageId` on PNNotificationTapInfo ("present for thread replies") with full thread deep-link handling — the package maps the raw `parentId` onto it, so readers never handle the raw field — and it has no raw JSON payload block for the fence change to apply to. Redirects for both old URLs remain. Verified after the merge: docs.json parses, every nav page resolves to a file (0 missing, same as main), no duplicate redirect sources, and nothing links to the deleted pages. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…uide Checked every claim against the package source; two were wrong. iOS — the guide told apps to hand-write a PKPushRegistry and the four delegate methods in AppDelegate, AFTER adding the setup CLI's generated file to the target. That file already owns the registry (on a background queue) and forwards all four events. Doing both is a compile error (didRegisterForRemoteNotifications… defined twice) or two registries, which double-delivers every VoIP push. And the one line an app actually needs, `CometChatVoIP.shared.register()`, was never mentioned. Replaced with that line, a warning against a second registry and on clashing with existing delegate methods, and a note for Objective-C AppDelegates. Android — the guide told apps to add firebase-bom + firebase-messaging. The package already depends on both; only the google-services plugin is needed. Updated the quick reference, the section 6 cold-start warning and four troubleshooting rows that repeated those instructions or the old logout helper. Structure, against Flutter's unified guide (#440): - Badge: add the dashboard step that enables unreadMessageCount, and order tabs Android → iOS like every other tab group. - Testing: add a fresh-install check (Flutter has a reinstall item) and a logout check. Sections 3 and 4 keep a single code path rather than Flutter's per-platform tabs: Flutter's init and token registration genuinely differ per platform, while this package's are one identical JS call on both. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The package no longer ships `npx cometchat-pn`. Like the Flutter, Android and iOS guides, the iOS tab now walks through the native setup itself: 1. Podfile platform 14.0 2. Push Notifications + Background Modes (Voice over IP, Remote notifications, Audio) 3. Microphone and camera usage strings in Info.plist 4. The full AppDelegate: one PKPushRegistry on a background queue, forwarding the APNs token, remote notifications, the VoIP token and incoming VoIP pushes to CometChatPushNotificationsAppDelegate The AppDelegate mirrors the one in the sample app QA signed off on — which never used the CLI — minus its Firebase setup, which the package's iOS side does not use. Also removes the CLI row from the quick reference and rewrites the rows, the cold-start warning and three troubleshooting entries that pointed at the CLI, the generated file or `doctor`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ste ready The guide's code is now the sample app's implementation, as complete files that type-check in a strict React Native + UI Kit project: - src/AppCredentials.ts, src/navigation/navigationRef.ts (waits for the navigator), src/push/pushNotifications.ts (setupPushOnLogin + usePushOnLogin), src/push/logout.ts, and the App.tsx / index.js wiring - tap handling opens the thread with the user/group, marks the conversation read; call-ended tears the call down and leaves the call screen - push follows a fresh login and a restored session, and cleans up on logout Setup corrections found by following the guide on a clean app: - keep the Podfile's min_ios_version_supported; lowering it breaks the build - full Swift AppDelegate with the PushKit registry created before React Native starts - add the ic_notification drawable; registerBackgroundCallTask() now needs no handler - MANAGE_OWN_CALLS listed (Android 14+ ringing screen); PNBackgroundCallOptions exported - the forwarding API is Swift-only, so Objective-C AppDelegates must move to Swift - testing and troubleshooting cover fresh installs, killed-app decline, the Android 14+ ringing screen and logout Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The package now rings with CallKit / the Android ringing screen even while the app is open (ringInForeground, default true). The guide's code sets it to false, because the UI Kit shows its own incoming-call screen; the config reference, the init notes and the troubleshooting row explain both settings. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The iOS AppDelegate no longer creates a PKPushRegistry or forwards PushKit callbacks. It calls CometChatPushNotificationsAppDelegate.registerForVoIPPushes() before React Native starts and forwards the APNs token. The quick reference, the AppDelegate example, the PushKit warning (with the forwarding option for apps whose registry belongs to another library), the killed-app note and the troubleshooting row are updated. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…matching Flutter The React Native guide is back to two pages — react-native-push-notifications-android and -ios, the URLs already live — and each follows its Flutter counterpart section for section: dashboard providers, platform credentials, local configuration, bringing in the package, the native layer, token registration and runtime events, badge count, testing and troubleshooting. The content is the push package's: installing it replaces Flutter's copied notification stack, and the native steps shrink to Gradle and a notification icon on Android and a few AppDelegate lines on iOS. Navigation, redirects and the React Native links in notifications.mdx, push-overview, the React Native calls overview and the HTML-stripping page are back to their main versions. Every code block comes from files compiled against a strict React Native + UI Kit project. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
jitvarpatil
left a comment
There was a problem hiding this comment.
Review: React Native push notification guides (Android + iOS)
Requesting changes / hold. The guides are well written and the API calls match the master-app integration, but they document a package customers can't install yet, and they overwrite the two live RN push pages that document the setup the public sample app uses today.
🔴 Blockers
1. @cometchat/push-notifications-react-native isn't published
npm view @cometchat/push-notifications-react-native returns 404 — the package isn't on npm under any version. The only consumer is the UI Kit master app on feat/push-notifications-js-first (cometchat-team/uikit-react-native#1439, still open, base dev-v5), which pins ^0.1.0 with no lockfile or .npmrc showing where that resolves from. Step 3.1 / 4.1 (npm install …) fails for every reader, and nothing after it works.
2. Both pages overwrite the live guides rather than adding new ones
After fb684825 split the guide back into react-native-push-notifications-android.mdx and -ios.mdx — the URLs that are live now — merging replaces today's working setup (Firebase Messaging + Notifee + CallKeep + react-native-voip-push-notification) with instructions for a package that doesn't exist. Customers already on the current stack lose their docs with no fallback. Please either hold until the package ships, or keep the current guide at a legacy URL (the existing /notifications/react-native-push-notifications-legacy redirect already allows for this).
3. The linked sample app contradicts the guide
Both pages link cometchat-uikit-react-native/tree/v5/examples/SampleAppWithPushNotifications as the reference implementation. On v5 that app depends on @notifee/react-native, react-native-callkeep, react-native-voip-push-notification and @react-native-firebase/messaging — the exact libraries the guide's Warning says to remove so notifications and calls don't arrive twice — and doesn't use the new package at all. Point the Card at the migrated sample once #1439 is merged and mirrored to the public repo.
🟠 Should fix
-
Stale PR title and description. They describe a single unified
react-native-push-notifications.mdx, deleting the Android/iOS pair,docs.jsonnav + redirect changes, cross-link repoints in four files, andnpx cometchat-pn setup. The current diff has none of that: 2 files, nodocs.jsonchange, and the setup CLI was removed in5345d0bd. Please update both so reviewers and the merge history aren't misled. -
Android-only content copied into the iOS page:
- the permission comment says "Android allows only one pending request per activity";
init()passesnotificationSmallIcon: 'ic_notification' // Android status-bar icon (step 2)— step 2 on the iOS page is Apple credentials;registerBackgroundCallTask()is shown inindex.jsalthough it's a documented no-op on iOS.
Fine if the code is intentionally shared across platforms, but say so explicitly.
-
Payload type mismatch. The iOS example shows
"unreadMessageCount": 5(number); the Android page says it's a string ("5"). Please confirm against the backend payload for each platform. -
Firebase on iOS. The guide says "No Firebase is needed on iOS" and lists
@react-native-firebase/messagingfor removal, but the master app'sios/masterapp/AppDelegate.swiftstill hasimport Firebase. Worth resolving before that app becomes the reference.
✅ Consistent with the master app (feat/push-notifications-js-first @ 0fc4b83a)
CometChatPushNotifications.init / onNotificationTap / onCallAccepted / onCallEnded / unregisterandCometChatPNHelper.requestNotificationPermission / requestCallPermissions.init()options:fcmProviderId,apnsProviderId,notificationSmallIcon,showInForeground: true,ringInForeground: false.- iOS:
import react_native_cometchat_push_notifications, andCometChatPushNotificationsAppDelegate.registerForVoIPPushes()(before React Native starts) /didRegisterAPNsToken/didReceiveRemoteNotification. - No URL or nav changes, so no redirects are needed.
Not verifiable yet: the package source isn't in any repo I could reach, so these are unchecked beyond the master app's usage — the init() defaults (voip, ringInForeground: true), the ERR_* rejection codes, the 5 × 3 s retry, the 45-second ring timeout, the merged-manifest permission list, and the CometChatFcmService.handleMessage / handleNewToken names. Please re-verify these against the package once it's published.
…payload types - Both pages say the JavaScript files are shared by Android and iOS, and which lines apply only on Android (registerBackgroundCallTask, notificationSmallIcon, waiting between permission requests). - The init() comment no longer points notificationSmallIcon at "step 2", which is the credentials step on both pages. - The iOS payload example shows unreadMessageCount as a string, like CometChat's native iOS APNs guide, and both pages note that the package hands payload values to JavaScript as strings. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Customers on the current setup (Firebase Messaging + Notifee + CallKeep + react-native-voip-push-notification) keep their docs when the new guides go live: - react-native-push-notifications-android-legacy and -ios-legacy carry today's live pages unchanged, apart from a banner pointing to the new guide and cross-links that stay within the legacy pair. They are not added to the navigation. - The new Android and iOS pages link to their legacy guide. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Thanks for the review — the should-fix items are in 6ebe8f6, and the legacy guides are in 69292a2. The blockers depend on the release, so this PR stays unmerged until the package is published. 🔴 Blockers (resolved by the release)
🟠 Should fix
Where the unverified claims live in the package (PR #1)
|
… guides The docs keep no legacy push guides in the repo: dfce1bb deleted them all (including the earlier react-native-push-notifications-legacy and flutter-push-notifications pages) in favour of redirects to the legacy archive on assets.cometchat.io, and the Flutter guides have since been rewritten in place. The React Native guides now do the same — the two pages are updated in place, and /notifications/react-native-push-notifications-legacy already redirects to the archive. Removes react-native-push-notifications-android-legacy.mdx and -ios-legacy.mdx, and the notes linking to them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Update on blocker 2: to match the Flutter guides, the legacy page copies are removed again (8c1480c). The docs keep no legacy push guides in the repo: dfce1bb deleted them all — including the earlier |
Re-check: release-gated onlyThanks for the updates. The should-fix items from the first review are resolved ( Leaving Changes requested in place only for the release gates:
✅ Previously unverified claims — now verified against the package (
|
| Claim | Source |
|---|---|
init() defaults voip: true, showInForeground: false, ringInForeground: true |
src/models/PNConfiguration.ts:21-32 |
| Token retry 5 × 3 s | src/constants.ts:62-64 |
| 45 s ring timeout | CometChatPushConstants.kt:90 |
ERR_NO_ACTIVITY, ERR_PERMISSION_IN_FLIGHT, ERR_ACTIVITY_NOT_PERMISSION_AWARE |
CometChatPushConstants.kt:132-134 |
CometChatFcmService.handleMessage / handleNewToken (@JvmStatic) |
CometChatFcmService.kt:39-53 |
| Merged-manifest permissions and components | android/src/main/AndroidManifest.xml — all 10 permissions match |
registerToken('fcm' | 'apns' | 'voip') |
PNTokenPlatform in src/models/events.ts |
registerBackgroundCallTask(handler, { rejectDeclinedCalls }) |
src/registerBackgroundCallTask.ts |
unreadMessageCount delivered as a string |
onMessageReceived(cb: (data: Record<string, string>) => void) |
iOS registerForVoIPPushes / didRegisterAPNsToken / didReceiveRemoteNotification / didUpdateVoIPToken / didReceiveIncomingVoIPPush |
ios/CometChatPushNotificationsBridge.swift:647-663 (public static, no @objc — so the "Swift-only" note is correct) |
import react_native_cometchat_push_notifications |
podspec s.name |
Notes
- Legacy content: the archive behind the
-legacyredirect is the January 2026 single RN page, not today's Android/iOS guides, so customers on the current Firebase/Notifee/CallKeep stack lose the newer version of those instructions once this merges. Fine if that's the intended trade-off, as with Flutter; otherwise consider adding the two current pages toassets.cometchat.io/legacy-docsbefore merging. - Nit:
ERR_PN_CONFIGURE(CometChatPushConstants.kt:131) isn't in the rejection-code table — worth adding ifinit()can surface it to JavaScript.
Once the package is on npm and #1439 is merged, I'll confirm the published version and the sample-app card link, and approve.
What
Rewrites the React Native push notification guides for the new
@cometchat/push-notifications-react-nativepackage, on the two existing pages and URLs:notifications/react-native-push-notifications-androidnotifications/react-native-push-notifications-iosEach page follows its Flutter counterpart section for section: dashboard providers → platform credentials → local configuration → bring in the package → native layer → token registration and runtime events → badge count → testing → troubleshooting. Installing the package replaces the copied notification stack; the native steps shrink to Gradle and a notification icon on Android and a few AppDelegate lines on iOS.
Like the Flutter guides, no legacy copies are kept in the repo: the pages are rewritten in place, and
/notifications/react-native-push-notifications-legacykeeps redirecting to the legacy archive.Every code block comes from files compiled against a strict React Native + UI Kit project; the iOS AppDelegate also compiles in a fresh React Native 0.81.4 app.
@cometchat/push-notifications-react-nativeto npm (cometchat-team/push-notifications-sdk-react-native#1).Changes
notifications/react-native-push-notifications-android.mdx— rewrittennotifications/react-native-push-notifications-ios.mdx— rewrittenNo navigation or redirect changes.
🤖 Generated with Claude Code