i-like-robots / react-tag-autocomplete

⚛️ A simple, accessible, tagging component ready to drop into your React projects (new repo)
https://i-like-robots.github.io/react-tag-autocomplete/
ISC License
178 stars 12 forks source link

Unable to clear input in #ReactTag #24

Closed Amandeep112 closed 1 year ago

Amandeep112 commented 2 years ago

Hi matt,

I am facing an issue while creating custom ref with clear input.

const api = useRef( [ ] ); api.current =fields.map((_, i) =>api.current[ i ] ?? createRef( ) ); case: 1.I have created a ref inside loop in ReactTags exp: <ReactTags ref={api.current[index]} /> here [index] is the Index value of mappping statement

  1. I have created a button to clear this input <Button onClick={ ( )=>clear( index ) }> clear Input

  2. Whenever i will try to clear input it's working. this is my clearInput function: const clear = ( i ) => { api.current[i].current.input.focus( ) } ;

This is my api ref response

looping ref

i-like-robots commented 2 years ago

I'm afraid I don't have capacity to debug individual implementations - if you believe you have found a bug please provide an isolated test case. If you are requiring technical support please try Stack Overflow.