{
created_at: '' ,
messageObject: { ... },
previews: {
bold: true,
text: 'This is the message preview text'
},
status: 0 | 1 | 2 // read states of latest message.
}
ChannelPreviewMessenger
Component to render a list item within the ChannelList
.
This is the default component provided to the prop Preview
on the ChannelList
component.
Props
channel
Instance of Channel from stream-chat package.
Type |
---|
Channel |
formatLatestMessageDate
Formatter function for date of latest message.
Returns a formatted date string. Default today’s date is shown in ‘HH:mm A’ format and other dates are displayed in ‘DD/MM/YY’ format. This default logic is part of ChannelPreview component.
Type |
---|
(date: Date) => string |
lastMessagePreview
Latest message on a channel, formatted for preview.
e.g.
Type |
---|
object |
maxUnreadCount
Max number to display within the unread notification badge. The value cannot exceed the backend limit of 255.
Type | Default |
---|---|
number | 255 |
onSelect
Function called when a user presses an item in the ChannelList
.
The function is called with the Channel
instance corresponding to the list item as the only parameter.
This callback is often used for navigating to a channel screen.
Example
onSelect={(channel) => { /** navigation logic */ }}
A Channel
instance is not serializable and will therefore raise warnings if passed as a parameter through navigation to another screen.
Type |
---|
function |
Parameter | Description |
---|---|
channel | Channel instance |
unread
Number of unread messages on the channel
Type |
---|
number |
PreviewAvatar
Avatar component rendered within Preview
.
Type | Default |
---|---|
component | ChannelAvatar |
PreviewMessage
Message component rendered within Preview
.
Type | Default |
---|---|
component | ChannelPreviewMessage |
PreviewStatus
Status component rendered within Preview
.
Type | Default |
---|---|
component | ChannelPreviewStatus |
PreviewTitle
Title component rendered within Preview
.
Type | Default |
---|---|
component | ChannelPreviewTitle |
PreviewUnreadCount
Unread count component rendered within Preview
.
Type | Default |
---|---|
component | ChannelPreviewUnreadCount |