【发布时间】:2023-03-08 09:27:01
【问题描述】:
我想为这样的线条实现投影:
到目前为止我做了什么:
<View style=
{{
elevation: 5,
borderBottomWidth: 2,
bottom: 1,
}}
>
</View>
【问题讨论】:
标签: css reactjs react-native view dropshadow
我想为这样的线条实现投影:
到目前为止我做了什么:
<View style=
{{
elevation: 5,
borderBottomWidth: 2,
bottom: 1,
}}
>
</View>
【问题讨论】:
标签: css reactjs react-native view dropshadow
使用此代码可能会对您有所帮助,您可以将颜色更改为您的主题。
cardContainer: {
borderBottomWidth: 1,
borderColor: #4d4d4d,
shadowColor: #4d4d4d,
shadowOffset: {
width: 0,
height: 8,
},
shadowOpacity: 0.8,
shadowRadius: 13.51,
elevation: 5,
}
【讨论】:
borderBottomWidth 只是 borderBottomWidth 你现在可以测试这对你有用。
<View> <Button> 或任何组件。
import Svg, { LinearGradient, Defs, Stop, Rect } from 'react-native-svg'
<Svg height="100" width="100%" style={{ zIndex: 1, marginTop: -50 }}>
<Defs>
<LinearGradient id="grad" x1="0" y1="0" x2="0" y2="1">
<Stop offset="0" stopColor="#e6e6e6" stopOpacity="1" />
<Stop offset="1" stopColor="#e6e6e6" stopOpacity="0.01" />
</LinearGradient>
</Defs>
<Rect height="100" width="100%" fill="url(#grad)" />
</Svg>
【讨论】: