Is there a way to set numberOfLines to 1 of each entry in the dropdown picker? (react-native-dropdown-picker)

Viewed 44

Dropdown picker screenshot

Code:

<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>

The result that is wanted for each item in the dropdown picker is the one above the submit button. I have tried numberOfLines in labelProps but unfortunately it doesn't work. Is there any way to fix this?

2 Answers

Have you tried to truncate text using ellipsizeMode

Related