Need to make Image Bottom to corner: React Native

前端 未结 3 905
温柔的废话
温柔的废话 2021-01-27 04:29

I want to make image rounded from bottom of it. Here is what I wanted to make:

I have tried to set borderRadius, but it will apply for the whole image

3条回答
  •  误落风尘
    2021-01-27 04:34

    Using the approach mentioned by @Mohamed Khalil,

    const styles = StyleSheet.create({
    containerStyle: {
        alignSelf: 'center',
        width: window.width,
        overflow: 'hidden',
        height: window.width / 1.7
    },
    sliderContainerStyle: {
        borderRadius: window.width,
        width: window.width * 2,
        height: window.width * 2,
        marginLeft: -(window.width / 2),
        position: 'absolute',
        bottom: 0,
        overflow: 'hidden'
    },
    slider: {
        height: window.width / 1.7,
        width: window.width,
        position: 'absolute',
        bottom: 0,
        marginLeft: window.width / 2,
        backgroundColor: '#9DD6EB'
    }});
    

    Here is the result. I used Dimensions (const window = Dimensions.get('window');) here to make it more dynamic to different screen sizes.

提交回复
热议问题