reactjs / react-autocomplete

WAI-ARIA compliant React autocomplete (combobox) component
MIT License
2.17k stars 532 forks source link

How to make input field initially disabled? #350

Closed stefek99 closed 6 years ago

stefek99 commented 6 years ago

I have react-autocomplete component on my page.

It makes sense to choose list of restaurant only after you specify your location.

Therefore I would like to have autocomple initially disabled.


I know there is a method renderInput

https://github.com/reactjs/react-autocomplete#renderinput-function-optional

What makes me worried:

At the very least you need to apply props.ref and all props.on event handlers.

I do not know about inner workings and all the events I'd need to attach.

Is there an easier way?

Something like isDisabled flag?


I know it's an open-source, anyone can do this, just checking if there is an already existing way that I'm missing...

stefek99 commented 6 years ago

Simple.

Easy.

Kind of obvious, once you know it :)

https://github.com/reactjs/react-autocomplete#inputprops-object-optional

image