[英]How to add shadow only on the bottom View in react native Expo
我只需要在 android 設備的組件底部添加陰影(expo reac native)
我總是在 4 個方面得到它。
list: {
display: "flex",
position: "relative",
borderRadius: 5,
margin: 10,
backgroundColor: "#fff",
shadowColor: "#000",
shadowOffset: {
width: 0,
height: 2,
},
shadowOpacity: 0.25,
shadowRadius: 3.84,
elevation: 3,
},
I am trying something like this in my styles but only seems to work: elevation and shadowColor, the rest of the shadow styles do not seem to do anything in my android emulator (maybe in ios it does)
你是對的,對於 android,唯一可用的屬性是elevation
rest,所有屬性都是 ios。 你可以在這里查看RN-shadow-props
對於 ios,只需通過即可在底部添加陰影非常容易
shadowOffset:{
height:-20 // whatever you wanna have
}
但是對於 android,您需要有外部封裝才能使其像rn-shadow-2一樣工作
希望能幫助到你。 隨時懷疑
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.