【发布时间】:2022-01-14 01:29:58
【问题描述】:
下拉滚动在 react-native-dropdown-picker 的另一个滚动中不起作用
我已经尝试过给予
listMode="SCROLLVIEW"
scrollViewProps={{
nestedScrollEnabled: true,
}}
作为道具。但还是不行。
这是我的代码
<SafeAreaView edges={['right', 'left', 'bottom']} style={styles.container} >
<ScrollView>
<View style={[globalStyles.contentWrap, { marginBottom: 16, height: 1000 }]}>
<View>
<View style={{ zIndex: 10 }}>
<DropDownPicker
listMode="SCROLLVIEW"
placeholder="Select your restaurant"
style={{
borderColor: Colors.borderColor,
backgroundColor: '#fff',
borderWidth: 1,
paddingHorizontal: 12,
paddingVertical: Platform.OS === 'ios' ? 12 : 6,
fontSize: 16,
borderRadius: 5,
marginTop: 8,
marginBottom: 16,
}}
dropDownContainerStyle={{
borderColor: Colors.borderColor,
color: Colors.black1,
fontSize: 16,
borderRadius: 5,
}}
placeholderStyle={{
color: '#696969',
fontSize: 16,
}}
textStyle={{
fontSize: 16,
}}
dropDownMaxHeight={240}
open={open}
value={value}
items={items}
setOpen={setOpen}
setValue={setValue}
setItems={setItems}
schema={{
label: 'name',
value: 'id',
}}
/>
</View>
</View>
</View>
</ScrollView>
</SafeAreaView>
滚动条显示在下拉列表中,但不可滚动。 这是一个参考图像..
【问题讨论】:
-
我认为您需要将下拉菜单移到滚动视图之外,因为它没有检测到目标可滚动项(我的意思是滚动视图或下拉菜单)
-
屏幕上还有很多其他的输入框,把它移到外面不会解决问题,from应该是可滚动的,
-
将“nestedScrollEnabled={true}”属性添加到内部ScrollView(下拉菜单)并检查
-
@Jamal 尝试将 nestedScrollEnabled={true} 赋予未修复的
组件
标签: react-native react-native-flatlist react-native-scrollview react-native-dropdown-picker