我要定一个目标
BoxShadow
我的应用程序中的一个按钮。因为RN没有阴影(除了基本的
elevation
),我用
react-native-shadow
它们支持:
const shadowOpt = {
width:100,
height:100,
color:"#000",
border:2,
radius:3,
opacity:0.2,
x:0,
y:3,
style:{marginVertical:5}
}
它们是:
宽度:必须设置与子组件相同的值
身高:同上
颜色:阴影的颜色,现在不支持rgba,可以用不透明度
边框:阴影的宽度,不能小于0
半径:与chileElement的“borderRadius”值相同
不透明度:阴影的不透明度
x: 影子的补偿
样式:要添加到包装框的样式
所以,我用
flex
对于我的按钮:
buttonStyle: {
flex: 1,
justifyContent: "center",
alignItems: "center",
alignSelf: "stretch",
backgroundColor: "rgba(6,82,221,0.70)",
borderRadius: 5
}
不能
width
和
height
为了影子!