react-native-autocomplete-input icon indicating copy to clipboard operation
react-native-autocomplete-input copied to clipboard

List displaying behind other components

Open sinclas opened this issue 3 years ago • 13 comments

Hi,

I have this component on a form with components directly under it. Is there a way I can set the list to display above the other component below it? It's currently displaying behind it. Do I set the list container's ZIndex?

Thanks! Steve

sinclas avatar Aug 17 '21 00:08 sinclas

Same issue

deepslam avatar Oct 17 '21 08:10 deepslam

Hey Guys, Wrap your <AutocompleteInput> with a <View> and provide some good zIndex to your <View>, If this does not work. Try defining you list inside flatListProps={{}} Let me know if it does not work!

mitesh-db avatar Oct 30 '21 06:10 mitesh-db

Same for me but I used a Android trick from manual.

//...

render() {
  return(
    <View>
      <View style={styles.autocompleteContainer}>
        <Autocomplete {/* your props */} />
      </View>
      <View>
        <Text>Some content</Text>
      </View>
    </View>
  );
}

//...

const styles = StyleSheet.create({
  autocompleteContainer: {
    flex: 1,
    left: 0,
    position: 'absolute',
    right: 0,
    top: 0,
    zIndex: 1
  }
});

It means that iOS doesn't support overflows too? Probably this style should be implemented on component level?

indapublic avatar Dec 05 '21 02:12 indapublic

The problem of zIndex

erdong-fe avatar Jan 30 '22 03:01 erdong-fe

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 30 '22 11:04 stale[bot]

I have the same issue right now on IOS, and even when playing with the zIndex it does not work for me.

melissa07 avatar May 11 '22 15:05 melissa07

Same issue with the suggestions list appearing behind any element below it. I've tried setting z-index on everything I could but the problem remains.

Any attempt to select a suggestion will pass through to the element it's overlapping.

Edit: I've managed to get it working by setting the element below it to a negative z-index too.

MrSiby avatar Jun 23 '22 04:06 MrSiby

Works @indapublic! Just need to look out for any styles set on parent Views that may be interfering.

cs-manughian avatar Jun 27 '22 23:06 cs-manughian

guys don't take tension . I have use listStyle={{position:'relative'}} inside Autocomplete.

abhijitkumar360 avatar Aug 09 '22 09:08 abhijitkumar360

I used listContainerStyle and simply added z-index in there if the result list ends up behind other components! :) hope it helps

SamanthaChia avatar Aug 20 '22 08:08 SamanthaChia

Yep, this is a huge problem!

Stophface avatar Sep 07 '22 09:09 Stophface

On Android, my problem seems to be the fact that the dropdown doesn't overflow the container view of the Autocomplete component. Even when absolute, it doesn't show, you can only see half the dropdown. Setting it to relative isn't a possibility in my project, so I'm still looking for a solution. zIndex does nothing, elevation doesn't seem to work on suggestionsListContainer nor any other component.

Any suggestion would be appreciated!

W1nstar avatar Sep 16 '22 11:09 W1nstar

On Android, my problem seems to be the fact that the dropdown doesn't overflow the container view of the Autocomplete component. Even when absolute, it doesn't show, you can only see half the dropdown. Setting it to relative isn't a possibility in my project, so I'm still looking for a solution. zIndex does nothing, elevation doesn't seem to work on suggestionsListContainer nor any other component.

Any suggestion would be appreciated!

@W1nstar The solution here worked for me, on both platforms, but it really depends on the styling on your parent component. Could it be interfering? I'd try it out on an empty screen to see if it works, then one by one can add your parent styles. Let me know if that helps, or possibly post a code snippet.

cs-manughian avatar Sep 21 '22 23:09 cs-manughian

My workaround to this problem was wrapper the components just bellow the input with a View with negative zIndex:zIndex: -1. This worked both in IOS and Android.

Jean-Kenned avatar Oct 28 '22 11:10 Jean-Kenned

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 18 '23 07:03 stale[bot]

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.

stale[bot] avatar Apr 02 '23 22:04 stale[bot]

This is still a huge issue. Though we can manipulate the display over other elements using position: "absolute" and zIndex, this could affect styling principles across an application. This needs to be fixed.

ApluUalberta avatar Jan 18 '24 17:01 ApluUalberta

Still a problem. I have to display the autocomplete input in a modal. The listItems appear behind the modal. Please fix.

Dsalvat596 avatar Mar 21 '24 00:03 Dsalvat596