hoanglam10499 / react-native-drop-shadow

https://www.npmjs.com/package/react-native-drop-shadow
MIT License
229 stars 9 forks source link

BorderRadius doesn't work on Android #22

Open MagnasiePro opened 1 year ago

MagnasiePro commented 1 year ago

It's seems that using a borderRadius in style props of DropShadow doesn't work on Android.

ovsiannykov commented 1 year ago

It doesn't work for me either. There are variants?

andrecrimb commented 1 year ago

Any updates about this one?

EslamDarwish commented 1 year ago

For Android: Make the DropShadownode hold only the shadow-related props like shadowColor and pass the rest to a child component. This way, you can avoid problems in borderRadius and backgroundColor, which are the actual causes of the problem also it solves overlapping shadows between parents and children.

For iOS: You can safely pass all props to the Shadow node, but you need always to have a backgroundColor as a default value to avoid any issues.

Platform.OS === "android"? (
  <DropShadow {...shadowProps}>
    <View {...props}>{props.children}</View>
  </DropShadow >
) : (
  <DropShadow {...props} {...shadowProps)}>
    {props.children}
  </DropShadow >
)