How to use border radius only for 1 corner (react-native)?

JavascriptReactjsReact Native

Javascript Problem Overview


How to use border radius in React Native only for 1 corner?

I have a modal window

http://f1.s.qip.ru/etSMz5YP.png

As you can see bottom corners not rounded, it happens when I used backgroundColor for buttons. I was trying to set overflow hidden to modal wrapper and it didn't help me. Now I want to use border radius to buttons (only for 1 corner).

My code http://jsbin.com/sexeputuqe/edit?html,css

Javascript Solutions


Solution 1 - Javascript

Did you already try with the following?

  • borderBottomLeftRadius: number
  • borderBottomRightRadius: number
  • borderTopLeftRadius: number
  • borderTopRightRadius: number

Also, you can find more info in the view component docs.

Solution 2 - Javascript

Add the following properties in your style:

  • borderBottomLeftRadius: number
  • borderBottomRightRadius: number
  • borderTopLeftRadius: number
  • borderTopRightRadius: number

This worked for me.

Thanks

Solution 3 - Javascript

Suppose only the radius is set for the upper left and lower left corners of the Image tag.
<View style={styles.imgBox}>
  <Image source={{ uri: 'your image url' }} style={styles.img} />
</View>

 const styles = EStyleSheet.create({
 imgBox: {
       width: px(72),
       height: px(72),
       borderBottomLeftRadius: 2,
       borderTopLeftRadius: 2,
       overflow: 'hidden',
 },
 img: {
       width: px(72),
       height: px(72),
  },
})

looks good for ios.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMaksimView Question on Stackoverflow
Solution 1 - JavascriptMatteo MazzaroloView Answer on Stackoverflow
Solution 2 - JavascriptSyn AdhityaView Answer on Stackoverflow
Solution 3 - JavascriptShirly ChenView Answer on Stackoverflow