【问题标题】:Block colors in react react-native-linear-gradient?react-native-linear-gradient中的块颜色?
【发布时间】:2020-05-14 16:53:03
【问题描述】:

使用 react-native-linear-gradient 时是否可以在块中获取颜色?我尝试过的所有东西都会在颜色之间产生渐变。

想要的效果

下面的代码仍然给出了褪色的效果。我真的不知道 x,y 协调是如何工作的。

<View style={{flexDirection: 'row'}}>
 <LinearGradient 
   start={{ x: 0, y: 0.5 }} end={{ x: 1, y: 0.5 }}
   locations={[0.6, 0.8, 1]} colors={['orange', 'brown', 'yellow']}
  >
   <--COMPONENT-->
  </LinearGradient>
</View>

【问题讨论】:

  • 你能分享一些代码吗
  • 您可以将视图用作框和 flexdirection 行
  • @Noni 我现在已经添加了代码。
  • @MayankPandav flexdirection 行不起作用。我把它放在视图标签上。

标签: react-native react-native-android react-native-ios linear-gradients


【解决方案1】:

我已经在带有 flexdirection 的盒子上创建了示例演示,希望您能清楚地了解示例链接: demo of boxcolor

【讨论】:

    猜你喜欢
    • 2020-02-02
    • 1970-01-01
    • 2020-03-10
    • 2021-01-27
    • 1970-01-01
    • 2020-07-23
    • 2012-04-24
    • 2023-03-08
    • 1970-01-01
    相关资源
    最近更新 更多