仅左右反应原生阴影



我很难只为视图的左侧和右侧设置一些阴影,如下所示: imgur

我一直在尝试在反应原生阴影生成器网站上计算属性,但没有成功。有谁知道如何/是否可以在反应原生中实现这一点?

你可以这样做:

return (
<View style={styles.mainContainer}>
<View  elevation={5} style={styles.boxStyle}>
<Text>Box 1</Text>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
mainContainer: {
backgroundColor: '#ebebeb',
padding: 10,
height : height
},
boxStyle: {
backgroundColor: '#fff',
alignItem: 'center',
justifyContent: 'center',
flexDirection: 'column',
marginLeft: 30,
marginTop: 15,
width: 120,
height: 120,
padding: 12,
borderRadius: 8,
shadowColor: "00000",
shadowOpacity: 0.9,
shadowRadius: 4,
shadowOffset: {
height: 2,
width: 2
}
}
});

最新更新