反应本地投影

时间:2019-03-06 04:43:11

标签: react-native dropshadow

我需要添加阴影选项以添加到Android应用程序中的按钮。 在react中,本机默认选项(shadowColor,shadowOpacity,shadowRadius)仅适用于ios版本。 Android仅适用于高程选项。 有谁知道如何做到这一点?我使用了react-native-shadow,但由于它不支持最新的react native版本,因此即使我们手动安装,它也会出现SVG组件错误的情况。

2 个答案:

答案 0 :(得分:0)

尝试使用以下库:

https://github.com/Kishanjvaghela/react-native-cardview

它将满足您的要求

答案 1 :(得分:0)

您可以使用React Native Platform模块来设置特定于操作系统的样式。例如:

import { Platform, Stylesheet } from 'react-native';

// your component

const styles = Stylesheet.create({
  button: {

    // cross-platform css

    ...Platform.select({
      ios: {
        shadowColor: rgba(0,0,0),
        shadowOpacity: 0.5,
        shadowRadius: 5
      },
      android: {
        elevation: 5
      },
    }),
  }
})
相关问题