AI Integration Quick Reference
AI Integration Quick Reference
| Field | Value |
|---|---|
| Package | @cometchat/chat-uikit-react-native |
| Required setup | CometChatUIKit.init() + CometChatUIKit.login() before rendering any component |
| Callback actions | on<Event>={(param) => {}} (e.g., onItemPress) |
| Data filtering | <entity>RequestBuilder={new CometChat.<Entity>RequestBuilder()} |
| Toggle features | hide<Feature>={true} or <feature>Visibility={false} |
| Custom rendering | <Slot>View={(<params>) => JSX} (PascalCase) |
| Style overrides | style={{ containerStyle: {}, itemStyle: {} }} |
| Calling | Requires separate @cometchat/calls-sdk-react-native package |
Architecture
The UI Kit is a set of independent components that compose into chat layouts. A typical two-panel layout uses four core components:- CometChatConversations — sidebar listing recent conversations (users and groups)
- CometChatMessageHeader — toolbar showing avatar, name, online status, and typing indicator
- CometChatMessageList — scrollable message feed with reactions, receipts, and threads
- CometChatMessageComposer — rich text input with attachments, mentions, and voice notes
CometChat.Conversation object. Extract the User or Group via getConversationWith() and pass it as a prop to CometChatMessageHeader, CometChatMessageList, and CometChatMessageComposer.
Components communicate through a publish/subscribe event bus (CometChatUIEventHandler). A component emits events that other components or application code can subscribe to without direct references. See Events for the full list.
Each component accepts callback props (on<Event>), view slot props (<Slot>View) for replacing UI sections, RequestBuilder props for data filtering, and style props for customization.
Component Catalog
All components are imported from@cometchat/chat-uikit-react-native.
Conversations and Lists
| Component | Purpose | Key Props | Page |
|---|---|---|---|
| CometChatConversations | Scrollable list of recent conversations | conversationsRequestBuilder, onItemPress, onError | Conversations |
| CometChatUsers | Scrollable list of users | usersRequestBuilder, onItemPress, onError | Users |
| CometChatGroups | Scrollable list of groups | groupsRequestBuilder, onItemPress, onError | Groups |
| CometChatGroupMembers | Scrollable list of group members | group, groupMemberRequestBuilder, onItemPress | Group Members |
Messages
| Component | Purpose | Key Props | Page |
|---|---|---|---|
| CometChatMessageHeader | Toolbar with avatar, name, status, typing indicator | user, group, showBackButton | Message Header |
| CometChatMessageList | Scrollable message list with reactions, receipts, threads | user, group, messageRequestBuilder, goToMessageId | Message List |
| CometChatMessageComposer | Rich text input with attachments, mentions, voice notes | user, group, onSendButtonPress, placeholderText | Message Composer |
| CometChatThreadHeader | Parent message bubble and reply count for threaded view | parentMessage, onClose | Thread Header |
Calling
| Component | Purpose | Key Props | Page |
|---|---|---|---|
| CometChatCallButtons | Voice and video call initiation buttons | user, group, onVoiceCallPress, onVideoCallPress | Call Buttons |
| CometChatIncomingCall | Incoming call notification with accept/decline | call, onAccept, onDecline | Incoming Call |
| CometChatOutgoingCall | Outgoing call screen with cancel control | call, onClosePress | Outgoing Call |
| CometChatCallLogs | Scrollable list of call history | callLogsRequestBuilder, onItemPress | Call Logs |
AI
| Component | Purpose | Key Props | Page |
|---|---|---|---|
| CometChatAIAssistantChatHistory | AI assistant conversation history | user, onMessageClicked, onNewChatButtonClick | AI Assistant Chat History |
Component API Pattern
All components share a consistent API surface.Actions
Actions control component behavior. They split into two categories: Predefined Actions are built into the component and execute automatically on user interaction (e.g., tapping send dispatches the message). No configuration needed. User-Defined Actions are callback props that fire on specific events. Override them to customize behavior:Events
Events enable decoupled communication between components. A component emits events that other parts of the application can subscribe to without direct references.Filters
List-based components acceptRequestBuilder props to control which data loads:
Custom View Slots
Components expose named view slots (PascalCase) to replace sections of the default UI:Style Overrides
Every component accepts astyle prop for customization: