React Native image shadow box

Asked

Viewed 199 times

0

I’m having a hard time putting one shadow in the picture, I tried to put in the View and in the Image but it didn’t work.

<View style={styles.ContainerImageProfile}>
    <Image style={styles.ImageProfile} source={{uri: 'profile.png'}} />
</View>

ContainerImageProfile: {
        width: 90,
        height: 90,
        borderRadius: 50,
        backgroundColor: 'red',
        overflow: 'hidden',
        marginTop: 100,
        shadowColor: '#000',
        shadowOffset: { width: 0, height: 2 },
        shadowOpacity: 0.8,
        shadowRadius: 50,

    },
    ImageProfile: {
        width: '100%',
        height: '100%'
    },

1 answer

0

Are you trying to use this for Android? these Shadow attributes are supported only by IOS, as you can check on: https://facebook.github.io/react-native/docs/shadow-props.html

as an alternative you can use the style attribute elevation, for example:

ContainerImageProfile: {
       ...
       elevation: 1
       ...
    }

otherwise, I believe only with a third-party library

Browser other questions tagged

You are not signed in. Login or sign up in order to post.