FredrikOseberg / react-chatbot-kit

MIT License
299 stars 139 forks source link

Disable send button on no input from user? #69

Closed pavansai2299 closed 3 years ago

pavansai2299 commented 3 years ago

Hi, thanks for this amazing package.

Is there any way to disable send button on no user input or null input from user?

please help me in this

pavansai2299 commented 3 years ago

Found the solution. Thanks

VeenaMalali13 commented 3 years ago

Hi, Can you please share the solution?

pavansai2299 commented 3 years ago

Hi, You can pass the validator function like below as props to chatbot component. you can filter user input for null or even you can restrict the user to specific length according to the logic. The below method prevents sending any user message when input is null. const validator = (input) => { if (input.length > 0) return true; return false }

VeenaMalali13 commented 3 years ago

Yes validator function I have used already. I thought you are actually disabling(hiding) send button and enabling(showng) it only when user enters any value. Thanks