Skip to main content
This is a beta version. Features and documentation may change.
Version: v5

Call Logs

Overview

CometChatCallLogs is a Component that shows the list of Call Logs available. By default, names are shown for all listed users, along with their avatars if available.

Image

Usage

Integration

CometChatCallLogs being a wrapper component, offers versatility in its integration. It can be seamlessly launched via button clicks or any user-triggered action, enhancing the overall user experience and facilitating smoother interactions within the application.

import { CometChatCallLogs } from "@cometchat/chat-uikit-react-native";
//code
return <CometChatCallLogs></CometChatCallLogs>;

Actions

Actions dictate how a component functions. They are divided into two types: Predefined and User-defined. You can override either type, allowing you to tailor the behavior of the component to fit your specific needs.

onItemPress

onItemPress is triggered when you click on a ListItem of the Call Logs component. By default it initiate a call to the participant associated with the respective ListItem. You can override this action using the following code snippet.

import { CometChatCallLogs } from "@cometchat/chat-uikit-react-native";
//code
const getItemPresshandler = (call: any) => {
//code
};
return (
<CometChatCallLogs onItemPress={getItemPresshandler}></CometChatCallLogs>
);

onCallIconPress
import { CometChatCallLogs } from "@cometchat/chat-uikit-react-native";
import { CometChat } from "@cometchat/chat-sdk-react-native";
//code
const getOnCallIconPressHandler = (call: any) => {
//handle call icon press
};

return (
<CometChatCallLogs
onCallIconPress={getOnCallIconPressHandler}
></CometChatCallLogs>
);

onBack

onBack is triggered when you press the back button in the app bar. You can override this action using the following code snippet.

import { CometChatCallLogs } from "@cometchat/chat-uikit-react-native";
//code
const onBackHandler = () => {
//handle back
};

return <CometChatCallLogs onBack={onBackHandler}></CometChatCallLogs>;

OnError

This action doesn't change the behavior of the component but rather listens for any errors that occur in the callLogs component.

import { CometChatCallLogs } from "@cometchat/chat-uikit-react-native";
import { CometChat } from "@cometchat/chat-sdk-react-native";
//code
const onErrorHandler = (e: CometChat.CometChatException) => {
//handle back
};

return <CometChatCallLogs onError={onErrorHandler}></CometChatCallLogs>;

Filters

Filters allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.

CallLogRequestBuilder

The CallLogRequestBuilder enables you to filter and customize the Call Log based on available parameters in CallLogRequestBuilder. This feature allows you to create more specific and targeted queries when fetching the call logs. The following are the parameters available in CallLogRequestBuilder

MethodsTypeDescription
setLimitnumberSpecifies the number of call logs to fetch.
setCallTypeStringSets the type of calls to fetch (call or meet).
setCallStatuscallStatusSets the status of calls to fetch (initiated, ongoing, etc.)
setHasRecordingbooleanSets whether to fetch calls that have recordings.
setCallCategorystringSets the category of calls to fetch (call or meet).
setCallDirectionstringSets the direction of calls to fetch (incoming or outgoing)
setUidstringSets the UID of the user whose call logs to fetch.
setGuidstringSets the GUID of the user whose call logs to fetch.
setAuthTokenstringSets the Auth token of the logged-in user.

Example

In the example below, we're filtering Call Logs to show only canceled calls and setting the limit to five.

import {
CometChat,
CometChatCalls,
CallLogRequestBuilder,
} from "@cometchat/chat-sdk-react-native";
import { CometChatCallLogs } from "@cometchat/chat-uikit-react-native";

function App(): React.JSX.Element {
const [loggedInUser, setLoggedInUser] = useState<CometChat.User>();
useEffect(() => {
//code
CometChatUIKit.login({ uid: "uid" })
.then(async (user: CometChat.User) => {
setLoggedInUser(user);
})
.catch((error: any) => {
//handle error
});
}, []);

return (
<>
{loggedInUser && (
<CometChatCallLogs
hideBackButton={true}
callLogRequestBuilder={new CallLogRequestBuilder()
.setLimit(5)
.setCallStatus("cancelled")
.setAuthToken(loggedInUser.getAuthToken())}
/>
)}
</>
);
}

Events

Events are emitted by a Component. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.

The CometChatCallLogs component does not have any exposed events.


Customization

To fit your app's design requirements, you can customize the appearance of the CallLog component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.

Style

Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.

import { CometChatCallLogs } from "@cometchat/chat-uikit-react-native";
//code
return (
<CometChatCallLogs
hideBackButton={true}
style={{
titleSeparatorStyle: {
borderBottomColor: "#F76808",
},
titleTextStyle: {
color: "#F76808",
},
itemStyle: {
avatarStyle: {
containerStyle: {
borderRadius: 8,
backgroundColor: "#FBAA75",
},
imageStyle: {
borderRadius: 8,
},
},
},
}}
></CometChatCallLogs>
);
Image

