Skip to main content
CometChatFlagMessage is the dialog a user reports a message with: a title with a close button, a description, your app’s flag reasons as chips, an optional remark, and Cancel / Report, centred over a 40 % scrim. The message list opens it from the Report option on someone else’s message. You can also present it yourself.
CometChatFlagMessage showing report reasons, an optional remark and the Report button

Where It Fits

The dialog opens at once with no chips; the reasons arrive when CometChat answers. Flag reasons are configured in your CometChat dashboard’s moderation settings. The message list presents the dialog itself, flags the message on Report, dismisses it on success and shows its error line on failure. From the list you choose whether the option and the remark field show:
The list passes nothing else to the dialog. Style it through the theme and the slot modifiers under Custom View Slots, which reach the list’s dialog too.

Quick Start

CometChatFlagMessage is a View. Present it full screen over a clear background. With no onReportClick, the dialog flags the message itself, closes through onDismiss when that succeeds and shows its error line when it fails:
onCloseClick (the X) and onDismiss (a tap on the scrim, or a successful report) fall back to onCancelClick. A tap on the scrim does nothing unless dismissOnClickOutside is true.

What It Shows

The spam, sexual and harassment reasons read “Spam / Unwanted Content”, “Sexual Content” and “Harassment / Bullying”. Other reasons show the name your dashboard gives them. While the reasons load, or if fetching them fails, there are no chips and Report cannot be tapped.
Hide the remark and its title with showRemarkField: false. Translate or rename any reason with localizationMap, keyed by the reason’s id in lower case:
The five texts can be replaced with title, description, remarkHint, cancelButtonText and reportButtonText. An empty string shows an empty line.
On iOS 26 the card is Liquid Glass when the render path is .glass (the default) and Reduce Transparency is off. Everywhere else, including iOS 18–25, it is an opaque card.
The scrim, the 18 pt corners and everything inside the card are the same on both:

Actions and Events

Callback Methods

To flag the message yourself, take the SDK’s FlagDetail from onReportClick and drive the dialog’s spinner and error line:

Functionality

Reasons are fetched every time the dialog opens.

Custom View Slots

Replace the title line, the chips, the remark or the buttons, for every flag-message dialog in a subtree — the list’s included. Each closure gets the values the default region uses:
The reasons view gets the reasons, the selected id and onSelect(id); the remark view a Binding<String>. Without onSelect, nothing can be selected and Report stays disabled. The modifiers are cometChatFlagMessageTitleView, cometChatFlagMessageReasonsView, cometChatFlagMessageRemarkView and cometChatFlagMessageFooterView.

Advanced Methods

Store Access

CometChatFlagMessageStore fetches the reasons and holds the selection and the remark. Pass your own to preview the dialog without a session:
A seeded store never fetches and never reports.

Subclassing

CometChatFlagMessage is a View struct. Customise it with its parameters, slot modifiers and style.

Objective-C

In the UIKit toolkit: The dialog, FlagMessageStyle and the delegate are @objc. set(reasons:), flagReasonLocalizer, set(store:) and the closure setters are Swift-only — the SDK’s FlagReason and FlagDetail are not visible to Objective-C:

Accessibility

In the SwiftUI toolkit:
  • The card reads as “Flag Message Dialog” and is modal: VoiceOver does not read the chat behind it. The X reads as “Close”.
  • Each chip is a button, marked selected when it is. Report keeps its label while the spinner shows.
  • The error line is announced when it appears.

Style

CometChatFlagMessageStyle is sparse: set only what you change, and everything else follows the theme. backgroundColor and borderRadius apply only to the opaque card.
cancelButtonDisabledBackgroundColor and cancelButtonDisabledTextColor have no effect: Cancel is never disabled.

Next Steps

Message List

Presents the dialog from the Report option

Theming

The tokens the dialog’s defaults come from