React Native UI Kit Sample App
Reference implementation of React Native UI Kit and APNs Push Notification setup.
What this guide covers
- CometChat Dashboard setup (enable push, add APNs provider).
- Platform credentials (Apple entitlements).
- Copying the sample notification stack and aligning IDs/provider IDs.
- Native glue for iOS (capabilities + PushKit/CallKit for VoIP).
- Token registration, navigation from pushes, testing, and troubleshooting.
What you need first
- CometChat app credentials (App ID, Region, Auth Key) and Push Notifications enabled with an APNs provider (React Native iOS); add an APNs VoIP provider if you plan to receive call invites via PushKit.
- Apple push setup: APNs
.p8key/cert in CometChat, iOS project with Push Notifications + Background Modes (Remote notifications) permissions. - React Native 0.81+, Node 18+, physical iOS device for reliable push/call testing.
How APNs + CometChat work together
- APNs (iOS) is the transport: Apple issues the APNs token and delivers payloads to devices.
- CometChat provider holds your credentials: The APNs provider you add stores your
.p8key/cert. - Registration flow: Request permission → APNs returns token → after
CometChat.login, register withCometChatNotifications.registerPushToken(token, platform, providerId)usingAPNS_REACT_NATIVE_DEVICE→ CometChat sends pushes to APNs on your behalf → the app handles taps/foreground events viaPushNotificationIOS.
1. Enable push and add providers (CometChat Dashboard)
- Go to Notifications → Settings and enable Push Notifications.

- Add an APNs provider for iOS and copy the Provider ID.

2. Prepare platform credentials
Apple Developer portal
- Generate an APNs Auth Key (
.p8) and note the Key ID and Team ID. - Enable Push Notifications plus Background Modes → Remote notifications on the bundle ID.

3. Local configuration
- Update
src/utils/AppConstants.tsxwithappId,authKey,region, andapnProviderId. - Keep
app.jsonname consistent with your bundle ID / applicationId.
3.1 Dependencies snapshot (from Sample App)
Install these dependencies in your React Native app:4. iOS setup
4.1 Project Setup
Enable Push Notifications and Background Modes (Remote notifications) in Xcode.
4.2 Install dependencies + pods
After running the npm install above, install pods from theios directory:
4.3 AppDelegate.swift modifications:
Add imports at the top:UNUserNotificationCenterDelegate to the AppDelegate class declaration:
didFinishLaunchingWithOptions method:
Podfile to avoid framework linkage issues:
4.4 App.tsx modifications:
Import CometChatNotifications and PushNotificationIOS:5. VoIP call notifications (iOS)
These steps are iOS-only—copy/paste and fill your IDs.5.1 Enable capabilities in Xcode
- Target ➜ Signing & Capabilities: add Push Notifications.
- Add Background Modes → enable Voice over IP and Remote notifications.
- Run on a real device (PushKit/CallKit don’t work on the simulator).
5.2 AppDelegate.swift (PushKit + CallKit bridge)
Update yourAppDelegate to register for VoIP pushes ASAP and forward events to JS/CallKeep:
5.3 Drop in VoipNotificationHandler.ts
Handles CallKeep UI, defers acceptance until login, and listens for PushKit events.
5.4 Add PendingCallManager.ts
Stores an answered call during cold start so you can accept it after login/navigation is ready.
5.5 Wire App.tsx for APNs + VoIP token registration and handler init
5.6 VoIP push payload (APNs / PushKit)
Send a VoIP push withpush_type=voip via APNs using a payload shaped like:
6. Handling notification taps and navigation
To handle notification taps and navigate to the appropriate chat screen, you need to set up handlers for both foreground and background notifications.7. Testing checklist
- Install on device, log in, and verify APNs token registration success.
- Send a message from another user:
- Foreground: banner shows unless that chat is open.
- Background/terminated: tap opens the correct conversation; handler runs.
- VoIP: send PushKit VoIP push (payload above); expect CallKit incoming UI; answer and confirm CometChat call connects; end clears dialer.
- Rotate tokens (reinstall or revoke) and confirm
onTokenRefreshre-registers.
8. Troubleshooting
| Symptom | Quick checks |
|---|---|
| No pushes | Confirm APNs key uploaded, bundle ID matches, Push extension enabled with correct provider IDs, permissions granted. |
| Token registration fails | Ensure registration runs after login, provider IDs are set, and registerForRemoteNotifications() is called. |