Skip to main content

Location Message

Message Box

Message Box

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

However you have to specify type for them.

Esra

Example Usage

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

<MessageBox
position={"left"}
type={"location"}
title={"Esra"}
src="https://cdn.pixabay.com/photo/2016/03/22/04/23/map-1272165_1280.png"
data={{
latitude: "39.74047838338539",
longitude: "37.01549275396775"
}}
/>

Result

Esra

Location Message Props

ILocationMessageProps (extends ILocationMessage)

propsdefaulttypedescription
markerColornonestringlocation message marker color
zoomnonestringlocation message zoom
apiKeynonestringlocation message apiKey
classNamenonestringclassName for optional location message
srcnonestringlocation message src
targetnonestringlocation message target
hrefnonestringlocation message href
onOpennonefunctionlocation message onOpen event (onClick)
onErrornonefunctionlocation message (img) onError event

ILocationMessage (extends IMessage)

propsdefaulttypedescription
datanoneobjectcontains latitude, longitude, staticURL, mapURL (below)
latitudenonestringlatitude must be in data object
longitudenonestringlongitude must be in data object
staticURLnonestringstaticURL must be in data object
mapURLnonestringmapURL must be in data object (optional)

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