简体   繁体   English

Overlay 反应原生 flatlist 项目

[英]Ovelay react native flatlist items

Guys why my flatlist items are not rendering over the succeeding text input.伙计们,为什么我的平面列表项目没有在随后的文本输入上呈现。 I can see my white background text input rendering over the flatlist items.我可以看到我的白色背景文本输入呈现在平面列表项上。 I wan't to have the flatlist items over the text input.我不想在文本输入上放置平面列表项。

const SearchScreen = () => {

    return (
        <SafeAreaView>
            <View>
               <TextInput
                   style={styles.textInput}
                   placeholder={placeholder}
                   value={place}
                   onChangeText={(str) => handlePlace(str)}/>
               <FlatList style={styles.flatList}
                   data={data}
                   keyExtractor={item => item.place_google_id}
                   renderItem={({item}) => (
                       <View style={{backgroundColor: "#000"}}>
                           <Text style={{color: "#FFF"}}>{item.description}</Text>
                       </View>
                   )}
               />
            </View>
            <TextInput style={{backgroundColor: "white"}}/>
        </SafeAreaView>
    )
};
flatList: {
    flex: 1,
    left: 10,
    position: "absolute",
    right: 10,
    top: 50,
}

you can add zIndex to your flatlist styles:您可以将 zIndex 添加到您的平面列表 styles:

flatList: {
    flex: 1,
    left: 10,
    position: "absolute",
    right: 10,
    top: 50,
zIndex:4 // add this
}

Hope it helps.希望能帮助到你。 feel free for doubts随时怀疑

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM