UNPKG

@cometchat/chat-uikit-react-native

Version:

Ready-to-use Chat UI Components for React Native

86 lines (85 loc) 3.83 kB
import { CometChat } from "@cometchat/chat-sdk-react-native"; import { CometChatOutgoingCallInterface } from "../CometChatOutgoingCall"; import { DateHelper } from "../../shared/helper/dateHelper"; import { CometChatTheme } from "../../theme/type"; import { DeepPartial, ValueOf } from "../../shared/helper/types"; import { MenuItemInterface } from "../../shared/views/CometChatTooltipMenu"; import { JSX } from "react"; /** * Props for configuring the CometChatCallLogs component. * * @interface CometChatCallLogsConfigurationInterface */ export interface CometChatCallLogsConfigurationInterface { /** Custom component to render as the leading view for each call log item */ LeadingView?: (call?: any) => JSX.Element; /** Custom component to render as the title view for each call log item */ TitleView?: (call?: any) => JSX.Element; /** Custom component to render as the subtitle view for each call log item */ SubtitleView?: (call?: any) => JSX.Element; /** Custom component to render as the entire item view for each call log */ ItemView?: (call?: any) => JSX.Element; /** Custom component to render as the trailing view for each call log item */ TrailingView?: (call?: any) => JSX.Element; /** Custom options to render in the AppBar */ AppBarOptions?: () => JSX.Element; /** Builder for custom call log requests */ callLogRequestBuilder?: any; /** Date format pattern for call logs */ datePattern?: ValueOf<typeof DateHelper.patterns>; /** Flag to hide the back button in the header */ showBackButton?: boolean; /** Custom component to render when the call log list is empty */ EmptyView?: () => JSX.Element; /** Custom component to render in case of an error */ ErrorView?: (e: CometChat.CometChatException) => JSX.Element; /** Custom component to render while loading call logs */ LoadingView?: () => JSX.Element; /** Flag to hide the error view */ hideError?: boolean; /** Callback when the call icon is pressed */ onCallIconPress?: (item: any) => void; /** Callback for handling errors */ onError?: (e: CometChat.CometChatException) => void; /** Callback for when the back button is pressed */ onBack?: () => void; /** * Callback for when a call log item is pressed. * Receives the raw call log object. */ onItemPress?: (call: any) => void; /** Custom style overrides for the call logs */ style?: DeepPartial<CometChatTheme["callLogsStyles"]>; /** Configuration for outgoing calls */ outgoingCallConfiguration?: CometChatOutgoingCallInterface; /** Callback when the list is fetched and loaded */ onLoad?: (list: any[]) => void; /** Callback when the list is empty (no items) */ onEmpty?: () => void; /** Called on a long press of the default list item view */ onItemLongPress?: (prop: { call: any; }) => void; /** Hide the toolbar header */ hideHeader?: boolean; /** Hide the loading state */ hideLoadingState?: boolean; /** * A function to **append** more menu items on top of the default menu items for a call log. */ addOptions?: (call: any) => MenuItemInterface[]; /** * A function to **replace** the default menu items entirely for a call log. */ options?: (call: any) => MenuItemInterface[]; } /** * CometChatCallLogs component. * * This component displays a list of call logs with support for custom item views, * pull-to-refresh, error and empty states, as well as outgoing call initiation. * * @param {CometChatCallLogsConfigurationInterface} props - Component configuration props. * @returns {JSX.Element} The rendered call logs component. */ export declare const CometChatCallLogs: (props: CometChatCallLogsConfigurationInterface) => JSX.Element;