这是我在 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",
}
});
我也尝试过使用 box-shadow 但出现了同样的问题。
原文由 Kiran Maniya 发布,翻译遵循 CC BY-SA 4.0 许可协议
尝试将以下属性添加到
styles.box
。您可以更改这些值以获得更好的结果。