我们可以在 React Native 中只设置 View 的一侧阴影吗? [英] Can we set only one side shadow of View in React Native?

查看:69
本文介绍了我们可以在 React Native 中只设置 View 的一侧阴影吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所说,我们如何在 React Native 中只设置 View 的一个侧影,或者隐藏任何侧影?我想要的是显示唯一的一侧阴影,有什么解决方案吗?

As the title saying, how can we set only one side shadow of View in React Native, or hide any side shadow? What I want is showing the only one side shadow, any solutions?

推荐答案

使用这个

const style = {
  shadowColor: "#000000",
  shadowOffset: { width: 0, height: 2 }, // change this for more shadow
  shadowOpacity: 0.4,
  shadowRadius: 6,
}

例如:

  1. shadowOffset: { width: 0, height: 10 } 阴影只在视图底部

shadowOffset: { width: 0, height: -10 } 阴影仅位于视图顶部

shadowOffset: { width: 10, height: 0 } 阴影仅位于视图的右侧

shadowOffset: { width: 10, height: 0 } shadows place only in right of View

shadowOffset: { width: -10, height: 10 } 阴影仅位于视图的左侧

shadowOffset: { width: -10, height: 10 } shadows place only in left of View

这篇关于我们可以在 React Native 中只设置 View 的一侧阴影吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