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

Call Buttons

Overview

The CometChatCallButtons is a Component provides users with the ability to make calls, access call-related functionalities, and control call settings. Clicking this button typically triggers the call to be placed to the desired recipient.

Image

Usage

Integration

The CometChatCallButtons is a Component provides users with the ability to make calls, access call-related functionalities, and control call settings. Clicking this button typically triggers the call to be placed to the desired recipient.

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

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.

onError

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

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

const onErrorHandler = (error: CometChat.CometChatException) => {
//handle Error
};

return <CometChatCallButtons user={user} onError={onErrorHandler} />;

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.

The CometChatCallButtons component does not have any exposed filters.


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 list of events emitted by the Call Buttons component is as follows.

EventDescription
ccCallRejectedThis event is triggered when the initiated call is rejected by the receiver.
ccCallFailledThis event is triggered when an error occurs during the intiated call.
ccOutgoingCallThis event is triggered when the user initiates a voice/video call.
import { CometChatUIEventHandler } from "@cometchat/chat-uikit-react-native";

CometChatUIEventHandler.addCallListener("CALL_LISTENER_ID", {
ccCallRejected: ({ call }) => {
//code
},
});

CometChatUIEventHandler.addCallListener("CALL_LISTENER_ID", {
ccOutgoingCall: ({ call }) => {
//code
},
});

CometChatUIEventHandler.addCallListener("CALL_LISTENER_ID", {
ccCallFailled: ({ call }) => {
//code
},
});

import { CometChatUIEventHandler } from "@cometchat/chat-uikit-react-native";

CometChatUIEventHandler.removeCallListener("CALL_LISTENER_ID");

Customization

To fit your app's design requirements, you can customize the appearance of the conversation 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 {
CometChatCallButtons,
useTheme,
} from "@cometchat/chat-uikit-react-native";
//code
const theme: CometChatTheme = useTheme();
//more code
return (
<CometChatCallButtons
group={group}
style={{
audioCallButtonIconStyle: {
tintColor: theme.color.primary,
},
audioCallButtonIconContainerStyle: {
backgroundColor: theme.color.extendedPrimary100,
paddingHorizontal: theme.spacing.padding.p4,
paddingVertical: theme.spacing.padding.p2,
borderRadius: 8,
},
videoCallButtonIconStyle: {
tintColor: theme.color.primary,
},
videoCallButtonIconContainerStyle: {
backgroundColor: theme.color.extendedPrimary100,
paddingHorizontal: theme.spacing.padding.p4,
paddingVertical: theme.spacing.padding.p2,
borderRadius: 8,
},
}}
></CometChatCallButtons>
);
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.

Below is a list of customizations along with corresponding code snippets

PropertyDescriptionCode
groupUsed to set the group object for Call Buttonsgroup?: CometChat.Group
userSets the user object for Call Buttonsuser?: CometChat.User
hideVoiceCallUsed to hide Voice Call`hideVoiceCall?: boolean
hideVideoCallUsed to hide Video Call`hideVideoCall?: boolean
callSettingsBuilderSets the call settings builder callback function. This callback is responsible for configuring the call settings based on the user, group, and call type (audio/video).callSettingsBuilder={callSettingsBuilderObject}
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.

The CometChatCallButtons component does not provide additional functionalities beyond this level of customization.


Configurations

Configurations offer the ability to customize the properties of each individual component within a Composite Component.

  • Configurations expose properties that are available in its individual components.

Outgoing Call

You can customize the properties of the Outgoing Call component by making use of the OutgoingCallConfiguration. You can accomplish this by employing the OutgoingCallConfiguration as demonstrated below:

import {
CometChatCallButtons,
OutgoingCallConfiguration,
} from "@cometchat/chat-uikit-react-native";
//code
const theme: CometChatTheme = useTheme();
//more code
const getOutgoingCallConfig = () => {
return new OutgoingCallConfiguration({
disableSoundForCalls: true,
});
};
return (
<CometChatCallButtons
user={user}
outgoingCallConfiguration={getOutgoingCallConfig()}
></CometChatCallButtons>
);

All exposed properties of OutgoingCallConfiguration can be found under Outgoing Call. Properties marked with the report symbol are not accessible within the Configuration Object.