ImageBackground doesn't consider borderRadius.
See original GitHub issueIs this a bug report?
yes
Have you read the Contributing Guidelines?
yes
Environment
Environment: OS: Linux 4.10 Node: 8.6.0 Yarn: 1.2.0 npm: 5.3.0 Watchman: Not Found Xcode: N/A Android Studio: Not Found
Packages: (wanted => installed) react: ^16.0.0 => 16.1.1 react-native: ^0.50.3 => 0.50.3
Steps to Reproduce
<ImageBackground
style={{
borderRadius : 50,
width: 100 ,
height: 100}}
source={{uri: 'https://en.facebookbrand.com/wp-content/uploads/2016/05/FB-fLogo-Blue-broadcast-2.png')}}
onLoad={() => this.setState({profileImageIsLoading: false})}>
{/** this._renderActivityIndicator() */}
</ImageBackground>
Expected Behavior
Circular Image
Actual Behavior
Square Image
Reproducible Demo
I think the code up which ive posted can be copy pasted.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How do you add borderRadius to ImageBackground?
However, it doesn't seem to accept borderRadius . This has no affect. <ImageBackground style={{height: 100, width: 100, borderRadius: 6}} source ...
Read more >border-radius - CSS-Tricks
The border-radius property takes between one and four length or percentage values, where one value sets the radius for all four corners at...
Read more >CSS Backgrounds and Borders Module Level 3 - W3C
This module replaces and extends the background and border features defined in [CSS2] sections 8.5 and 14.2. All properties in this module apply ......
Read more >Example to Set Border Radius of an Image in React Native
Introduction. This is an Example to Set Border Radius of an Image in React Native. We will set the border radius of the...
Read more >background-size - CSS: Cascading Style Sheets | MDN
Let's consider a large image, a 2982x2808 Firefox logo image. We want to tile four copies of this image into a 300x300-pixel element....
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 FreeTop 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
Top GitHub Comments
If you take a look into the Source Code you see that the
<Image>
component is positioned absolute. Absolute positioned children will always ignoreoverflow: 'hidden'
and stuff likeborderRadius: 1
of the parent I think. Taking another look you see that you can passimageStyle
prop.All in All - Here is the solution:
Consider creating a new bug report. This is not a bug of ImageBackground, the Image component itself doesn’t render separate border radiuses even so the docs explicitly mention these style props. If you don’t create a new bug report your chances of being heard are pretty low I guess.
https://snack.expo.io/@mhjannik/image-with-separate-border-radius