[TouchableHighlight + borderRadius] does not respect parent's overflow property/borderRadius?
See original GitHub issueHey guys,
Ever since I upgraded to 0.4.4, my rounded buttons have a bug in them. I have the following code
<View style={styles.button}>
<TouchableHighlight style={{alignSelf: 'stretch', flex: 1}}>
<Text>My Button</Text>
</TouchableHighlight>
</View>
var styles = Stylesheet.create({
button: {
height: this.props.height,
flexDirection: 'row',
backgroundColor: this.props.backgroundColor,
borderRadius: this.props.borderRadius,
alignSelf: 'stretch',
overflow: 'hidden',
borderWidth: 1,
borderColor: this.props.borderColor || this.props.backgroundColor,
flex: 1
}
});
The button looks great on its own but whenever you touch it, and the highlight comes in, it shows with square corners going outside of the buttons boundaries (hard to take a screenshot of).
This was working fine in 0.4.2. I have also tried matching the borderRadius style property on the TouchableHighlight component and it seems to have no effect, again in 0.4.2 it did.
Any ideas?
Issue Analytics
- State:
- Created 8 years ago
- Comments:12
Top Results From Across the Web
React Native Border Radius with background color
Yes, putting the backgroundColor and borderRadius on the container, then adding overflow: 'hidden' to the container worked for me. (Also not ...
Read more >Overflow hidden + round corners not working on Safari
This Safari bug is well known (don't know why they didn't fix it). Workaround you can find here: Safari not hiding overflow on...
Read more >content inside element with border-radius is not clipped to ...
Image is not cropped by the border-radius of the parent element. ... (such as 'overflow' other than 'visible') also must clip to the...
Read more >moz-border-radius + overflow:hidden does not hide children ...
-moz-border-radius + overflow:hidden does not hide children (or shadows ... Create parent with rounded corners with background (background to see easier) 2.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This still seems to be a bug. Setting
underlayColor: 'transparent'isn’t really a fix because its removing part of the reason for using this type of view. The problem can be partially remedied by wrapping theTouchableHighlightin aViewwhich has aborderRadiusandoverflow: 'hidden'.@shahankit I solved this by adding
underlayColor={ 'transparent' }to the TouchableHighlight. So my full example: