i-like-robots/react-tags

clear input field

vrathnayake opened this issue · 4 comments

Issue:
I use this component inside another react component(parent) which is mounted once and then the visibility is toggled. When the parent is visible, I want to clear the input field (if user has previously typed something and closed the parent window, it will retain). I clear/reset all other fields and tags, suggestions on componentDidUpdate() of the parent. It would be great to have a way to clear the input field of the React-tag-autocomplete too.

Suggestion:
expose 'query' state variable through props or may be accept a parameter to handleFocus () which will reset the query value

Hi @vrathnayake , v6 of this component has a .clearInput() method: https://github.com/i-like-robots/react-tags/tree/6.0#clearinput

Please give that a try and let me know how you get on.

perfect! I will

Yes. This works perfectly. Thanks

Supported in the v6.0