chatscope / chat-ui-kit-react

Build your own chat UI with React components in few minutes. Chat UI Kit from chatscope is an open source UI toolkit for developing web chat applications.
https://chatscope.io
MIT License
1.25k stars 104 forks source link

Allow using send button when there is no message text #136

Open singpolyma opened 9 months ago

singpolyma commented 9 months ago

In my app sometimes a user can attach a file, then push send, without typing a message. I can use sendDisabled to make the button become enabled when there is an attachment, but clicking it does not trigger the onSend handler because of https://github.com/chatscope/chat-ui-kit-react/blob/master/src/components/MessageInput/MessageInput.jsx#L134

I think this check should be replaced with a sendDisabled check, or no check since the button disablement should be enough to prevent this from being called when we don't want it.

PavelKudrautsau commented 5 months ago

This is just as interesting to me, hint how to implement it

PavelKudrautsau commented 5 months ago

@singpolyma please you can help with it?

supersnager commented 5 months ago

I think this behavior should be controlled by dedicated flag. For now as a workaround you can set <MessageInput sendButton={false} />, and use custom send button like in this story: Wrapped MessageInput

Related issue: #7