overflow:hidden is not supported on Android
When the parent view (overflow: 'hidden') has borderRadius set, the child view is not clipped to the shape of the parent.

demo reproducing the issue: https://rnplay.org/apps/69TRrw
Thanks for the report. Unfortunately overflow: hidden is not respected on android (see https://facebook.github.io/react-native/docs/known-issues.html#the-overflow-style-property-defaults-to-hidden-and-cannot-be-changed-on-android). I think @kmagiera has previously posted about the clipping issue for rounded corners and can chime in here.
Nothing more to add here. Unfortunately this is a known problem and is not being worked on as mentioned in the docs. Closing this as it's already on the list. If you guys have any proposal on how this could be implemented without causing significant perf issue in rendering pipeline feel free to reopen and post your ideas here
We're using imgix, so I think we'll be able to add ?fm=png&mask=ellipse and be on our way. Dodged a bullet there but will encounter moderate problems elsewhere.
I'll submit a PR to note that in addition to hidden always being true, it doesn't obey borderRadius, which is not currently noted in the docs. (I assumed that if hidden were true, it would be clipped by the borderRadius just fine.)
@kmagiera May I ask where to find the comment or discussion about clipping issue with rounded corners that you posted before?
@Kudo: I was referring to the link posted by Andy just above my comment: https://facebook.github.io/react-native/docs/known-issues.html#the-overflow-style-property-defaults-to-hidden-and-cannot-be-changed-on-android
@kmagiera I see. The feature is really useful for some cornered UI construction. Would like to know more detail of your mentioned significant perf drops and see if we can make this feature happens.
More info: this demo (https://rnplay.org/apps/WlY9aA) shows if the outer control is an image, the borderRadius property will totally not working.
We're working on an alternative UI implementation on Android that will fix this -- it's still in testing internally so don't expect it for a few more months, but do know we are working on getting a fix.
Any updates on this issue ?
I have a fairly cringe-worthy fix using styles that works for me in the meantime. This is a UI for creating group avatars out of user avatars. Similar to Facebook Messengers group avatars.
https://rnplay.org/apps/qXLzlw
@bsinc that's a great solution! thx. just clarifying what you did:
<View style={styles.circle}>
<Image style={styles.image} />
<View style={styles.fixCircleClipping}/>
</View>
circle: {
width: circleSize,
height: circleSize,
borderRadius: circleSize / 2,
overflow: 'hidden',
},
fixCircleClipping: {
position: 'absolute',
top: -circleFixBorder,
bottom: -circleFixBorder,
right: -circleFixBorder,
left: -circleFixBorder,
borderRadius: circleSize / 2 + circleFixBorder / 2,
borderWidth: circleFixBorder,
borderColor: bgColor
},
@bsinc That's brilliant, thank you!
@astreet Is there any updates? Thanks
Is this still a known issue? I can't find the known issues page anymore.
@astreet this will be fixed in 0.32? When 0.32 comes out?
@Duelsik Was this hinted to being fixed in 0.32 or are you just asking? The release notes for 0.32 do not mention it anywhere.
Hey all, sorry you are being hit by this -- a couple engineers at FB are actively working on open sourcing our internal fix for this, but it's not a simple change so unfortunately it'll take a while longer. Tentatively, they are hoping to have it open sourced by the end of the year.
@astreet Thanks for the info! I eagerly await the fix!
I wonder if there is some temporary hack I can do with css to imitate this? The fix mentioned by @yonatanmn doesn't cover all cases.
@bsinc Thank you!
I would also be interested in a temporary hack to fix this problem.