UNPKG

@cometchat/chat-uikit-react-native

Version:

Ready-to-use Chat UI Components for React Native

120 lines (119 loc) 4.63 kB
import React, { JSX } from "react"; import { ColorValue, GestureResponderEvent, ImageSourcePropType, ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native"; import { CometChat } from "@cometchat/chat-sdk-react-native"; import { CometChatTheme } from "../../../theme/type"; import { DeepPartial } from "../../helper/types"; import { CometChatStatusIndicatorInterface, StatusIndicatorStyles } from "../CometChatStatusIndicator"; export interface CometChatListActionsInterface { updateList: (prop: any) => void; updateAndMoveToFirst: (item: any) => void; addItemToList: (item: any, position?: number) => void; removeItemFromList: (itemId: string | number) => void; getListItem: (itemId: string | number) => any; getSelectedItems: () => Array<any>; getAllListItems: () => Array<any>; } export interface CometChatListStylesInterface { containerStyle: ViewStyle; onlineStatusColor?: ColorValue; separatorColor?: string; loadingIconTint?: ColorValue; sectionHeaderTextStyle?: TextStyle; confirmSelectionStyle: { icon?: ImageSourcePropType | JSX.Element; iconStyle?: ImageStyle; iconContainerStyle?: ImageStyle; }; selectionCancelStyle: { icon?: ImageSourcePropType | JSX.Element; iconStyle?: ImageStyle; iconContainerStyle?: ImageStyle; }; titleSeparatorStyle: ViewStyle; searchStyle?: { textStyle: TextStyle; placehodlerTextStyle?: TextStyle; containerStyle: ViewStyle; icon?: ImageSourcePropType | JSX.Element; iconStyle: ImageStyle; }; titleStyle: TextStyle; titleViewStyle?: ViewStyle; backButtonIcon?: ImageSourcePropType | JSX.Element; backButtonIconStyle: ImageStyle; itemStyle: { avatarStyle: CometChatTheme["avatarStyle"]; containerStyle: ViewStyle; titleStyle: TextStyle; subtitleStyle: TextStyle; statusIndicatorStyle?: Partial<StatusIndicatorStyles>; headViewContainerStyle?: StyleProp<ViewStyle>; titleSubtitleContainerStyle?: StyleProp<ViewStyle>; trailingViewContainerStyle?: StyleProp<ViewStyle>; }; emptyStateStyle: Partial<{ titleStyle: TextStyle; subTitleStyle: TextStyle; containerStyle: ViewStyle; icon: ImageSourcePropType | JSX.Element; iconStyle?: ImageStyle; iconContainerStyle?: ViewStyle; }>; errorStateStyle: Partial<{ titleStyle: TextStyle; subTitleStyle: TextStyle; containerStyle: ViewStyle; icon: ImageSourcePropType | JSX.Element; iconStyle?: ImageStyle; iconContainerStyle?: ViewStyle; }>; headerContainerStyle?: ViewStyle; backButtonIconContainerStyle: ViewStyle; } export interface CometChatListProps { ItemView?: (item: any) => JSX.Element; LeadingView?: (item: any) => JSX.Element; TitleView?: (item: any) => JSX.Element; SubtitleView?: (item: any) => JSX.Element; TrailingView?: (item: any) => JSX.Element; disableUsersPresence?: boolean; AppBarOptions?: React.FC; searchPlaceholderText?: string; hideBackButton?: boolean; selectionMode?: "none" | "single" | "multiple"; onSelection?: (list: any) => void; onSubmit?: (list: any) => void; hideSearch?: boolean; hideHeader?: boolean; title?: string; EmptyView?: React.FC; emptyStateText?: string; errorStateText?: string; ErrorView?: React.FC; LoadingView?: React.FC; requestBuilder?: any; searchRequestBuilder?: any; hideError?: boolean; onItemPress?: (user: any) => void; onItemLongPress?: (user: any, e: GestureResponderEvent) => void; onError?: (error: CometChat.CometChatException) => void; onBack?: (() => void) | undefined; listItemKey: "uid" | "guid" | "conversationId"; listStyle?: DeepPartial<CometChatListStylesInterface>; hideSubmitButton?: boolean; statusIndicatorType?: (item: any) => CometChatStatusIndicatorInterface["type"] | null; hideStickyHeader?: boolean; /** * Called once the list has been fetched or updated. * Returns the final array of items currently in the list. */ onListFetched?: (fetchedList: any[]) => void; } /** * @class Users is a component useful for displaying the header and users in a list * @description This component displays a header and list of users with subtitle,avatar,status * @Version 1.0.0 * @author CometChat * */ export declare const CometChatList: React.ForwardRefExoticComponent<CometChatListProps & React.RefAttributes<CometChatListActionsInterface>>;