react-web-gifted-chat
react-web-gifted-chat copied to clipboard
renderUsernameOnMessage didn't work
Issue Description
Hi, i really love the way you update this react native app to be a web app- thank you for that !
My problem is when i tried to show username in the messages, and it didn't work.
Steps to Reproduce / Code Snippets
I used
renderBubble = (props: any) => {
return (
<Bubble renderUsernameOnMessage {...props}></Bubble>
);
};
And add it to GiftedChat and still didn't work, i think it's a bug
Expected Results
See the userName in messages
Additional Information
- Nodejs version: [12.18.1]
- React version: [16.3.1]
- react-web-gifted-chat version: [last- ^0.6.7]
- Browser(s) (Chrome, etc.): [Chrome]
I ran into the same problem. The way I resolved it was to modify the props of the bubble directly by adding a renderBubble={this.renderBubble} to the GiftedChat object. Then added this method to my class:
protected renderBubble = (props: BubbleProps<IMessage>) => {
props.renderUsernameOnMessage = true;
return <Bubble {...props} />;
};