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

MessageText & renderText for stream-chat-react? #121

Closed
lr-mjaouen opened this issue Jan 7, 2020 · 5 comments
Closed

MessageText & renderText for stream-chat-react? #121

lr-mjaouen opened this issue Jan 7, 2020 · 5 comments

Comments

@lr-mjaouen
Copy link

lr-mjaouen commented Jan 7, 2020

Hello,

Is there something like MessageText & renderText GetStream/stream-chat-react-native#62 in stream-chat-react in order to parse custom text and keep the defaults one (links for instance)?
And actually anything for custom commands or an example for https://getstream.github.io/stream-chat-react/#chatautocomplete?
Thank you!

@jaapbakker88
Copy link
Contributor

Hi @lr-mjaouen right now we don't support this. We're working on v2 of the library and I'll make sure to put this on the list. The easiest way to do this right now is to built your own message component.

@lr-mjaouen
Copy link
Author

lr-mjaouen commented Jan 8, 2020

@jaapbakker88 thank you. In order to pass a custom prop in a message and display it in a CustomMessage component what's the best way for the Input? Right now I use a custom handleSubmit function but I can't reset the state once the message sent.

    const handleSubmit = async (event: any) => {
        event.preventDefault();
        const response = await props.channel.sendMessage({
            text: event.target.innerHTML,
            annotation: currentTime,
        });

       // does not clear the input
       event.target.value = '';
       const changeEvent = new Event('change');
       event.target.dispatchEvent(changeEvent); 
    };

Should I use something else?

@lr-mjaouen
Copy link
Author

(I extended the MessageInput component, I didn't find an other way to do it)

@jaapbakker88
Copy link
Contributor

jaapbakker88 commented Jan 9, 2020

@lr-mjaouen yeah right now that's probably the best way, this might also be something we want to think about for v2

@lr-mjaouen
Copy link
Author

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