@cometchat/skills 3.1.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +35 -17
  2. package/bin/install.js +389 -43
  3. package/package.json +17 -8
  4. package/skills/cometchat/SKILL.md +653 -50
  5. package/skills/cometchat-android-v5/SKILL.md +120 -0
  6. package/skills/cometchat-android-v5-components/SKILL.md +430 -0
  7. package/skills/cometchat-android-v5-core/SKILL.md +468 -0
  8. package/skills/cometchat-android-v5-customization/SKILL.md +305 -0
  9. package/skills/cometchat-android-v5-extensions/SKILL.md +124 -0
  10. package/skills/cometchat-android-v5-features/SKILL.md +130 -0
  11. package/skills/cometchat-android-v5-placement/SKILL.md +276 -0
  12. package/skills/cometchat-android-v5-production/SKILL.md +94 -0
  13. package/skills/cometchat-android-v5-push/SKILL.md +620 -0
  14. package/skills/cometchat-android-v5-testing/SKILL.md +187 -0
  15. package/skills/cometchat-android-v5-theming/SKILL.md +166 -0
  16. package/skills/cometchat-android-v5-troubleshooting/SKILL.md +73 -0
  17. package/skills/cometchat-android-v6/SKILL.md +107 -0
  18. package/skills/cometchat-android-v6-builder-settings/SKILL.md +145 -0
  19. package/skills/cometchat-android-v6-compose-components/SKILL.md +202 -0
  20. package/skills/cometchat-android-v6-compose-customization/SKILL.md +280 -0
  21. package/skills/cometchat-android-v6-compose-placement/SKILL.md +213 -0
  22. package/skills/cometchat-android-v6-compose-theming/SKILL.md +224 -0
  23. package/skills/cometchat-android-v6-core/SKILL.md +354 -0
  24. package/skills/cometchat-android-v6-events/SKILL.md +212 -0
  25. package/skills/cometchat-android-v6-extensions/SKILL.md +191 -0
  26. package/skills/cometchat-android-v6-features/SKILL.md +130 -0
  27. package/skills/cometchat-android-v6-kotlin-components/SKILL.md +197 -0
  28. package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +268 -0
  29. package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +248 -0
  30. package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +202 -0
  31. package/skills/cometchat-android-v6-production/SKILL.md +187 -0
  32. package/skills/cometchat-android-v6-push/SKILL.md +274 -0
  33. package/skills/cometchat-android-v6-testing/SKILL.md +279 -0
  34. package/skills/cometchat-android-v6-troubleshooting/SKILL.md +249 -0
  35. package/skills/cometchat-angular-components/SKILL.md +706 -0
  36. package/skills/cometchat-angular-core/SKILL.md +444 -0
  37. package/skills/cometchat-angular-customization/SKILL.md +424 -0
  38. package/skills/cometchat-angular-features/SKILL.md +447 -0
  39. package/skills/cometchat-angular-patterns/SKILL.md +447 -0
  40. package/skills/cometchat-angular-placement/SKILL.md +685 -0
  41. package/skills/cometchat-angular-production/SKILL.md +415 -0
  42. package/skills/cometchat-angular-theming/SKILL.md +365 -0
  43. package/skills/cometchat-angular-troubleshooting/SKILL.md +329 -0
  44. package/skills/cometchat-astro-patterns/SKILL.md +3 -3
  45. package/skills/cometchat-components/SKILL.md +2 -0
  46. package/skills/cometchat-core/SKILL.md +11 -6
  47. package/skills/cometchat-customization/references/component-catalog.md +1 -1
  48. package/skills/cometchat-features/SKILL.md +176 -108
  49. package/skills/cometchat-flutter-v5/SKILL.md +167 -0
  50. package/skills/cometchat-flutter-v5-calls/SKILL.md +192 -0
  51. package/skills/cometchat-flutter-v5-conversations/SKILL.md +117 -0
  52. package/skills/cometchat-flutter-v5-core/SKILL.md +221 -0
  53. package/skills/cometchat-flutter-v5-customization/SKILL.md +227 -0
  54. package/skills/cometchat-flutter-v5-events/SKILL.md +155 -0
  55. package/skills/cometchat-flutter-v5-messages/SKILL.md +258 -0
  56. package/skills/cometchat-flutter-v5-production/SKILL.md +207 -0
  57. package/skills/cometchat-flutter-v5-push/SKILL.md +284 -0
  58. package/skills/cometchat-flutter-v5-theming/SKILL.md +160 -0
  59. package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +129 -0
  60. package/skills/cometchat-flutter-v5-users-groups/SKILL.md +151 -0
  61. package/skills/cometchat-flutter-v6/SKILL.md +445 -0
  62. package/skills/cometchat-flutter-v6-calls/SKILL.md +333 -0
  63. package/skills/cometchat-flutter-v6-components/SKILL.md +365 -0
  64. package/skills/cometchat-flutter-v6-conversations/SKILL.md +210 -0
  65. package/skills/cometchat-flutter-v6-core/SKILL.md +305 -0
  66. package/skills/cometchat-flutter-v6-customization/SKILL.md +666 -0
  67. package/skills/cometchat-flutter-v6-events/SKILL.md +216 -0
  68. package/skills/cometchat-flutter-v6-features/SKILL.md +406 -0
  69. package/skills/cometchat-flutter-v6-messages/SKILL.md +333 -0
  70. package/skills/cometchat-flutter-v6-migration/SKILL.md +381 -0
  71. package/skills/cometchat-flutter-v6-placement/SKILL.md +398 -0
  72. package/skills/cometchat-flutter-v6-production/SKILL.md +632 -0
  73. package/skills/cometchat-flutter-v6-theming/SKILL.md +260 -0
  74. package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +726 -0
  75. package/skills/cometchat-flutter-v6-users-groups/SKILL.md +216 -0
  76. package/skills/cometchat-ios/SKILL.md +323 -0
  77. package/skills/cometchat-ios-components/SKILL.md +651 -0
  78. package/skills/cometchat-ios-core/SKILL.md +822 -0
  79. package/skills/cometchat-ios-customization/SKILL.md +825 -0
  80. package/skills/cometchat-ios-features/SKILL.md +725 -0
  81. package/skills/cometchat-ios-placement/SKILL.md +750 -0
  82. package/skills/cometchat-ios-production/SKILL.md +730 -0
  83. package/skills/cometchat-ios-push/SKILL.md +582 -0
  84. package/skills/cometchat-ios-theming/SKILL.md +631 -0
  85. package/skills/cometchat-ios-troubleshooting/SKILL.md +983 -0
  86. package/skills/cometchat-native-bare-patterns/SKILL.md +470 -0
  87. package/skills/cometchat-native-components/SKILL.md +594 -0
  88. package/skills/cometchat-native-core/SKILL.md +407 -0
  89. package/skills/cometchat-native-customization/SKILL.md +594 -0
  90. package/skills/cometchat-native-expo-patterns/SKILL.md +485 -0
  91. package/skills/cometchat-native-features/SKILL.md +608 -0
  92. package/skills/cometchat-native-placement/SKILL.md +500 -0
  93. package/skills/cometchat-native-production/SKILL.md +694 -0
  94. package/skills/cometchat-native-push/SKILL.md +593 -0
  95. package/skills/cometchat-native-testing/SKILL.md +583 -0
  96. package/skills/cometchat-native-theming/SKILL.md +656 -0
  97. package/skills/cometchat-native-troubleshooting/SKILL.md +433 -0
  98. package/skills/cometchat-nextjs-patterns/SKILL.md +5 -5
  99. package/skills/cometchat-react-router-patterns/SKILL.md +23 -21
