react-native-autocomplete-input icon indicating copy to clipboard operation
react-native-autocomplete-input copied to clipboard

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

Open behi1989 opened this issue 6 years ago • 7 comments

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 avatar Feb 16 '20 13:02 behi1989

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

behi1989 avatar Feb 16 '20 13:02 behi1989

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

KiranC10 avatar Feb 27 '20 07:02 KiranC10

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.

behi1989 avatar Feb 29 '20 09:02 behi1989

I use the following solution

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

Chugunenok avatar Mar 23 '20 09:03 Chugunenok

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

trugdn avatar Apr 20 '20 06:04 trugdn

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

Yes, I used the same Anyway, thank you

behi1989 avatar Apr 20 '20 07:04 behi1989

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?

yangfreezy avatar Aug 13 '20 18:08 yangfreezy