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.

The results of the first Autocomplete float behind the second Autocomplete field

See original GitHub issue

If you have two or more vertically stacked components, the results float behind those below (as well as my Picker components). zIndex does not seem to help

renderItem({item, i, separators}) {
        return (
            <TouchableOpacity style={styles.acResult} key={i} onPress={() => this.onSelect(item)}>
                <Text style={styles.acResultText}>
                    {item.label}
                </Text>
            </TouchableOpacity>
        )
    }

<View style={styles.autocompleteContainer}>
                    <Autocomplete
                        autoCapitalize="none"
                        autoCorrect={false}
                        keyExtractor={item => item.id}
                        data={this.findResult(this.state.query)}
                        placeholder={this.props.field.label}
                        defaultValue={this.state.query}
                        onChangeText={text => this.setState({query: text})}
                        renderItem={this.renderItem}
                    />
                </View>

Screen Shot 2020-06-29 at 10 22 35 AM

My styles are:

acResult: {
        zIndex:99999,
        backgroundColor:Colors.snow,
    },
    acResultText: {
        paddingVertical:5,
        paddingLeft:5,
        fontSize: 18,
        backgroundColor:Colors.snow,
        color:Colors.charcoal
    },
    autocompleteContainer: {
        backgroundColor:Colors.snow,
        flex: 1,
        left: 0,
        position: 'absolute',
        right: 0,
        top: 0,
        zIndex: 1
    }

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
ahtisham09commented, Oct 25, 2020

@paritosh-yadav i solve this issue with any styling like ZIndex Follow this snippet Code
<View mainContainer> <AutoComplete/> <View> <AutoComplete/> <View> <AutoComplete/> <View ( if you want to add button any other component add in this view/> </View> </View> </View>

I hope this snippet will help you for solving this problem

1reaction
iamsrikanthnanicommented, Oct 24, 2020

@paritosh-yadav simply set the zIndex:10 to the below component(second autocomplete).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Autocomplete issue into bootstrap modal - Stack Overflow
So just add the class "ui-front" to the parent element and the autocomplete will be correctly displayed inside the modal. Share.
Read more >
AutoComplete - Ant Design
AutoComplete is an input box with text hints, and users can type freely. The keyword is aiding input. Select is selecting among given...
Read more >
HTML attribute: autocomplete - MDN Web Docs
The HTML autocomplete attribute lets web developers specify what if any permission the user agent has to provide automated assistance in ...
Read more >
How To Create Autocomplete on an Input Field - W3Schools
Step 5) Initiate the Autocomplete Effect on "myInput": Example. Pass the countries array as the second parameter of the autocomplete function: <script>
Read more >
autofill - CSS-Tricks
Notice how the autocompleted fields have a yellow background? That's how the browser styles a field when it contains auto-filled content. The : ......
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