UNPKG

@cometchat/chat-uikit-react-native

Version:

Ready-to-use Chat UI Components for React Native

97 lines (96 loc) 2.87 kB
import React, { ReactNode } from "react"; import { ImageSourcePropType, StyleProp, TextStyle, ViewStyle } from "react-native"; import { CometChatTheme } from "../../../theme/type"; import { CometChatStatusIndicatorInterface } from "../CometChatStatusIndicator"; import { DeepPartial } from "../../helper/types"; export interface CometChatListItemInterface { /** * Unique identifier for the list item. */ id: string | number; /** * URL for the avatar image. */ avatarURL?: ImageSourcePropType; /** * Fallback name for the avatar if image is not available. */ avatarName?: string; /** * Custom style for the avatar. */ avatarStyle?: CometChatTheme["avatarStyle"]; /** * Title text to display. */ title?: string; /** * Custom style for the title text. */ titleStyle?: StyleProp<TextStyle>; /** * Custom style for the item container. */ containerStyle?: StyleProp<ViewStyle>; /** * Specifies the type for the status indicator. */ statusIndicatorType?: CometChatStatusIndicatorInterface["type"] | null; /** * Custom node to display at the beginning of the item. */ LeadingView?: ReactNode; /** * Custom node to display as the title view. */ TitleView?: ReactNode; /** * Custom node to display as the subtitle view. */ SubtitleView?: ReactNode; /** * Custom node to display at the end of the item. */ TrailingView?: ReactNode; /** * Color for the separator. */ separatorColor?: string; /** * Callback function triggered on item press. */ onPress?: Function; /** * Callback function triggered on item long press. */ onLongPress?: Function; /** * Indicates if the item is selectable. */ shouldSelect?: boolean; /** * Custom style for the container of the left (head) view. */ headViewContainerStyle?: StyleProp<ViewStyle>; /** * Custom style for the container of the trailing view. */ trailingViewContainerStyle?: StyleProp<ViewStyle>; /** * Custom style for the container wrapping title and subtitle. */ titleSubtitleContainerStyle?: StyleProp<ViewStyle>; /** * Indicates if the item is selected. */ selected?: boolean; statusIndicatorStyle?: DeepPartial<CometChatTheme['statusIndicatorStyle']>; } /** * CometChatListItem renders a single item in the list. * It displays an avatar with an optional status indicator, title, subtitle, and trailing view. * * @param {CometChatListItemInterface} props - Props for the list item. * @returns {JSX.Element} The rendered list item. */ export declare const CometChatListItem: React.MemoExoticComponent<(props: CometChatListItemInterface) => React.JSX.Element>;