跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
设计与 UI

cometchat-native-components

Component catalog for the CometChat React Native UI Kit v5 — names, props, slot views, request builders, hide flags, style shape. Always loaded before writing CometChat* JSX.

cometchat · 已有 AI 审核记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add cometchat/cometchat-skills --skill cometchat-native-components

技能说明


name: cometchat-native-components description: "Component catalog for the CometChat React Native UI Kit v5 — names, props, slot views, request builders, hide flags, style shape. Always loaded before writing CometChat* JSX." license: "MIT" compatibility: "Node.js >=18; React Native >=0.70; @cometchat/chat-uikit-react-native ^5" allowed-tools: "executeBash, readFile, fileSearch, listDirectory, AskUserQuestion" metadata: author: "CometChat" version: "3.0.0" tags: "cometchat react-native components catalog props"

Purpose

Teaches Claude every component the React Native UI Kit exports, with the props, callback signatures, slot views, request builders, and style shapes that actually exist. This is the authoritative reference — never invent component names or props from memory; look them up here.

Read this skill before writing any <CometChat*> JSX.

Ground truth: packages/ChatUiKit/src/index.ts from the UI Kit source + docs/ui-kit/react-native/components-overview.mdx + per-component doc pages.


How to use this catalog

The React Native UI Kit is a set of independent components that you compose into chat layouts. Three patterns cover almost every use case:

PatternComponents
Two-pane (inbox)CometChatConversations + CometChatMessageHeader + CometChatMessageList + CometChatMessageComposer
Single thread (1-to-1)CometChatMessageHeader + CometChatMessageList + CometChatMessageComposer (with a resolved user or group)
Tab-based messengerCometChatConversations + CometChatUsers + CometChatGroups + CometChatCallLogs in a bottom-tab bar

Data flow (identical across all 3): a list component emits a CometChat.Conversation / User / Group via onItemPress. Extract the entity (conversation.getConversationWith() for conversations) and pass it as a prop to the header / list / composer.

All components share the same API surface — see § Prop conventions.


Prop conventions (applies to every <CometChat*> component)

Four prop families you'll see across the catalog:

FamilyShapeExample
Callbackon<Event>={(param) => void}onItemPress={(conv) => ...} • onError={(err) => ...} • onSendButtonPress={(msg) => ...}
Request builder<entity>RequestBuilder={new CometChat.<Entity>RequestBuilder()}conversationsRequestBuilder={new CometChat.ConversationsRequestBuilder().setLimit(20)}
Hide / visibility togglehide<Feature>={boolean} | <feature>Visibility={boolean}hideReceipts={true} • hideReplyInThreadOption={true}
View slot (replace a section)<Slot>View={(params) => JSX} — PascalCase, returns JSXTitleView={(user, group) => <MyTitle />} • LeadingView={(u, g) => <MyAvatar />}
Stylestyle={{ containerStyle: {}, itemStyle: { ... } }}see § 13 Style shape

On-events take positional args, not an event object. onItemPress={(conversation) => ...} receives the CometChat.Conversation directly — no event.target.

Slot views are capitalized: TitleView, SubtitleView, LeadingView, TrailingView, EmptyStateView, ErrorStateView, LoadingStateView, AuxiliaryButtonView. Each slot function gets the same props the default view would have (usually user, group or a single entity).

Style is nested objects. Top-level style accepts containerStyle (outermost wrapper) then component-specific keys. Each inner style is a regular React Native StyleSheet object.


1. Lists

All four list components take a request builder, an onItemPress callback, on<List>LongPress for long-press, and style={}.

CometChatConversations

Scrollable list of recent conversations (both user and group).

import { CometChatConversations } from "@cometchat/chat-uikit-react-native";
import { CometChat } from "@cometchat/chat-sdk-react-native";

<CometChatConversations
  conversationsRequestBuilder={
    new CometChat.ConversationsRequestBuilder().setLimit(20)
  }
  onItemPress={(conversation) => {
    const entity = conversation.getConversationWith();   // User | Group
    const type = conversation.getConversationType();      // "user" | "group"
    // navigate / open panel with `entity`
  }}
  onError={(err) => console.error(err)}
  hideHeader={false}
  hideReceipts={false}
  style={{ containerStyle: { backgroundColor: "#fff" } }}
/>

Key props: conversationsRequestBuilder, onItemPress, onItemLongPress, onError, onEmpty, hideReceipts, hideHeader, hideSearch, TitleView, SubtitleView, LeadingView, TrailingView, EmptyStateView, ErrorStateView, LoadingStateView, BackdropView, style.

CometChatUsers

<CometChatUsers
  usersRequestBuilder={new CometChat.UsersRequestBuilder().setLimit(30)}
  onItemPress={(user) => openChatWith(user)}
  searchKeyword=""
  hideStatus={false}
/>

Key props: usersRequestBuilder, onItemPress, onError, onEmpty, searchKeyword, hideStatus, hideSearch, LeadingView, TitleView, SubtitleView, EmptyStateView, ErrorStateView, LoadingStateView, style.

CometChatGroups

<CometChatGroups
  groupsRequestBuilder={
    new CometChat.GroupsRequestBuilder().setLimit(30).joinedOnly(true)
  }
  onItemPress={(group) => openGroupChat(group)}
/>

Key props: same shape as Users, with groupsRequestBuilder instead.

CometChatGroupMembers

<CometChatGroupMembers
  group={selectedGroup}
  groupMemberRequestBuilder={
    new CometChat.GroupMembersRequestBuilder(selectedGroup.getGuid()).setLimit(30)
  }
  onItemPress={(member) => openMemberDetails(member)}
  hideKickMemberOption={false}
  hideBanMemberOption={false}
/>

Key props: group (required — pass a CometChat.Group instance), groupMemberRequestBuilder, onItemPress, onError, onBack, hideKickMemberOption, hideBanMemberOption, hideChangeScopeOption, slot views for each row section, style.

阅读完整来源 ↗