Skip to main content

Photo Message

Message Box

Message Box

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

However you have to specify type for them.

Emre
Esra

Example Usage

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

<MessageBox
position={"left"}
type={"photo"}
title={"Kursat"}
data={{
uri: "https://picsum.photos/200/200",
}}
/>

Result

Kursat

Photo Message Props

IPhotoMessageProps (extends IPhotoMessage)

propsdefaulttypedescription
onDownloadnonefunctionphoto message onDownload function (optional)
onOpennonefunctionphoto message onOpen function (optional)
onLoadnonefunctionphoto message onLoad function (optional)
onPhotoErrornonefunctionphoto message onPhotoError function (optional)

IPhotoMessage (extends IMessage)

propsdefaulttypedescription
datanoneobjectcontains uri, width, height, alt, status
urinonestringuri must be in data object
widthnonenumberwidth must be in data object
heightnonenumberheight must be in data object
altnonestringalt must be in data object
statusnoneobjectstatus must be in data object 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