Reputation: 2696
I'm trying to achieve a button (touchable opacity) shadow on android using react native.
I see documentation which suggests the elevation
attribute can be used, but various attempts to use this attribute do not produce the desired effect...
<TouchableOpacity>
<View elevation={3}>
<Text>Hello World</Text>
</View>
</TouchableOpacity>
...
<TouchableOpacity>
<View style={{elevation:3}}>
<Text>Hello World</Text>
</View>
</TouchableOpacity>
What am I doing wrong?
Upvotes: 2
Views: 2167
Reputation: 3501
The elevation
property is available from Android 5.0 (also known as Lollipop) so check the version of the device or emulator you're using.
Also, try to set a backgroundColor
to the view you're trying to add a shadow to.
Upvotes: 2