Reputation: 53
Shadow style works fine for iOS but on Android only elevation works and I can't add style to it? So is there any way to add shadowOpacity, shadowColor, shadowOffset ... etc?
Upvotes: 4
Views: 4184
Reputation: 31
If it can help someone today (it's been a while) :
It is possible to give elevation and a shadowColor on android, if you use rgba colors you can add transparency, here I put 0.5 for opacity :
myStuff: {
width: 50,
height: 50,
elevation: 5,
shadowColor: 'rgba(152, 152, 152, 0.5)',
},
Upvotes: 2
Reputation: 576
As rightly mentioned above
elevation
is the only supported way of adding shadow.
However, there is a third party plugin that can help you out.
https://github.com/879479119/react-native-shadow
Attribute we support now
opacity: the opacity of shadow
Upvotes: 0
Reputation: 1129
You can use Shadow Props to define shadows on Android now because the issue Vincent referenced was resolved with this Pull Request.
Upvotes: 0
Reputation: 3903
As you can see here, those are only available for iOS.
The only way to add shadow on Android is with elevation, like you said.
You can also read about this issue here for more detail.
Upvotes: 1