Functionality

These are a set of small functional customizations that allow you to fine-tune the overall experience of the component. With these, you can change text, set custom icons, and toggle the visibility of UI elements.

PropertyDescriptionCode
datePatternUsed to set custom date patterndatePattern?: DatePattern
hideBackButtonUsed to show/hide the back buttonhideBackButton?: boolean
hideErrorUsed to hide errorshideError?: boolean
outgoingCallConfigurationSets the configurations for outgoing call component.outgoingCallConfiguration={outgoingCallConfigurationObject}

Advanced

For advanced-level customization, you can set custom views to the component. This lets you tailor each aspect of the component to fit your exact needs and application aesthetics. You can create and define your views, layouts, and UI elements and then incorporate those into the component.

LoadingView

Allows setting a custom loading view when fetching call logs.

Use Cases:

  • Display a spinner animation while loading.
  • Show a "Fetching Call History..." message.
  • Use a shimmer effect for better UI experience.
import { CometChatCallLogs } from "@cometchat/chat-uikit-react-native";
//code
const getLoadingView = () => {
//return jsx;
};
return <CometChatCallLogs LoadingView={getLoadingView}></CometChatCallLogs>;

EmptyView

Defines a custom view when no call logs are available.

Use Cases:

  • Show a friendly message like "No calls yet!".
  • Offer quick actions like "Make a Call".
  • Display an illustration/image.
import { CometChatCallLogs } from "@cometchat/chat-uikit-react-native";
//code
const getEmptyView = () => {
//return jsx;
};
return <CometChatCallLogs EmptyView={getEmptyView}></CometChatCallLogs>;

ErrorView

Allows setting a custom error state view when fetching call logs fails.

Use Cases:

  • Display a retry button.
  • Show a network issue message.
  • Provide a troubleshooting guide.
import { CometChatCallLogs } from "@cometchat/chat-uikit-react-native";
//code
const getErrorView = (e: CometChat.CometChatException) => {
//return jsx;
};
return <CometChatCallLogs ErrorView={getErrorView}></CometChatCallLogs>;

ItemView

Allows setting a custom layout for each call log item.

Use Cases:

  • Customize the entire call log card.
  • Display additional contact details.
  • Use a two-column design for better readability.
import { CometChatCallLogs } from "@cometchat/chat-uikit-react-native";
//code
const getItemView = (call: any) => {
//return jsx;
};
return <CometChatCallLogs ItemView={getItemView}></CometChatCallLogs>;
Image

TitleView

Allows setting a custom title view, typically used for the caller’s name or number.

Use Cases:

  • Display caller’s full name.
  • Show a business label for saved contacts.
  • Use bold text for unknown numbers.
import { CometChatCallLogs } from "@cometchat/chat-uikit-react-native";
//code
const getTitleView = (call: any) => {
//return jsx;
};
return <CometChatCallLogs TitleView={getTitleView}></CometChatCallLogs>;

LeadingView

Customizes the leading view, usually the caller’s avatar or profile picture.

Use Cases:

  • Display a profile picture.
  • Show a call type icon (missed, received, dialed).
  • Indicate call status (e.g., missed calls in red).
import { CometChatCallLogs } from "@cometchat/chat-uikit-react-native";
//code
const getLeadingView = (call: any) => {
//return jsx;
};
return <CometChatCallLogs LeadingView={getLeadingView}></CometChatCallLogs>;

SubtitleView

Enables customizing the subtitle view, usually used for additional call details.

Use Cases:

  • Display call type (Missed, Received, Outgoing).
  • Show network strength indicators.
  • Include call duration in a more readable format.
import { CometChatCallLogs } from "@cometchat/chat-uikit-react-native";
//code
const getSubtitleView = (call: any) => {
//return jsx;
};
return <CometChatCallLogs SubtitleView={getSubtitleView}></CometChatCallLogs>;

Example

Image

TrailingView

Customizes the trailing section, typically for call duration or actions.

Use Cases:

  • Display call duration.
  • Add a "Call Again" button.
  • Show call timestamps.
import { CometChatCallLogs } from "@cometchat/chat-uikit-react-native";
//code
const getTrailingView = (call: any) => {
//return jsx;
};
return <CometChatCallLogs TrailingView={getTrailingView}></CometChatCallLogs>;

Example

Image

AppBarOptions

You can set Custom AppBarOptions to the CometChatConversations widget.

Use Cases:

  • Filter Call Logs
import { CometChatCallLogs } from "@cometchat/chat-uikit-react-native";
//code
const getAuxiliaryAppBarOptions = (): JSX.Element => {
return (
<TouchableOpacity
style={styles.button}
onPress={() => {
/* code */
}}
>
<Image source={FilterIcon} style={styles.image} />
</TouchableOpacity>
);
};
return (
<CometChatCallLogs
AppBarOptions={getAuxiliaryAppBarOptions}
></CometChatCallLogs>
);