[英]Is there a way to set numberOfLines to 1 of each entry in the dropdown picker? (react-native-dropdown-picker)
代碼:
<DropDownPicker
//code here
style={styles.dropdown_container}
textStyle={styles.dropdown_itemstyle}
props={{style: styles.dropdown_container}}
itemProps={{
style: {
height: 30,
paddingHorizontal: '3%',
flexDirection: 'row',
},
}}
showTickIcon={false}
flatListProps={{
style: {
backgroundColor: COLORS.dirty_white,
borderRadius: 6,
borderColor: COLORS.gray_filter,
borderWidth: 1,
paddingTop: '2%',
},
}}
dropDownContainerStyle={{
borderWidth: 0,
}}
zIndex={5001}
/>
//code here
<View style={styles.bottomContainer}>
<Text numberOfLines={1}>
'Personal - I have problem in my birth certificate, my passport, my
criminal case, etc.'
</Text>
<Button
buttonStyle={[styles.clientBtnStyle, {backgroundColor: '#5E1B89'}]}>
<Text style={{color: 'white', fontWeight: 'bold', fontSize: 12}}>
Submit
</Text>
</Button>
</View>
下拉選擇器中每個項目所需的結果是提交按鈕上方的結果。 我在 labelProps 中嘗試了 numberOfLines,但不幸的是它不起作用。 有沒有什么辦法解決這一問題?
您是否嘗試過使用 ellipsizeMode 截斷文本
至少有兩種不同的解決方案。
https://github.com/hossein-zare/react-native-dropdown-picker/issues/460
https://github.com/hossein-zare/react-native-dropdown-picker/pull/542
正如我所知道的,帶有 numberOfLines: 1 的labelProps
應該在選擇器未打開時起作用,這樣文本就不會換行。 但是要讓它在列表項中工作,還沒有任何道具可以輕松實現這一點。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.