Skip to main content

File Message

Message Box

Message Box

It is enough to define a message component with using "MessageBox".

However you have to specify type for them.

Kursat

Example Usage

import { MessageBox } from "react-chat-elements";

<MessageBox
position={"left"}
type={"file"}
title={"Esra"}
text="Sample PDF"
data={{
uri: "https://www.sample-videos.com/pdf/Sample-pdf-5mb.pdf",
status: {
click: false,
loading: 0,
},
}}
/>

Result

Esra

File Message Props

IFileMessageProps (extends IFileMessage)

propsdefaulttypedescription
onDownloadnonefunctionfile message onDownload function
onOpennonefunctionfile message onOpen event (onClick)

IFileMessage (extends IMessage)

propsdefaulttypedescription
datanoneobjectcontains name, extension, size, id, uri, status (below)
namenonestringname must be in data object (optional)
extensionnonestringextension must be in data object (optional)
sizenonestringsize must be in data object (optional)
idnonestringid must be in data object (optional)
urinonestringuri must be in data object (optional)
statusnoneobjectstatus must be in data object (optional) and contains autoDownload:boolean, error:boolean, download:Function|boolean, click:Function|boolean, loading:boolean|number

IMessage Props

propsdefaulttypedescription
idnonestring | numbermessage id
positionnonestringmessage position
textnonestringmessage text
titlenonestringmessage title
focusnonebooleanmessage focus
datenonenumber | Datemessage date
dateStringnonestringmessage date string
avatarnonestringmessage avatar
titleColornonestringmessage title color
forwardednonebooleanmessage forwarded
replyButtonnonebooleanmessage reply button
removeButtonnonebooleanmessage remove button
statusnone'waiting'| 'sent' | 'received' | 'read'message status
statusTitlenonestringmessage status title
notchnonebooleanmessage notch
copiableDatenonebooleanmessage copiable date
retractednonebooleanmessage retracted
classNamenonestringmessage className
letterItemnoneobjectmessage letterItem contains id:string, letter:ReactChild
replynoneobject | anymessage reply should be both any and object (contains message:string, photoURL:string)
typenonestringmessage type