@@ -0,0 +1,433 @@
1
+ ---
2
+ name: cometchat-native-troubleshooting
3
+ description: "Diagnose CometChat React Native UI Kit integration failures — init/login, gesture handler, pod install, iOS privacy manifest, Android Maven, Metro cache, permissions, calls, extensions, v4-to-v5 upgrade. For push-specific symptoms see cometchat-native-push § 12."
4
+ license: "MIT"
5
+ compatibility: "Node.js >=18; React Native >=0.70; @cometchat/chat-uikit-react-native ^5"
6
+ allowed-tools: "executeBash, readFile, fileSearch, listDirectory, AskUserQuestion"
7
+ metadata:
8
+ author: "CometChat"
9
+ version: "3.0.0"
10
+ tags: "cometchat react-native troubleshooting metro pods permissions upgrade"
11
+ ---
12
+
13
+ ## Purpose
14
+
15
+ Teaches Claude how to diagnose and fix CometChat React Native integration failures. Covers every category of failure I've seen across Expo + bare RN, with an up-front triage flow so Claude asks the right questions before assuming a fix.
16
+
17
+ **Read `cometchat-native-core` first** — most "why doesn't this work" issues trace to the init/login/wrapper chain explained there.
18
+
19
+ Ground truth: `docs/ui-kit/react-native/troubleshooting.mdx`, `apple-privacy-manifest-guide.mdx`, `upgrading-from-v4.mdx`, and first-hand failure modes from real integrations.
20
+
21
+ ---
22
+
23
+ ## 1. Triage — read project state before guessing
24
+
25
+ When the user reports a problem, gather facts before proposing a fix. Ask + run these first:
26
+
27
+ ### 1a. Which framework?
28
+
29
+ ```bash
30
+ # Expo or bare?
31
+ grep -E '"expo":|"expo-router":' package.json
32
+ ls -d ios android 2>/dev/null # bare RN has these dirs at root
33
+ ls app.json app.config.js 2>/dev/null
34
+ ```
35
+
36
+ - `expo` in dependencies + no `ios/android` folders → **Expo managed** → route to `cometchat-native-expo-patterns`
37
+ - `ios/` + `android/` folders at root → **bare RN** → route to `cometchat-native-bare-patterns`
38
+ - Both (`expo` + `ios/android`) → bare-after-prebuild. Treat as bare.
39
+
40
+ ### 1b. Is the wrapper chain correct?
41
+
42
+ ```bash
43
+ # Confirm four wrappers in entry file
44
+ grep -E "GestureHandlerRootView|SafeAreaProvider|CometChatThemeProvider|CometChatProvider" \
45
+ App.tsx index.js index.ts app/_layout.tsx 2>/dev/null
46
+ ```
47
+
48
+ If any are missing, that's almost certainly the cause. See `cometchat-native-core` § 3.
49
+
50
+ ### 1c. Is `react-native-gesture-handler` imported first?
51
+
52
+ ```bash
53
+ # Must be line 1 (or 2 with a shebang) of entry
54
+ head -5 index.js index.ts App.tsx app/_layout.tsx 2>/dev/null
55
+ ```
56
+
57
+ If the import is missing or below React, swipe gestures and bottom sheets silently break — often only in release builds.
58
+
59
+ ### 1d. Is init complete before login?
60
+
61
+ ```bash
62
+ grep -A 10 "CometChatUIKit.init" src/providers/CometChatProvider.tsx 2>/dev/null
63
+ ```
64
+
65
+ Look for the init-then-login sequence with an `await` or module-level `initialized` flag. Fire-and-forget init is a common cause of "components don't render."
66
+
67
+ ### 1e. Pod install state (iOS)
68
+
69
+ ```bash
70
+ ls ios/Pods/ | head -5 2>/dev/null # should list dozens of pods
71
+ cat ios/Podfile.lock | head -3 2>/dev/null
72
+ ```
73
+
74
+ If `ios/Pods/` is missing or sparse, native modules aren't linked. `cd ios && pod install && cd ..` is the fix.
75
+
76
+ ### 1f. Package deps
77
+
78
+ ```bash
79
+ # Check the full UI Kit peer-dep set is installed
80
+ for dep in \
81
+ @cometchat/chat-sdk-react-native \
82
+ @cometchat/chat-uikit-react-native \
83
+ react-native-gesture-handler \
84
+ react-native-safe-area-context \
85
+ react-native-svg \
86
+ @react-native-async-storage/async-storage; do
87
+ node -e "try{require.resolve('$dep'); console.log('✓ $dep')}catch(e){console.log('✗ MISSING: $dep')}"
88
+ done
89
+ ```
90
+
91
+ Missing peer deps → install + `pod install` (bare) or `expo install` (Expo) + rebuild.
92
+
93
+ ---
94
+
95
+ ## 2. Symptom → fix lookup tables
96
+
97
+ Quick-reference tables. Work through in order; if none match, drop into § 3 deep-dives.
98
+
99
+ ### 2a. Initialization + login
100
+
101
+ | Symptom | Likely cause | Fix |
102
+ |---|---|---|
103
+ | `CometChatUIKit.init()` fails silently | Invalid `APP_ID` / `REGION` / `AUTH_KEY` | Re-verify from dashboard → your app → Credentials |
104
+ | Components render nothing after login | `init()` not awaited before mount | Use the provider pattern from `cometchat-native-core` § 6 with `isReady` gating |
105
+ | Blank screen, no errors | Component mounted before init completed | Conditionally render: `if (!isReady) return null` |
106
+ | `getLoggedInUser()` returns `null` | Login not called or session expired | Call `CometChatUIKit.login({ uid })` after init resolves |
107
+ | Login fails: "UID not found" | User doesn't exist in CometChat | Create via dashboard, SDK, or REST API. For dev, use `cometchat-uid-1` through `cometchat-uid-5` (pre-seeded) |
108
+ | "Please wait until the previous login request ends" | `login()` called concurrently (React StrictMode double-mount / navigation remount) | Use the `ensureLoggedIn` module-level promise guard from `cometchat-native-core` § 2 |
109
+ | `sendTextMessage()` fails | Not logged in or invalid receiver | Verify `getLoggedInUser()` returns a user + receiver user/group object exists |
110
+ | Production build exposes Auth Key | Using `authKey` in production | Switch to server-minted auth tokens via `login({ authToken })`. See `cometchat-native-production` |
111
+
112
+ ### 2b. Gesture handler + wrapper chain
113
+
114
+ | Symptom | Likely cause | Fix |
115
+ |---|---|---|
116
+ | Composer swipe gestures not working | `import "react-native-gesture-handler"` not at TOP of entry file | Move to line 1 of `index.js` / `index.ts` / Expo Router's `app/_layout.tsx` |
117
+ | BottomSheet doesn't open on swipe | Missing `GestureHandlerRootView` wrapper | Wrap at app root with `<GestureHandlerRootView style={{ flex: 1 }}>` |
118
+ | Content overlaps status bar / home indicator | Missing `SafeAreaProvider` | Wrap inside `GestureHandlerRootView` with `<SafeAreaProvider>` |
119
+ | Theme tokens return undefined | Missing `CometChatThemeProvider` | Add wrapper. See `cometchat-native-core` § 3 for the full chain |
120
+ | "Couldn't find SafeArea context" error | `SafeAreaView` used outside `SafeAreaProvider` | Add `SafeAreaProvider` at root, or use plain `View` inside chat screens |
121
+ | Release build: swipe/gesture broken, dev build fine | `react-native-gesture-handler` not line 1 (some bundlers defer it) | Move to line 1 unconditionally |
122
+
123
+ ### 2c. iOS build failures
124
+
125
+ | Symptom | Likely cause | Fix |
126
+ |---|---|---|
127
+ | `No such module 'RNGestureHandler'` | Pods not installed | `cd ios && pod install && cd ..` + rebuild |
128
+ | `Undefined symbol: _OBJC_CLASS_$_RNCAsyncStorage` | Pods out of sync after `npm install` | `cd ios && pod install && cd ..` |
129
+ | `TurboModuleRegistry.getEnforcing(...)` crash at runtime | Native module not linked | `cd ios && pod install && cd ..` + reset Metro cache (`--reset-cache`) |
130
+ | App Store rejection `ITMS-91053` | Missing Apple Privacy Manifest | Add `ios/<App>/PrivacyInfo.xcprivacy` with 4 API types. See `cometchat-native-bare-patterns` § 2c |
131
+ | Simulator build fails: "arm64 excluded" | Architecture mismatch on Apple Silicon | Add `EXCLUDED_ARCHS[sdk=iphonesimulator*]` post_install in Podfile. See `cometchat-native-features` § 3c |
132
+ | Camera/mic permission dialog doesn't appear | Missing `NSCameraUsageDescription` / `NSMicrophoneUsageDescription` | Add to `ios/<App>/Info.plist` (bare) or `app.json` `ios.infoPlist` (Expo) |
133
+ | iOS build fails: "deployment target too low" | Calls SDK needs 12+ | Set `IPHONEOS_DEPLOYMENT_TARGET = '12.0'` in Podfile post_install |
134
+ | Expo Go crashes: "Main module field cannot be resolved" | Expo Go doesn't support native modules | Use dev builds: `npx expo run:ios` or `eas build --profile development` |
135
+
136
+ ### 2d. Android build failures
137
+
138
+ | Symptom | Likely cause | Fix |
139
+ |---|---|---|
140
+ | `Could not find :react-native-async-storage_async-storage:` | Local Maven repo entry missing | Add to `android/build.gradle` `allprojects.repositories` — see `cometchat-native-bare-patterns` § 3b |
141
+ | Build crashes on launch | `compileSdkVersion` too low | Set `compileSdkVersion` to 33+ and `minSdkVersion` to 24+ in `android/app/build.gradle` |
142
+ | "Permission denied" when picking photos | Missing Android permissions | Add `READ_MEDIA_IMAGES` (API 33+) or `READ_EXTERNAL_STORAGE` (API ≤32) to `AndroidManifest.xml` |
143
+ | "Camera permission denied" | Missing permission in manifest or runtime denial | Add `CAMERA` to `AndroidManifest.xml` + verify runtime-grant flow |
144
+ | Gradle sync fails after `npm install` | Native module autolinking stale | `cd android && ./gradlew clean && cd ..` then rebuild |
145
+ | `Unable to delete file: ...node_modules/...` | Metro lockfile on Windows (if cross-OS) | Restart Metro + IDE |
146
+
147
+ ### 2e. Metro / JS runtime
148
+
149
+ | Symptom | Likely cause | Fix |
150
+ |---|---|---|
151
+ | "Unable to resolve module ..." for a dep that IS installed | Metro cache stale | Stop Metro, run with `--reset-cache`: `npx react-native start --reset-cache` or `npx expo start --clear` |
152
+ | Fast Refresh doesn't pick up new deps | Native dep change (requires rebuild) | Restart Metro + rebuild (iOS/Android) |
153
+ | "Maximum update depth exceeded" after theme change | Theme object recreated each render | Define theme at module scope or in `useMemo(() => ..., [])` |
154
+ | App crashes on first JS load | Entry file error (syntax or import order) | Check `index.js` — `react-native-gesture-handler` should be line 1 |
155
+
156
+ ### 2f. Theming
157
+
158
+ | Symptom | Likely cause | Fix |
159
+ |---|---|---|
160
+ | Theme overrides don't apply | Missing `CometChatThemeProvider` wrapper | Add at app root. See `cometchat-native-theming` § 2 |
161
+ | Dark mode doesn't switch when system toggled | `mode` hardcoded to `"light"` / `"dark"` | Omit the `mode` field to follow system |
162
+ | Custom color shows as fallback | Color not a hex string | Use `#RRGGBB` format. `rgb()` / named colors / `hsl()` break the extendedPrimary auto-derivation |
163
+ | Custom font shows system default (iOS) / crashes (Android) | Font not loaded before render | Gate the provider on font loading (Expo `useFonts` or bare `react-native-asset`) |
164
+ | Icon color not changing via `imageStyle` | Only `tintColor`, `height`, `width` work on default SVG icons | Use `tintColor`. Other props are ignored for built-in icons |
165
+ | `useTheme()` returns undefined | Called outside `CometChatThemeProvider` | Ensure the component is a descendant of the provider |
166
+
167
+ ### 2g. Components
168
+
169
+ | Symptom | Likely cause | Fix |
170
+ |---|---|---|
171
+ | Slot view (`TitleView`, `LeadingView`, etc.) renders nothing | Slot returned `null` / `undefined` | Slot must return valid JSX |
172
+ | Empty message list despite sent messages | `user` vs `group` prop mixed up | Pass exactly one of `user` OR `group` — never both, never neither |
173
+ | "Reply in Thread" option does nothing when tapped | Thread panel not wired | Set `hideReplyInThreadOption` (see `cometchat-native-components` § 11) OR wire a thread panel (§ 2b) |
174
+ | `onItemPress` callback not firing | Wrong prop name (RN uses `Press` not `Click`) | It's `onItemPress`, not `onItemClick` — web and RN diverge here |
175
+ | Conversations list empty but data exists | Wrong request builder | Check `conversationsRequestBuilder` filters (tags, types) |
176
+ | List components collapse to zero height | Container has no bounded height | Wrap in `<View style={{ flex: 1 }}>` or explicit `height: N`. See `cometchat-native-placement` Hard rule #8 |
177
+ | Component renders but data never loads | User/group passed as UID string instead of `CometChat.User`/`Group` instance | `await CometChat.getUser(uid)` first, pass the resolved object |
178
+
179
+ ### 2h. Calling
180
+
181
+ | Symptom | Likely cause | Fix |
182
+ |---|---|---|
183
+ | Call buttons missing from MessageHeader | `@cometchat/calls-sdk-react-native` not installed | Install + rebuild. See `cometchat-native-features` § 3 |
184
+ | Incoming call UI doesn't show | `CometChatIncomingCall` not mounted or listener not registered | Register `CometChat.addCallListener(...)` and mount `<CometChatIncomingCall>` at app root |
185
+ | Call connects but no audio/video | Missing Podfile settings or Android SDK versions | Check `IPHONEOS_DEPLOYMENT_TARGET = 12.0` + Android `minSdkVersion = 24` |
186
+ | WebRTC errors on load | Missing peer deps | Install `react-native-webrtc` + `@react-native-community/netinfo` + `react-native-background-timer` + `react-native-callstats` |
187
+ | Call crashes on Android after accept | Permissions denied at runtime | Request `RECORD_AUDIO` + `CAMERA` runtime permissions before call |
188
+ | `onIncomingCallReceived` silent | Listener registered before login completes | Register the listener INSIDE the `useEffect` that runs after login |
189
+
190
+ ### 2i. Extensions
191
+
192
+ | Symptom | Likely cause | Fix |
193
+ |---|---|---|
194
+ | Polls option missing from composer | Extension not enabled in dashboard | `cometchat features enable polls --json` or toggle in dashboard → Features |
195
+ | Stickers not rendering | Sticker extension not enabled | Same as above — enable via CLI |
196
+ | Extension enabled but UI doesn't appear | Cached session — hard reload needed | Stop Metro, clear cache (`--reset-cache`), rebuild |
197
+ | Extension says enabled but `auto_wired_in_uikit: false` | Needs `extensions` field on `CometChatUIKit.init({ ... })` | Add `extensions: [new StickersExtension(), ...]` to the init settings — see `cometchat-native-features` § 2 |
198
+ | Message translation "Translate" option missing | Extension not enabled | Enable `MessageTranslation` via CLI / dashboard |
199
+
200
+ ### 2j. AI features
201
+
202
+ | Symptom | Likely cause | Fix |
203
+ |---|---|---|
204
+ | AI suggestions don't appear | AI feature not enabled in dashboard | Enable via dashboard → AI → individual feature |
205
+ | Smart Replies not showing | Smart Replies extension off | Enable via CLI: `cometchat features enable smart-replies` |
206
+ | Conversation Starter missing | Feature off + no conversation context | Enable feature + ensure chat has at least one previous message |
207
+
208
+ ### 2k. Localization
209
+
210
+ | Symptom | Likely cause | Fix |
211
+ |---|---|---|
212
+ | UI text not translated | Language code mismatch | Use full codes like `en-US`, not short `en` |
213
+ | Auto-detection not working | `react-native-localize` missing | Install: `npm install react-native-localize` + pod install |
214
+ | Custom translations not applied | Missing `CometChatI18nProvider` | Wrap app inside `CometChatThemeProvider` with `<CometChatI18nProvider>` |
215
+
216
+ ### 2l. Events
217
+
218
+ | Symptom | Likely cause | Fix |
219
+ |---|---|---|
220
+ | Listener doesn't fire | Wrong event name | Check `docs/events.mdx` for exact event names (e.g., `ccMessageSent` not `onMessageSent`) |
221
+ | Listener fires twice | Duplicate registration (common with hot reload / remount) | Remove in `useEffect` cleanup: `return () => CometChatUIEventHandler.removeMessageListener(id)` |
222
+ | Listener ID collision | Hardcoded ID reused across components | Use a unique constant per component: `const LISTENER_ID = "APP_SCREEN_LISTENER"` |
223
+ | Call events not received | `CometChat.addCallListener` registered before login | Move registration into `useEffect` after login completes |
224
+
225
+ ### 2m. Production / auth tokens
226
+
227
+ | Symptom | Likely cause | Fix |
228
+ |---|---|---|
229
+ | `login({ authToken })` fails: "user does not exist" | User not created in CometChat before token mint | Create user server-side via REST API on your signup flow. See `cometchat-native-production` § 6 |
230
+ | Token endpoint returns 401 | Backend auth check failing | Verify `Authorization: Bearer <jwt>` header is attached to the fetch |
231
+ | 429 rate limit on token endpoint | Minting tokens too often (e.g. per screen mount) | Cache client-side, reuse until expiry. See `cometchat-native-production` § 10 |
232
+ | SDK disconnects after a few hours | Token expired | Wire `onDisconnected` listener to re-fetch + re-login. See `cometchat-native-production` § 5c |
233
+ | `CometChatUIKit.loginWithAuthToken` not found | Wrong API name | It's `CometChatUIKit.login({ authToken })` — same method as dev, different key |
234
+
235
+ ---
236
+
237
+ ## 3. Deep dives on common failures
238
+
239
+ ### 3a. "The most common 'why is my chat blank' bug"
240
+
241
+ CometChat components fill 100% of their parent's height. If the parent has no bounded height, the components render at 0px and look empty.
242
+
243
+ Diagnostic:
244
+
245
+ ```bash
246
+ grep -B5 -A5 "CometChatMessageList\|CometChatConversations" src/**/*.tsx | grep -B2 -A2 "style"
247
+ ```
248
+
249
+ Look for the message list's parent. One of these must be true:
250
+
251
+ - Parent has `flex: 1`
252
+ - Parent has an explicit `height: N`
253
+ - Parent is a flex column with the list getting `flex: 1`
254
+
255
+ Broken example:
256
+ ```tsx
257
+ <ScrollView>
258
+ <CometChatMessageList user={user} /> {/* ← ScrollView doesn't constrain height */}
259
+ </ScrollView>
260
+ ```
261
+
262
+ Fixed:
263
+ ```tsx
264
+ <View style={{ flex: 1 }}>
265
+ <CometChatMessageList user={user} hideReplyInThreadOption />
266
+ </View>
267
+ ```
268
+
269
+ ### 3b. Apple Privacy Manifest rejection (`ITMS-91053`)
270
+
271
+ Apple's App Store Connect rejects RN apps that use certain APIs without declaring them in `PrivacyInfo.xcprivacy`. The CometChat kit (through React Native + `react-native-video`) triggers 4 of these APIs.
272
+
273
+ Full manifest content is in `cometchat-native-bare-patterns` § 2c. Required reason codes:
274
+
275
+ | API | Code |
276
+ |---|---|
277
+ | FileTimestamp | `C617.1` |
278
+ | UserDefaults | `CA92.1` |
279
+ | SystemBootTime | `35F9.1` |
280
+ | DiskSpace | `E174.1` |
281
+
282
+ If the user's rejection email lists OTHER API categories, their app uses additional Apple APIs through other SDKs (analytics, crash reporters, etc.). Add those codes too — the CometChat-specific 4 aren't exhaustive for all apps.
283
+
284
+ After updating:
285
+ 1. `cd ios && pod install && cd ..`
286
+ 2. Rebuild the archive
287
+ 3. Resubmit
288
+
289
+ ### 3c. Metro cache issues (post-dep-install "not found" errors)
290
+
291
+ Happens when you `npm install` a native module and Metro's bundler still has the old module graph cached.
292
+
293
+ ```bash
294
+ # Full reset
295
+ watchman watch-del-all 2>/dev/null # watchman (if installed)
296
+ rm -rf $TMPDIR/metro-* # Metro cache on macOS
297
+ rm -rf $TMPDIR/haste-map-* # Haste cache on macOS
298
+ rm -rf node_modules
299
+ npm install
300
+ cd ios && pod install && cd .. # iOS only
301
+ npx react-native start --reset-cache # bare
302
+ # OR for Expo:
303
+ npx expo start --clear
304
+ ```
305
+
306
+ If the error persists after a clean cache + pod install, the native module isn't autolinked. Check `react-native.config.js` for exclusions.
307
+
308
+ ### 3d. "App crashes on first launch" — entry file order
309
+
310
+ `index.js` MUST have `import "react-native-gesture-handler"` as line 1. Not line 2. Not after a `// comment`. Not after a `"use strict"`. Literally line 1.
311
+
312
+ Wrong:
313
+ ```js
314
+ import React from "react"; // ← line 1
315
+ import "react-native-gesture-handler"; // ← line 2 — TOO LATE
316
+ ```
317
+
318
+ Right:
319
+ ```js
320
+ import "react-native-gesture-handler"; // ← line 1
321
+ import React from "react";
322
+ ```
323
+
324
+ For Expo Router, the same rule applies to `app/_layout.tsx`.
325
+
326
+ ### 3e. Push notification issues
327
+
328
+ Push setup is covered end-to-end in `cometchat-native-push`. That skill
329
+ has:
330
+
331
+ - § 3 APNs p8 setup (Apple Developer portal)
332
+ - § 4 FCM setup (Firebase project + service account)
333
+ - § 5 CometChat dashboard provider upload (dev + prod for iOS)
334
+ - § 7 Client registration with `CometChatNotifications.registerPushToken(token, platform, providerId)` (the correct API — not `CometChat.registerTokenForPushNotification`)
335
+ - § 9 Foreground display + tap-to-deep-link handlers
336
+ - § 12 Troubleshooting table mapping symptoms to fixes (production APNs cert missing, token registered before login, Expo Go can't receive push, etc.)
337
+
338
+ When diagnosing a push issue, route the user to `cometchat-native-push § 12`
339
+ rather than re-triaging here.
340
+
341
+ ---
342
+
343
+ ## 4. v4 → v5 upgrade gotchas
344
+
345
+ If the user is upgrading from `@cometchat/chat-uikit-react-native@4`, these are the common breakages. Full migration guide: `docs/upgrading-from-v4.mdx`.
346
+
347
+ | v4 | v5 | Notes |
348
+ |---|---|---|
349
+ | `CometChatContext` provider | `CometChatThemeProvider` + `CometChatI18nProvider` | Split into theme + i18n providers |
350
+ | `<CometChatConversationsWithMessages>` composite | `<CometChatConversations>` + navigate to separate screen | Composite component removed; use two-screen navigation pattern |
351
+ | `theme` prop on components | Theme via `CometChatThemeProvider` only | Per-component theme prop removed |
352
+ | `Palette` object | Color tokens under `theme.color` | Renamed + restructured |
353
+ | `onClick` callback names | `onPress` callback names | React Native convention |
354
+ | `CometChat.login(uid, authKey)` | `CometChatUIKit.login({ uid })` | Object-form argument |
355
+ | Native deps in `peerDependencies` | Must explicitly install peer deps | See `cometchat-native-core` § 9 |
356
+ | Single NPM package for calls | Separate `@cometchat/calls-sdk-react-native` package | Calls broken out |
357
+
358
+ ### Upgrade sequence
359
+
360
+ ```bash
361
+ # 1. Update the main kit
362
+ npm install @cometchat/chat-uikit-react-native@latest
363
+
364
+ # 2. Install the full peer-dep set (v5 doesn't auto-install them like v4 did)
365
+ npm install @cometchat/chat-sdk-react-native \
366
+ @react-native-async-storage/async-storage \
367
+ @react-native-clipboard/clipboard \
368
+ @react-native-community/datetimepicker \
369
+ react-native-gesture-handler react-native-localize \
370
+ react-native-safe-area-context react-native-svg \
371
+ react-native-video dayjs punycode
372
+
373
+ # 3. iOS
374
+ cd ios && pod install && cd ..
375
+
376
+ # 4. Android — add the local Maven repo for async-storage
377
+ # (see cometchat-native-bare-patterns § 3b)
378
+
379
+ # 5. Entry file — add `import "react-native-gesture-handler"` as line 1
380
+ # (new requirement in v5)
381
+
382
+ # 6. Replace `<CometChatContext>` with the 4-wrapper chain
383
+ # (see cometchat-native-core § 3)
384
+
385
+ # 7. Split composite components — e.g. `<CometChatConversationsWithMessages>`
386
+ # becomes two screens with navigation
387
+
388
+ # 8. Rename `onClick*` → `onPress*` throughout
389
+
390
+ # 9. Replace `Palette` → theme tokens
391
+
392
+ # 10. Rebuild + test
393
+ ```
394
+
395
+ ---
396
+
397
+ ## 5. Escalation — when the above doesn't solve it
398
+
399
+ If none of the lookup tables or deep dives apply:
400
+
401
+ 1. **Read the raw error.** RN errors are usually specific ("Module 'X' not found in app 'Y'" is different from "TurboModuleRegistry.getEnforcing").
402
+ 2. **Check the dev console + native logs.** For iOS: Xcode → View → Debug Area → Activate Console. For Android: `adb logcat | grep -E "cometchat|CometChat|ReactNative"`.
403
+ 3. **Search the upstream docs MCP** (`cometchat-docs` if installed).
404
+ 4. **Search the sample app** (`examples/SampleApp/` or `examples/SampleAppExpo/`) for a working version of the pattern the user is trying.
405
+ 5. **If the issue is a kit bug**, file at https://github.com/cometchat/cometchat-uikit-react-native/issues with a minimal repro.
406
+
407
+ ---
408
+
409
+ ## 6. Hard rules (diagnostic best-practice)
410
+
411
+ 1. **Don't assume — triage first.** § 1 gets the framework, wrapper chain, pod state, and dep list before proposing a fix. A "I don't see messages" could be 10 different things.
412
+ 2. **Don't suggest "try reinstalling node_modules" as a first step.** It's rarely the actual fix and it takes minutes; check the entry file, wrapper chain, and pod state first.
413
+ 3. **Always verify against the ground-truth doc** (`troubleshooting.mdx`). If a user's symptom matches a table row, use the doc's fix verbatim — don't paraphrase.
414
+ 4. **Never guess a fix that requires code changes without first gathering facts.** Changing code based on a wrong hypothesis wastes user time.
415
+ 5. **When recommending a rebuild, say why + what to rebuild.** "pod install + rebuild iOS" is more useful than "try rebuilding."
416
+ 6. **If a symptom matches the Apple Privacy Manifest rejection, always paste the full 4-code XML.** Don't describe it; show it.
417
+
418
+ ---
419
+
420
+ ## Skill routing reference
421
+
422
+ | Skill | When to route |
423
+ |---|---|
424
+ | `cometchat-native-core` | Most "doesn't work" bugs trace back here — init/login/wrapper chain |
425
+ | `cometchat-native-components` | Wrong prop / slot view / request builder |
426
+ | `cometchat-native-placement` | Blank chat / bounded-height issues |
427
+ | `cometchat-native-expo-patterns` | Expo-specific build errors (dev client required, `expo install`) |
428
+ | `cometchat-native-bare-patterns` | Bare RN build errors (pod install, Android Maven, privacy manifest) |
429
+ | `cometchat-native-theming` | Theme not applying, dark mode not switching, font not loading |
430
+ | `cometchat-native-features` | Calls don't work, extension UI missing after enable |
431
+ | `cometchat-native-customization` | Formatter not rendering, listener not firing, template not showing |
432
+ | `cometchat-native-production` | 401 on token fetch, user-does-not-exist on login |
433
+ | `cometchat-native-troubleshooting` | This skill — cross-category diagnosis + v4→v5 upgrade |
@@ -340,8 +340,8 @@ export default function MessagesPage() {
340
340
  <>
341
341
  {selectedUser && <CometChatMessageHeader user={selectedUser} />}
342
342
  {selectedGroup && <CometChatMessageHeader group={selectedGroup} />}
343
- {selectedUser && <CometChatMessageList user={selectedUser} />}
344
- {selectedGroup && <CometChatMessageList group={selectedGroup} />}
343
+ {selectedUser && <CometChatMessageList user={selectedUser} hideReplyInThreadOption={true} />}
344
+ {selectedGroup && <CometChatMessageList group={selectedGroup} hideReplyInThreadOption={true} />}
345
345
  {selectedUser && <CometChatMessageComposer user={selectedUser} />}
346
346
  {selectedGroup && <CometChatMessageComposer group={selectedGroup} />}
347
347
  </>
@@ -434,14 +434,14 @@ export default function ChatView() {
434
434
  {selectedUser && (
435
435
  <>
436
436
  <CometChatMessageHeader user={selectedUser} />
437
- <CometChatMessageList user={selectedUser} />
437
+ <CometChatMessageList user={selectedUser} hideReplyInThreadOption={true} />
438
438
  <CometChatMessageComposer user={selectedUser} />
439
439
  </>
440
440
  )}
441
441
  {selectedGroup && (
442
442
  <>
443
443
  <CometChatMessageHeader group={selectedGroup} />
444
- <CometChatMessageList group={selectedGroup} />
444
+ <CometChatMessageList group={selectedGroup} hideReplyInThreadOption={true} />
445
445
  <CometChatMessageComposer group={selectedGroup} />
446
446
  </>
447
447
  )}
@@ -503,7 +503,7 @@ export function ChatDrawer({ isOpen, onClose, targetUserId }: ChatDrawerProps) {
503
503
  <>
504
504
  <CometChatMessageHeader user={user} />
505
505
  <div style={{ flex: 1, overflow: "hidden" }}>
506
- <CometChatMessageList user={user} />
506
+ <CometChatMessageList user={user} hideReplyInThreadOption={true} />
507
507
  </div>
508
508
  <CometChatMessageComposer user={user} />
509
509
  </>
@@ -215,8 +215,8 @@ export default function ConversationView() {
215
215
  <>
216
216
  {user && <CometChatMessageHeader user={user} />}
217
217
  {group && <CometChatMessageHeader group={group} />}
218
- {user && <CometChatMessageList user={user} />}
219
- {group && <CometChatMessageList group={group} />}
218
+ {user && <CometChatMessageList user={user} hideReplyInThreadOption={true} />}
219
+ {group && <CometChatMessageList group={group} hideReplyInThreadOption={true} />}
220
220
  {user && <CometChatMessageComposer user={user} />}
221
221
  {group && <CometChatMessageComposer group={group} />}
222
222
  </>
@@ -326,25 +326,10 @@ export const useCometChat = () => useContext(CometChatContext);
326
326
  let initialized = false;
327
327
  let loginInFlight: Promise<unknown> | null = null;
328
328
 
329
- async function ensureLoggedIn(
330
- uid: string,
331
- authToken?: string,
332
- ): Promise<void> {
333
- const existing = await CometChatUIKit.getLoggedinUser();
334
- if (existing) return;
335
- if (loginInFlight) {
336
- await loginInFlight;
337
- return;
338
- }
339
- loginInFlight = authToken
340
- ? CometChatUIKit.loginWithAuthToken(authToken)
341
- : CometChatUIKit.login(uid);
342
- try {
343
- await loginInFlight;
344
- } finally {
345
- loginInFlight = null;
346
- }
347
- }
329
+ // `ensureLoggedIn` is defined inside `setup()` below so it can close over
330
+ // the dynamically-imported `CometChatUIKit`. Hoisting it to module scope
331
+ // would `ReferenceError` because the static import is intentionally
332
+ // removed (SSR safety) `CometChatUIKit` only exists inside the await.
348
333
 
349
334
  export function CometChatProvider({ children }: { children: React.ReactNode }) {
350
335
  const [isReady, setIsReady] = useState(false);
@@ -358,6 +343,23 @@ export function CometChatProvider({ children }: { children: React.ReactNode }) {
358
343
  "@cometchat/chat-uikit-react"
359
344
  );
360
345
 
346
+ async function ensureLoggedIn(uid: string, authToken?: string): Promise<void> {
347
+ const existing = await CometChatUIKit.getLoggedinUser();
348
+ if (existing) return;
349
+ if (loginInFlight) {
350
+ await loginInFlight;
351
+ return;
352
+ }
353
+ loginInFlight = authToken
354
+ ? CometChatUIKit.loginWithAuthToken(authToken)
355
+ : CometChatUIKit.login(uid);
356
+ try {
357
+ await loginInFlight;
358
+ } finally {
359
+ loginInFlight = null;
360
+ }
361
+ }
362
+
361
363
  if (!initialized) {
362
364
  initialized = true;
363
365