Skip to content

AllmaxTeam/react-native-message-row

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

react-native-message-row

Component for displayng chat messages. Recommended using in ListView.

screen

Installation

npm install AllmaxTeam/react-native-message-row.git --save

Usage

renderRow(message, sectionId, rowId) {
        const { currentUser } = this.props
        const isFromCurrentUser = message.from.id === currentUser.id
        const color = isFromCurrentUser ? '#75ADFF' : 'white'
        const avatarURL = message.from.avatar
        let avatarSource
        if (avatarURL) {
            avatarSource = {uri: avatarURL}
        }
        return (
            <MessageRow
                isFromCurrentUser={isFromCurrentUser}
                avatarSource={avatarSource}
                text={message.text}
                color={color}
                headerText={Moment(message.date).fromNow()}
            />
        )
    }

Default props

MessageRow.defaultProps = {
    isFromCurrentUser: false,
    headerText: '',
    headerTextStyle: {},
    avatarSize: 40,
    arrowSize: 8,
    color: 'white',
    borderRadius: 8,
    contentViewPadding: 8,
    text: '',
    avatarSource: null
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •