const handleWechatQRCodeHeight = () => {
const { wechatQRCode } = getAdminInfo()
Image.getSize(wechatQRCode, (width, height) => {
let wechatQRCodeHeight = (height / width) * 300
console.log(wechatQRCodeHeight)
setWechatQRCodeHeight(wechatQRCodeHeight)
})
}
useEffect(() => {
handleWechatQRCodeHeight()
// eslint-disable-next-line
}, [])
<Image
style={{
...styles.mExchangeWechatQRCode,
height: wechatQRCodeHeight,
}}
uri={wechatQRCode}
resizeMode={'cover'}
></Image>
ReactNative之Image组件自适应高度,图片自适应大小
最新推荐文章于 2024-08-29 10:30:29 发布