【问题标题】:simple horizontal line with gradient effect in react-native?react-native中具有渐变效果的简单水平线?
【发布时间】:2019-09-23 09:02:35
【问题描述】:

我已经尝试过下面的代码,但我需要线的阴影效果。

 <View
             style={{
                borderBottomColor: 'grey',
                borderBottomWidth: 0.5,
                marginBottom: 15,
                marginTop: 50,
                margin: 10,
              }}
            />

【问题讨论】:

    标签: javascript react-native react-native-android


    【解决方案1】:

    这将在视图中为您呈现阴影。

    <View
                     style={{
                        borderBottomColor: 'grey',
                        borderBottomWidth: 0.5,
                        marginBottom: 15,
                        marginTop: 50,
                        margin: 10,
               shadowOffset: {
                    width: 2,
                    height: 2,
                },
                shadowColor: 'rgba(0,0,0,0.8)',
                shadowOpacity: 0.5,
                shadowRadius: 10,
                      }}
                    />
    

    但是正如你所说的你想要渐变,那么你可能需要添加这个库: https://github.com/react-native-community/react-native-linear-gradient

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-08
      • 1970-01-01
      • 1970-01-01
      • 2016-03-19
      • 1970-01-01
      相关资源
      最近更新 更多