Skip to main content
This guide walks you through creating a tab-based messaging UI using React and CometChat UIKit. The UI will include different sections for Chats, Calls, Users, and Groups, allowing seamless navigation.

User Interface Preview

This layout consists of:
  1. Sidebar (Conversation List) – Displays recent conversations with active users and groups.
  2. Message View – Shows the selected chat with real-time messages.
  3. Message Input Box – Allows users to send messages seamlessly.

Step-by-Step Guide

Step 1: Create a Tab Component

To manage navigation, let’s build a CometChatTabs component. This component will render different tabs and allow switching between sections dynamically.

Folder Structure

Create a TabbedActivity inside your src directory and add the following files:

Download the Icons

These icons are available in the CometChat UI Kit res folder. You can find them at:
🔗 GitHub Assets Folder

Implementation

TabbedActivity.kt
You must use an activity that supports the lifecycle API, such as:
  • AppCompatActivity
  • ComponentActivity
  • FragmentActivity
This is necessary to properly manage the UI Kit’s lifecycle events.

Step 3: Create Fragments for Chat, Calls, Users and Groups

Chats Fragment

ChatsFragment.kt

Call Logs Fragment

Make sure you’ve added the Calls SDK dependency to enable voice and video calling features.
CallLogsFragment.kt

Users Fragment

UsersFragment.kt

Groups Fragment

GroupsFragment.kt

Step 3: Update MainActivity

Update the MainActivity to navigate to the MessageActivity:
MainActivity.kt

Running the Project

Once the components are configured, build and run the app:
Ensure you’ve added the necessary permissions and initialized CometChat in your Application class.

Next Steps

Enhance the User Experience