AI Integration Quick Reference
AI Integration Quick Reference
| Field | Value |
|---|---|
| Package | @cometchat/chat-uikit-react-native |
| Key class | CometChatUrlsFormatter (extends CometChatTextFormatter) |
| Required setup | CometChatUIKit.init(UIKitSettings) then CometChatUIKit.login("UID") |
| Purpose | Auto-detects URLs, emails, and phone numbers in text messages and converts them to clickable links |
| Sample app | GitHub |
| Related | Custom Text Formatter · Mentions Formatter · All Guides |
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
| Feature | Description |
|---|---|
| URL detection | Automatically detects HTTP/HTTPS URLs |
| Email detection | Detects email addresses and opens mail client |
| Phone detection | Detects phone numbers and opens dialer |
| Custom styling | Customize link text color and font |
| Native linking | Uses React Native Linking API for native behavior |
Usage
TheCometChatUrlsFormatter is included by default in the UI Kit. You can also create a custom instance with custom styling:
- TypeScript
Customization
Styling Links
Use thesetStyle method to customize link appearance:
Style Properties
| Property | Type | Description |
|---|---|---|
linkTextColor | ColorValue | Color of the link text |
linkTextFont | TextStyle | Font styling for link text (fontSize, fontWeight, etc.) |
How It Works
TheCometChatUrlsFormatter uses regex patterns to detect:
- URLs: HTTP and HTTPS links
- Emails: Email addresses (opens
mailto:link) - Phone numbers: Phone numbers (opens
tel:link)
Linking API to open the appropriate handler: