Skip to main content
Available from UI Kit v6.1.1. This component requires cometchat_chat_uikit v6.1.1 or later, which depends on cometchat_sdk v5.0.7.
CometChatPinnedMessages lists the pinned messages of a single conversation. Each row renders the message as a read-only bubble, ordered newest-pinned-first. Tapping a row reports it through onItemTap so the host can jump its message list to that message, and long-pressing a row offers Unpin behind a confirmation dialog.

Where It Fits

The screen opens on the nearest Navigator, the same navigation threads use. On a desktop side-by-side layout that replaces only the chat column; on mobile it is a full-screen route. The usual entry point is the Pinned Messages item in CometChatMessageHeader’s ⋯ overflow menu, which pushes this screen for you. See Message Header for the props that control it.

Quick Start

Either call the show helper, which pushes the screen with the kit’s own transition, or embed the widget directly.
Pass one of user or group — the constructor asserts that at least one is set.

Actions and Events

Callback Methods

onItemTap

Fires when a row is tapped. When showBackButton is true (the default), the screen asks its route to pop first, so the host lands on the message with the list already gone. Pair it with CometChatMessageListController.jumpToMessage to land on the message without remounting the list.

Unpin

Long-pressing a row opens an Unpin message? confirmation, then unpins the message and shows a “Message unpinned” toast. The kit does not decide who may unpin — the server does. A rejected call (ERR_PERMISSION_DENIED, ERR_UNAUTHORIZED or ERR_FORBIDDEN) shows “You don’t have permission to perform this action.” Set hideUnpinOption: true to turn the long-press off.

Real-Time Updates (Automatic)

The list stays current without a refetch. No setup needed. The list is fetched once on open, 100 at a time until exhausted, with a Retry action if the fetch fails and an empty state (“No pinned messages yet”) when there are none.

Functionality

The show helper takes the same parameters after context. When the Message Header opens the screen for you, it forwards only user, group, onItemTap (from onPinnedMessageItemTap) and style (from pinnedMessagesStyle) — to set hideUnpinOption or the layout flags, handle onPinnedMessagesTap and call show yourself.

Style

Rows are real message bubbles, so they follow your bubble styling. CometChatPinnedMessagesStyle styles the screen around them:
On v6.1.1, appBarColor and unpinIconColor are declared but have no visible effect — upgrade to v6.2.0 to use them. The class also declares itemTitleTextStyle, itemSubtitleTextStyle, itemDateTextStyle and borderRadius, which no release up to v6.2.0 applies, because rows are drawn as message bubbles.

Next Steps

Pin & Save Messages Guide

Wire the pinned and saved screens into your app

Saved Messages

The logged-in user’s private saved list

Message List

The Pin / Unpin options and jump-to-message

Pin A Message (SDK)

The SDK APIs underneath