Forcing renderItem to run on any Keypress
See original GitHub issueThe data is loaded only on first keypress and backspace in the autocomplete and for all further keypresses the data is only filtered.
Thus renderItem runs only during first keypress or when backspacekey is pressed.
I have written my autocompete suggestion logic inside renderItem so i need it to run every time a key is pressed. Is it possible?
Depending on the suggestions loaded further more 5 rows are loaded which are dependent on suggestions.I am trying to build country suggestion and its top 5 tourist attractions places.
For example if some one types “ind” autocomplete suggestion would show india as first suggestion and then more 5 rows are displayed. These 5 rows shows top 5 tourist attractions in india.
I have written my logic in renderItem, so I need it to run on any keypress
renderItem={({ country, touristlist_array }) => { if(dataset.length>0) { this.loadResults(touristlist_array); if(some condition){ return (<View> <TouchableOpacity onPress={() => this.setState({ query: country })}> <Text style={styles.itemText}> {country} </Text> </TouchableOpacity> {this.load_topfive_touristattractions()} //loads another 5 rows </View> );} else { return (<TouchableOpacity onPress={() => this.setState({ query: country })}> <Text style={styles.itemText}> {title} </Text> </TouchableOpacity>); } }}}
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)

Top Related StackOverflow Question
Just copy and paste isn’t going to do the job. What you need to to is to pass a different set of data to the autocomplete this will trigger the
renderItemfunction. The easiest way to do this is to set your filter query withonChangeText. Have a look at the example maybe this will give you an idea.Thanks a lot.