ReactNative之Image组件自适应高度,图片自适应大小


  

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
  }, [])


                

你可能感兴趣的:(web前端,react,native,javascript,前端)