Search code examples
androidreact-nativeshadow

shadowOffset is not working in react native android


shadowOffset is not working for me in android react native.

here is my code,

<View style={styles.viewimage}>
   <Image
       style={styles.picture}
       source={require('../../../assets/img/vijy.jpg')}
   />
</View>

Style:

viewimage:{
  backgroundColor:'yellow',
  shadowOffset:
   { 
    width: 10,
    height: 10,  
  },
  shadowColor: 'black',
  shadowOpacity: 1.0,
 },

Solution

  • viewimage: {
      backgroundColor: '#fff',
      shadowColor:'black',
      shadowOffset: {
        width: 0,
        height: 3
      },
      shadowRadius: 5,
      shadowOpacity: 1.0,
      elevation: 5
    },
    

    This will work. elevation:5 for Android remaining properties for iOS.