Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native - Image Semi Circle (using CSS)

I have a circular image, which I need to show in Semi Circle using React Native like as shown in attached file. Please help with the CSS.

enter image description here

like image 657
Amit Malakar Avatar asked Nov 15 '25 14:11

Amit Malakar


1 Answers

Here is the solution I found for both left and right position of image:

renderLeftRightImage (item, index) {
    var imagePath = item.image?(Strings.BASE_IMAGE_URL+item.image[0].image):'https://placeimg.com/640/480/people';        

    if(item.position == 'left'){
        return(
            <View style={{overflow: 'hidden', width : 105, height:210, position : 'absolute', left:80,  bottom:62, borderTopLeftRadius:150, borderBottomLeftRadius:150, backgroundColor:'transparent'}}>
                <Image style={{width : 210, height:210}} source={{uri:imagePath}}/>
            </View>
        )
    }
    else if(item.position == 'right'){
        return(
            <View style={{overflow: 'hidden', width : 105, height:210, position : 'absolute', right:80,  bottom:62, borderTopRightRadius:150, borderBottomRightRadius:150, backgroundColor:'transparent'}}>
                <Image style={{width : 210, height:210, position:'absolute', right:0}} source={{uri:imagePath}}/>
            </View>
        )
    }
    else{
        return null;
    }
}
like image 106
alokkumardubey Avatar answered Nov 18 '25 20:11

alokkumardubey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!