AI Integration Quick Reference
AI Integration Quick Reference
| Field | Value |
|---|---|
| Package | @cometchat/chat-uikit-react-native |
| Key components | CometChatMessageList, CometChatMessageComposer, CometChatMessageHeader |
| Trigger | Long-press a message in a group chat → “Message Privately” |
| Event | openChat via CometChatUIEventHandler.addUIListener |
| Prop | hideMessagePrivatelyOption on CometChatMessageList |
| Sample app | GitHub |
| Related | Message List · All Guides |
How It Works
The feature is built intoCometChatMessageList. When a user selects “Message Privately” from the message long-press menu:
- The UIKit fetches the message sender via
CometChat.getUser() - It emits an
openChatUI event with{ user }viaCometChatUIEventHandler - Your app listens with
addUIListenerand navigates to a private chat screen
Components
| Component / Class | Role |
|---|---|
CometChatMessageList | Group chat — shows the “Message Privately” long-press option |
CometChatMessageHeader | Header for the private 1:1 chat screen |
CometChatMessageList | Message list for the private 1:1 chat screen |
CometChatMessageComposer | Composer for the private 1:1 chat screen |
Integration Steps
1. Group Chat Screen
Render the full group chat and register anopenChat listener. The “Message Privately” option appears automatically in the long-press menu for every message in a group conversation — no extra setup needed. When selected, the UIKit fetches the sender and fires openChat, which your listener catches to navigate to the private chat.
2. Private Chat Screen
Create a dedicated screen for the private conversation. Include a back button in the header so the user can return to the group.3. Navigation Setup
Register both screens in your navigator.Hiding the Option
To disable “Message Privately” in specific contexts (e.g., direct 1:1 chats, AI assistant chats), passhideMessagePrivatelyOption to CometChatMessageList.
Feature Matrix
| Feature | How |
|---|---|
| Trigger | Long-press any message → “Message Privately” |
| Event emitted | openChat with { user?: CometChat.User, group?: CometChat.Group } |
| Listen for event | CometChatUIEventHandler.addUIListener |
| Hide the option | hideMessagePrivatelyOption prop on CometChatMessageList |
| Return to group | Pass fromGroup as nav param, call navigation.navigate('GroupChat', { group }) |
Next Steps
Message List
Full prop reference for CometChatMessageList.
Group Members
Display and manage group member lists.
Message Header
Customize the chat header with back navigation.
All Guides
Browse all feature and formatter guides.