React-native: borderRadius for specific corner not working on iOS

Created on 3 May 2017  路  13Comments  路  Source: facebook/react-native

Hello guys!

I'm trying to style an Image component applying borderRadius for just two corners. The code I'm using to accomplish that is this:

imageStyle: {
        width: 100,
        height: 100,
        borderBottomLeftRadius: 5,
        borderBottomRightRadius: 0,
        borderTopLeftRadius: 5,
        borderTopRightRadius: 0,
        marginRight: 20
}

As you can see, I'm applying a borderRadius of 5 to both left corners and I'm having the next result:

  • On Android:
    20170503_143347

  • On iOS:
    screen shot 2017-05-03 at 14 28 56

Seems like the iOS version is not applying the values.

Additional Information

  • React Native version: 0.44.0
  • Platform: iOS & Android
  • Development Operating System: MacOS Sierra 10.12.4
Locked

Most helpful comment

Using overflow: 'hidden' on the same element that have borderRadius should fix this issue, I guess..

All 13 comments

To anyone having this issue, I fixed It by wrapping the Image on a View component and applying the borderRadius to It instead of directly applying It to the Image.

{....}
<View style={styles.imageContainerIOS}>
    <Image
         style={{ width: 100, height: 100 }} 
        source={dummyImage}
    />
</View>

{...}

imageContainerIOS: {
    borderBottomLeftRadius: 5,
    borderBottomRightRadius: 0,
    borderTopLeftRadius: 5,
    borderTopRightRadius: 0,
    overflow: 'hidden',
    marginRight: 20,
    },
{...}

still this issue is coming

Using overflow: 'hidden' on the same element that have borderRadius should fix this issue, I guess..

still issue in borderRadius

Same issue here.

same issue for me

add position: "absolute" along with overflow: "hidden" to the containing <View>, that solved it for me on iOS

I was applying border radius to a "Text" tag and it wasn't working until I moved it to it's parent element which is a "View" tag.

Update: Child Parent issue, Text vs View tags had nothing to do with it.

For me, I just put overflow: "hidden" on my View container then it solves the issue.

Is there any reason why I put overflow: "hidden" fix my issue that the borderTopRightRadius and borderTopLeftRadius not working?

overflow: "hidden" is working

overflow: 'hidden' doesn't work for me. Is there anything else I need?.
Do I need to put overflow on the View container?

Applying _borderTopRightRadius_ / _borderTopLeftRadius_ with or without overflow: "hidden" to the <Image />doesn't work on iOS.

Was this page helpful?
0 / 5 - 0 ratings