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.

Two clicks needed to select the item from the list

See original GitHub issue

Here is my component:

          <Autocomplete
            data={possibleAddresses}
            inputContainerStyle={styles.inputElement}
            style={styles.inputBox}
            containerStyle={styles.autocompleteContainer}
            placeholder="321 Acme St"
            onChangeText={text => this.lookupAddressMatches(text)}
            listStyle={styles.resultList}
            renderItem={data => (
              <TouchableOpacity
                onPress={() => this.setAddress(data)}
              >
                <Text style={styles.resultListItem}>{data.formattedAddress}</Text>
              </TouchableOpacity>
            )}
          />

My problem is that in order to select an item from the list, they have to click twice on it (at least on Android, haven’t tried ios).

The first click blurs the input box and the second click triggers the onPress of the TouchableOpacity in my renderItem.

Is there a way to not have this behaviour and have the onPress callback triggered even if the field is not currently blurred?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

3reactions
ilove8commented, Nov 21, 2017

You can use ScrollView with keyboardShouldPersistTaps='always'. it worked!

1reaction
ilove8commented, Jul 10, 2018

@abhisri2090 I couldn’t remember exactly, but you should try `keyboardShouldPersistTaps=‘always’ on ‘ScrollView’

<ScrollView style={styles.container} keyboardDismissMode='on-drag' keyboardShouldPersistTaps='always'>
...
</ScrollView>
Read more comments on GitHub >

github_iconTop Results From Across the Web

SPO lists NEW item: now need to click TWICE
since some days ago we started to need to click twice in the New button in lists, to add an item, after we've...
Read more >
Checked List Box requires me to select an Item twice
I'm guessing this is Windows Forms. There should be a property on the CheckedListBox called Check on Click.
Read more >
How To Choose One or Two Clicks - 4KCC
2 ) Near the top of the window, you will see a list of menus, e.g., File, Edit, View. Choose the TOOLS drop-down...
Read more >
Select needs double click do return #22547 - mui/material-ui
The label is moved to the top if the Select is focused; When the list of options is closed focus is returned to...
Read more >
Why does everything need to be clicked TWICE on mobile app?
E.g. to click a button I need to first select the button (grey border appears), then click the button a second later (action...
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