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.

Only can select the first option in the dropdown on android.

See original GitHub issue

On my android phone, I can only select the first choice in the autocomplete list. It works as expected on my iPhone. The list filters as I type but no matter what the first option is after filtering, I can only select the first option in the list. I tried adding a “console.log” to the touchables in the list to see if the other options are registering the touch event and they aren’t. Without giving away too much of my code it is as follows: ` <ScrollView contentContainerStyle={[formStyles.container]} scrollEventThrottle={64} keyboardDismissMode=“on-drag” onScroll={() => { if(!this.state.hideResults){this.setState({hideResults:true})}}}> <KeyboardAvoidingView behavior={“padding”}> <View style={AddViewInviteeStyles.inviteeInputMainView}> <Text style={AddViewInviteeStyles.inviteeInputInstructionText}>{this.state.contactsRetrieved ? retrievedContactText : noRetrievedContactText}</Text> <View style={[AddViewInviteeStyles.inviteeInputAutocompleteView]}> <AutoComplete style={[AddViewInviteeStyles.inviteeInputAutocomplete, this.state.invalidContact ? {backgroundColor : ‘#dd4f42’} : {}]} data={this.state.contacts} value={typeof this.state.invitee === “string” ? this.state.invitee : this.state.invitee.name} containerStyle={[textStyles.container, {width: textStyles.textboxes.width}]} placeholder={“Invite someone”} placeholderTextColor={textStyles.datePickerTextStyle.color} ref={(ref) => this.inviteeControl = ref} hideResults={this.state.hideResults} inputContainerStyle={[textStyles.container, {width: ‘100%’, borderWidth: 0}]} onChangeText={(text) => { this.setState({ invitee: text }); if(this.state.invalidContact){ this.validateContact(); } this.filterContacts(text); }} renderItem={({ item, i }) => ( <TouchableOpacity onPress={() => {this.setState({ invitee: item, hideResults:true, invalidContact: false })}} style={[{width: “100%”}, i > 0 ? {marginTop: 10} : {}]}> <Text numberOfLines={1} ellipsizeMode={“tail”} style={{fontSize: responsiveFontSize(2)}}>{item.name}</Text> </TouchableOpacity> )} listStyle={[{width: ‘100%’, position: ‘relative’}]} keyExtractor={(item, i) => {return i +“”}} listContainerStyle={[textStyles.container, {width: responsiveWidth(parseInt(textStyles.textboxes.width.replace(‘%’, ‘’))), position:‘absolute’, left: 0, top: textStyles.textboxes.height, justifyContent: ‘center’, alignItems: ‘center’, zIndex:300}]} autoFocus={true} blurOnSubmit={false} underlineColorAndroid=‘transparent’ /> <TouchableOpacity activeOpacity={1} style={[{width: this.state.addNewInvitee ? ‘10%’:‘20%’, …Util.filterObject(textStyles.textboxes, [“width”, “minWidth”])}, !this.state.addNewInvitee? textStyles.lastTextBoxInFirstRow : {}, !this.state.addNewInvitee? textStyles.lastTextBoxInLastRow : {}, this.state.invalidContact ? {backgroundColor : ‘#dd4f42’} : {}]} onPress={this.addInvitee.bind(this)}> {!this.state.invalidContact ? <Text style={[{fontSize: this.state.addNewInvitee ? responsiveFontSize(3) : responsiveFontSize(4), alignContent: ‘center’, justifyContent: ‘center’, textAlign:‘center’, textAlignVertical: ‘center’, marginTop: this.state.addNewInvitee? 11: 5}, this.state.addNewInvitee ? {marginRight: 2} : {}]}><Emoji name={“heavy_plus_sign”} /></Text> : null}
</TouchableOpacity> {this.state.addNewInvitee ? addNewInviteeCancelBtn : null} </View> {this.state.invalidContact ? invalidInviteeText : null} </View>

            </KeyboardAvoidingView>
        </ScrollView>

const AddViewInviteeStyles = StyleSheet.create({ inviteeInputMainView: { alignItems: ‘center’, marginTop: 40, marginBottom: 20 }, inviteeInputInstructionText: { …textStyles.requiredNotice, …textStyles.notifyTextStyle, fontSize: responsiveFontSize(2), …Platform.select({ android:{ width: responsiveWidth(90) } }) }, inviteeInputAutocompleteView:{ …textStyles.container, flexDirection: ‘row’, …Platform.select({ android: { width: responsiveWidth(parseInt(textStyles.textboxes.width.replace(‘%’ , ‘’))), }, ios:{ width: textStyles.textboxes.width } }) }, inviteeInputAutocomplete: { …textStyles.textboxes, …textStyles.firstTextBoxInFirstRow, …textStyles.firstTextBoxInLastRow, width: ‘100%’ }

});

const formStyles = StyleSheet.create({ container: { …appStyles.container, flexGrow: 1, width: ‘100%’, } });

const appStyles = StyleSheet.create({ container: { backgroundColor: ‘#e9dec2’, } });

const textStyles = StyleSheet.create({ container: { alignItems: ‘center’, }, textboxes: { color: ‘#3c3b5f’, backgroundColor: ‘#F0F8FF’, width: ‘80%’, paddingLeft: 5, paddingRight: 2, minHeight: 35, height: 50, borderBottomColor: ‘#fbdd07’, borderBottomWidth: 1, }, requiredNotice: { color: ‘grey’, fontSize: 13, marginTop: 70, }, firstTextBox: { marginTop: 70, borderTopLeftRadius: 8, borderTopRightRadius: 8 }, firstTextBoxInFirstRow: { borderTopLeftRadius: 8, }, lastTextBoxInFirstRow: { borderTopRightRadius: 8, }, firstTextBoxWithNotice: { borderTopLeftRadius: 8, borderTopRightRadius: 8

},
textBoxInRow: {
    borderRightWidth: 1,
    borderBottomColor: '#fbdd07',
    //borderRightColor: '#fbdd07'
},
notifyTextStyle: { 
    marginTop: '7%', 
    fontSize: responsiveFontSize(4), 
    fontWeight: "300"
}

}) `

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

1reaction
wstockcommented, Sep 8, 2020

Using TouchableOpacity from RNGH fixed for me

import { TouchableOpacity } from “react-native-gesture-handler”;

0reactions
stale[bot]commented, Apr 15, 2021

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Read more comments on GitHub >

github_iconTop Results From Across the Web

When there is only one option in a drop down list in IOS and ...
When there is only one option in a drop down list, IOS auto selects that option but Android won't have the option selected...
Read more >
Can't select first option from Picker · Issue #28204 - GitHub
We need to have some function or callback, to know when the first picker item is selected. My workaround is creating a last...
Read more >
android - How to handle a single option in a dropdown?
I have seen in most of the apps, that Options Menu if having only one item is displayed as drop down. Even if...
Read more >
Set default selection for drop-down in a new Form
I have an app wich the data source is Sahrepoint List, that list has a "choice" item ('New', 'Closed', 'Open'). Is there currently...
Read more >
What are the different ways to select an option from ... - Edureka
Hi Swathi, there are a few ways by which you can select an Option from a Dropdown on Webpage using Selenium. Following are...
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