[英]react-native-dropdown-picker scroll inside another scroll is not working
下拉滾動在 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>
滾動條顯示在下拉列表中,但不可滾動。 這是一個參考圖像..
根據他們的官方文檔,您不能擁有內部滾動視圖。
筆記#
FlatList組件不應嵌套在ScrollView中,否則您將遇到 VirtualizedLists 永遠不應嵌套在普通 ScrollViews 警告中。 如果您遇到這種情況並且您只有幾個項目,請考慮使用SCROLLVIEW模式。 否則你必須使用MODAL模式。
請參閱此鏈接: https://hossein-zare.github.io/react-native-dropdown-picker-website/docs/advanced/list-modes
如果您遇到嵌套滾動的問題。 使用帶有 nestedScrollEnabled={true} 的 react-native-gesture-handler 的 ScrollView。 它在 android 中效果更好。 您還可以為此修補 react-native-dropdown-picker。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.