react-web-gifted-chat
react-web-gifted-chat copied to clipboard
Not able to update the state of single chat
Issue Description
Adding chat messages by simply pushing them in GiftedChat works. But when I update single value in some chat (i.e sent = true), it doesn't reflect the change. Currently what i am doing to updated the chat messages is :
updateStateOfChat = chat => {
this.setState(previousState => ({
messages: GiftedChat.append( [], previousState.messages.map(m => {
if (m.id === chat.id) {
return {...m, sent: chat.sent};
}
return m;
}))
}));
};
Steps to Reproduce / Code Snippets
Call the setState on any chat.
Expected Results
It should re-render the chat message that is updated.
Additional Information
- Nodejs version: 10.15.3
- React version: 16.9.0
- react-web-gifted-chat version: 0.6.7
- Browser(s) (Chrome, etc.): Chrome
Were you able to find a work-around for this? I looked through the code and couldn't find anyway to re-render the message.