Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renderUsernameOnMessage didn't work #22

Open
barak109 opened this issue Aug 4, 2020 · 1 comment
Open

renderUsernameOnMessage didn't work #22

barak109 opened this issue Aug 4, 2020 · 1 comment

Comments

@barak109
Copy link

barak109 commented Aug 4, 2020

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]
@leelandclay
Copy link

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} />;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants