byteburgers / react-native-autocomplete-input

Pure javascript autocomplete input for react-native
https://byteburgers.com/autocomplete
MIT License
819 stars 255 forks source link

How do I display the complete list items with focus on the input? #161

Closed behi1989 closed 4 years ago

behi1989 commented 4 years ago

I want to be display the list items by typing a letter and also displayed the complete list items by focus on the input too. How can I do this?

behi1989 commented 4 years ago

Now, just typing a letter, the list will be displayed.

KiranC10 commented 4 years ago

I think your concern is about this hideResults={query.length < 3 ? true : false} you can change the length to get your result

behi1989 commented 4 years ago

I think your concern is about this hideResults={query.length < 3 ? true : false} you can change the length to get your result

Thank you, But I mean to open the list with focus on input without typing.

Chugunenok commented 4 years ago

I use the following solution

`<Autocomplete hideResults={this.state.hideResults} onFocus={() => this.setState({ hideResults: false })} renderItem={({ item, i }) => ( <TouchableOpacity onPress={() => this.setState({ hideResults: true })}>

{item.name}

)} />`

trugdn commented 4 years ago

working for me: hideResults={isHideResultsAutocomplete} onFocus={() => setHideResultsAutocomplete(false)} onEndEditing={() => setHideResultsAutocomplete(true)}

behi1989 commented 4 years ago

working for me: hideResults={isHideResultsAutocomplete} onFocus={() => setHideResultsAutocomplete(false)} onEndEditing={() => setHideResultsAutocomplete(true)}

Yes, I used the same Anyway, thank you

yangfreezy commented 4 years ago

The issue with this approach is that if you select an item, but then delete it and try typing again, the results does not show. I've tried adding "onEditing={() => setHideResults(false)}" but that hasn't solved that edgecase for me. Anyone else encounter this issue?