question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Forcing renderItem to run on any Keypress

See original GitHub issue

The 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:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mrlaessigcommented, Feb 16, 2017

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 renderItem function. The easiest way to do this is to set your filter query with onChangeText. Have a look at the example maybe this will give you an idea.

0reactions
Akshay9882commented, Feb 16, 2017

Thanks a lot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to trigger keypress event in React.js - Stack Overflow
I'm trying to trigger keypress event for text div. Here is text box code for which I want to execute keypress trigger.
Read more >
Detect Any KeyPress in React JS - YouTube
In ReactJS if you want to detect key pressed on keyboard, it is very easy. Import useEffect hook. Add keydown event listener in...
Read more >
Element: keypress event - Web APIs | MDN
The keypress event is fired when a key that produces a character value is pressed down. Examples of keys that produce a character...
Read more >
FlatList - React Native
FlatList. A performant interface for rendering basic, flat lists, supporting the most handy features: Fully cross-platform.
Read more >
Handle ENTER event key press in visual force page
Hi all,. I want to ask how to handle ENTER event key press in visual force page? Is it possible using javascript or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found