Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-native shadow props for android

Is there any way to render shadow as in web in react native, using elevation most of the times does not fits all the needs and shadow props only work for IOS, is there any react native builtin way to handle shadow props in android, if no then please suggest good light weight packages for shadow props must be easy to use. Thank you

like image 343
Ammar Tariq Avatar asked Oct 22 '25 05:10

Ammar Tariq


2 Answers

Shadow properties in react-native applies only on iOS. For Android you should set elevation property in your view style.

like image 180
sela Avatar answered Oct 23 '25 17:10

sela


You can use my react-native-simple-shadow-view

  • This enables almost identical shadow in Android as in iOS
  • No need to use elevation, works with the same shadow parameters of iOS (shadowColor, shadowOpacity, shadowRadius, offset, etc.) so you don't need to write platform specific shadow styles
  • Can be used with semi-transparent views
  • Supported in android 18 and up
like image 27
RoyBS Avatar answered Oct 23 '25 18:10

RoyBS



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!