【发布时间】:2023-03-17 16:43:02
【问题描述】:
我正在使用来自import DropDownPicker from 'react-native-dropdown-picker'; 的下拉选择器库,当在具有某些样式的视图中时,它有点无法正确展开。
这是一些代码:
<View style={styles.cellBox}>
<DropDownPicker
items={[
{ label: '5', value: 5 },
{ label: '10', value: 10 },
{ label: '20`', value: 20 },
{ label: '45`', value: 45 },
{ label: '57`', value: 57 },
]}
itemStyle={{
justifyContent: 'flex-start'
}}
dropDownStyle={{ backgroundColor: '#fafafa' }}
onChangeItem={item => buyOfferStore.setBatchQuantityInTons(item.value)}
/>
</View>
Style 的 cellbox 属性如下所示:
cellBox: {
flex: 1,
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
borderTopWidth: 1,
borderBottomWidth: 1,
borderColor: theme.colors.lightSilver,
backgroundColor: 'white',
padding: 10,
minHeight: 55,
marginTop: -1,
},
输出: enter image description here
如果我从 View 元素中删除样式效果很好。不知道为什么会这样,我无法从 View 元素中删除样式,因为我需要设置 View 元素的样式以使其具有某种外观!
【问题讨论】:
标签: javascript css react-native react-native-android