Javascript 与另一视图重叠按钮
我有一个屏幕,在输入字段中输入一些值,并相应地显示搜索结果(在Javascript 与另一视图重叠按钮,javascript,css,reactjs,typescript,react-native,Javascript,Css,Reactjs,Typescript,React Native,我有一个屏幕,在输入字段中输入一些值,并相应地显示搜索结果(在中)。我希望列表与我的ActionButton重叠。就像它与我的另一个输入字段重叠一样 我已经添加了zIndex,它适用于第二个输入字段,但不适用于按钮 return ( <SafeAreaView style={styles.safeAreaViewContainer}> <View style={styles.container}> <View style={s
中)。我希望列表与我的ActionButton重叠。就像它与我的另一个输入字段重叠一样
我已经添加了zIndex,它适用于第二个输入字段,但不适用于按钮
return (
<SafeAreaView style={styles.safeAreaViewContainer}>
<View style={styles.container}>
<View style={styles.searchFieldContainer}>
<AddressSearchInput
addressType="favouritePoint"
iconName="search"
textChangeHandler={textChangeHandler}/>
</View>
<View style={styles.dropdown}>
<LocationsFound
addressesFound={locations.addressesFoundList}/>
</View>
<View style={styles.fieldDescription}>
<Text>Standortname:</Text>
</View>
<View style={styles.searchFieldContainer}>
<Item style={styles.searchField}>
<Input style={styles.searchText}/>
</Item>
</View>
<View style={styles.buttonContainer}>
<ActionButton buttonText="Platz Speichern"/>
</View>
</View>
</SafeAreaView>
);
};
export const styles = StyleSheet.create({
searchFieldContainer: {
alignItems: 'center',
height: moderateScale(120),
},
buttonContainer: {
flexDirection: 'row',
justifyContent: 'center',
zIndex: 1,
},
fieldDescription: {
alignItems: 'center',
},
dropdown: {
position: 'absolute',
top: moderateScale(215),
zIndex: moderateScale(10),
backgroundColor: '#fff',
},
container: {
height: '100%',
backgroundColor: 'white',
width: '100%',
flex:1,
},
});
返回(
标准名称:
);
};
export const styles=StyleSheet.create({
searchFieldContainer:{
对齐项目:“居中”,
高度:中等刻度(120),
},
按钮容器:{
flexDirection:'行',
为内容辩护:“中心”,
zIndex:1,
},
字段说明:{
对齐项目:“居中”,
},
下拉列表:{
位置:'绝对',
顶部:中等规模(215),
zIndex:中等规模(10),
背景颜色:“#fff”,
},
容器:{
高度:“100%”,
背景颜色:“白色”,
宽度:“100%”,
弹性:1,
},
});
您必须在
中添加样式。比如:
container: {
display:"flex",
flex-direction:"column",
//etc
}
因为现在您的
视图都是彼此独立的。我已经在容器中有了样式,忘了复制它直到添加显示:“flex”