Skip to main content
CometChatUrlsFormatter extends CometChatTextFormatter to detect URLs, email addresses, and phone numbers in text messages and render them as clickable links using React Native’s Linking API.

Features


Usage

The CometChatUrlsFormatter is included by default in the UI Kit. You can also create a custom instance with custom styling:

Customization

Use the setStyle method to customize link appearance:

Style Properties


How It Works

The CometChatUrlsFormatter uses regex patterns to detect:
  1. URLs: HTTP and HTTPS links
  2. Emails: Email addresses (opens mailto: link)
  3. Phone numbers: Phone numbers (opens tel: link)
When a link is tapped, it uses React Native’s Linking API to open the appropriate handler:

Combining with Other Formatters

You can use multiple formatters together. The order matters — formatters are applied in sequence:

Next Steps

Custom Text Formatter

Build custom inline text patterns.

Mentions Formatter

Add @mentions with styled tokens.

All Guides

Browse all feature and formatter guides.

Sample App

Full working sample application on GitHub.