I'm trying to add a shadow on the bottom of a view, but I don't how to do it on Android. With elevation
it put a shadow also on the top. Is there a way to do it like on iOS?
Here's my code:
export function makeElevation(elevation) {
const iosShadowElevation = {
shadowOpacity: 0.0015 * elevation + 0.18,
shadowRadius: 0.5 * elevation,
shadowOffset: {
height: 0.6 * elevation,
},
};
const androidShadowElevation = {
elevation,
};
return Platform.OS === 'ios' ? iosShadowElevation : androidShadowElevation;
}
left: iOS (expected)
right: Android
EDIT: The only "fake" solution I found is to use react-native-linear-gradient
instead to create a custom shadow.