Kir*_*iya 6 css border elevation shadow react-native
这是我在 React-Native 屏幕中定义的样式。我已经使用该elevation
属性来实现框阴影。但它不能正常工作。
const styles = StyleSheet.create({
scrollContainer: {
flex: 1,
},
container: {
flex: 1,
flexDirection: "row",
flexWrap: "wrap",
padding: 2
},
box: {
margin: 8,
width: Dimensions.get('window').width / 2 - 18,
height: Dimensions.get('window').width / 2 - 18,
justifyContent: "center",
alignItems: "center",
borderStyle: 'dashed',
borderLeftWidth: 1,
borderTopWidth: 1,
borderRightWidth: 1,
borderBottomWidth: 1,
borderTopColor: 'black',
borderBottomEndRadius : 8,
borderTopStartRadius: 8,
borderTopEndRadius: 8,
borderBottomStartRadius: 8,
borderBottomLeftRadius:8,
borderBottomRightRadius:8,
elevation: 5
},
navBar:{
backgroundColor: "#000",
}
});
Run Code Online (Sandbox Code Playgroud)
我也尝试过使用 box-shadow 但出现了同样的问题。
Hel*_*cos 21
尝试将以下属性添加到styles.box. 您可以更改这些值以获得更好的结果。
// ...
box: {
// ...
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.5,
shadowRadius: 2,
elevation: 2,
},
// ...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
45633 次 |
| 最近记录: |