Message Header
Overview
MessageHeader
is a Component that showcases the User or Group details in the toolbar. Furthermore, it also presents a typing indicator and a back navigation button for ease of use.

Usage
Integration
You can add CometChatMessageHeader
component directly into the `layout.xml`` file.
- App.tsx
import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
//code
return <CometChatMessageHeader group={group}></CometChatMessageHeader>;
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.
The MessageHeader
component does not have any exposed actions.
onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Users component.
- App.tsx
import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
//code
return (
<CometChatMessageHeader
group={group}
onError={(error: CometChat.CometChatException) => {
//handle error
}}
></CometChatMessageHeader>
);
onBack
onBack
is triggered when you press the back button in the app bar. It has a predefined behavior; when clicked, it navigates to the previous activity. However, you can override this action using the following code snippet.
- App.tsx
import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
//code
return (
<CometChatMessageHeader
group={group}
onBack={() => {
//handle back
}}
></CometChatMessageHeader>
);
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 MessageHeader
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 MessageHeader
component does not produce any events.
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.

- App.tsx
import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
//code
return (
<CometChatMessageHeader
group={group}
style={{
avatarStyle: {
containerStyle: {
borderRadius: 8,
backgroundColor: "#FBA46B",
},
imageStyle: {
borderRadius: 8,
},
},
titleTextStyle: {
color: "#F76808",
},
callButtonStyle: {
audioCallButtonIconStyle: {
tintColor: "#F76808",
},
videoCallButtonIconStyle: {
tintColor: "#F76808",
},
},
}}
></CometChatMessageHeader>
);
To know more such attributes, visit the attributes file.
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.
Following is a list of customizations along with their corresponding code snippets:
Property | Description | Code |
---|---|---|
user | Used to pass user object of which header specific details will be shown | user={chatUser} |
group | Used to pass group object of which header specific details will be shown | group={chatGroup} |
hideBackButton | Used to toggle back button visibility | hideBackhideBackhideBackButtonIconButton={true} |
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.
AuxiliaryButtonView
Allows adding custom buttons that replace the default call buttons.
Use Cases:
- Add a Call button (📞) for quick voice/video calls.
- Include a Block/Report button for moderation.
- Implement a Pin Chat feature.
- App.tsx
import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
import { CometChat } from "@cometchat/chat-sdk-react-native";
//code
return (
<CometChatMessageHeader
group={group}
AuxiliaryButtonView={({
user,
group,
}: {
user?: CometChat.User;
group?: CometChat.Group;
}) => {
return (
<TouchableOpacity
onPress={() => {
//do something
}}
>
<Text>Custom Button</Text>
</TouchableOpacity>
);
}}
></CometChatMessageHeader>
);
ItemView
Enables replacing the entire default header with a fully customized ListItem layout.
Use Cases:
- Create a completely unique message header style.
- Include additional user details like bio, location, or last seen status.
- App.tsx
import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
import { CometChat } from "@cometchat/chat-sdk-react-native";
//code
const getItemView = ({
user,
group,
}: {
user?: CometChat.User;
group?: CometChat.Group;
}) => {
//your custom item view
//return jsx;
};
return (
<CometChatMessageHeader
group={group}
ItemView={getItemView}
></CometChatMessageHeader>
);
SubtitleView
Allows customizing the subtitle view, usually used for status messages or additional details.
Use Cases:
- Show the user's last seen or online status.
- Display a custom typing indicator.
- Show a custom role or tagline ("Customer Support", "Verified Seller").
- App.tsx
import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
import { CometChat } from "@cometchat/chat-sdk-react-native";
//code
const getSubtitleView = ({
user,
group,
}: {
user?: CometChat.User;
group?: CometChat.Group;
}) => {
//your custom Subtitle view
//return jsx;
};
return (
<CometChatMessageHeader
group={group}
SubtitleView={getSubtitleView}
></CometChatMessageHeader>
);
Example

LeadingView
Defines a custom leading view, typically used for the receiver's profile picture or avatar.
Use Cases:
- Display a circular profile picture with a status indicator.
- Add a custom badge for special roles (Admin, Verified ✅).
- App.tsx
import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
import { CometChat } from "@cometchat/chat-sdk-react-native";
//code
const getLeadingView = ({
user,
group,
}: {
user?: CometChat.User;
group?: CometChat.Group;
}) => {
//your custom Leading view
//return jsx;
};
return (
<CometChatMessageHeader
group={group}
LeadingView={getLeadingView}
></CometChatMessageHeader>
);
Example

TrailingView
Enables customization of the trailing view which gets added next to the call buttons.
Use Cases:
- Add an options menu (⋮) for more actions.
- Display a mute/unmute toggle.
- Show a connection strength indicator for calls.
- App.tsx
import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
import { CometChat } from "@cometchat/chat-sdk-react-native";
//code
const getTrailingView = ({
user,
group,
}: {
user?: CometChat.User;
group?: CometChat.Group;
}) => {
//your custom Trailing view
//return jsx;
};
return (
<CometChatMessageHeader
group={group}
TrailingView={getTrailingView}
></CometChatMessageHeader>
);
Example
