Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
417 views
in Technique[技术] by (71.8m points)

css - Style the last element of dropdown menu React Native

I would like to style the last element of the dropdown menu in React native.

I'm using a lib called React native dropdown picker.

It has a prop called itemStyle where you can pass a style for items.

item: {
    height: 35,
    justifyContent: 'flex-start',
    paddingLeft: 5,
    borderBottomWidth: 1,
    borderBottomColor: '#000',
  },

The elements style in dropdown

So I would like to chnage the borderBottomWidth from 1px to 0 just for the last element.

I don't know if it is possible.

Sorry, If my english is bad.

question from:https://stackoverflow.com/questions/65924568/style-the-last-element-of-dropdown-menu-react-native

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There's a prop renderSeperator in this library as mentioned in this pull request but it's not documented in Readme.

So try this

<DropDownPicker
....
renderSeperator={() => <View style={{ backgroundColor: '#000', height: 1 }}>}
/>

and remove this part from current itemStyle

borderBottomWidth: 1,
borderBottomColor: '#000',

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...