簡體   English   中英

react-native-image-crop-tools 完美正方形圖像的縱橫比

[英]react-native-image-crop-tools aspect ration of an image for a perfect square

我在一個 react-native 項目和一個帶有 react-native-image-crop-tools 的圖像裁剪...
要以我的屏幕大小、寬度顯示一個完美的正方形,你知道怎么做嗎?
到目前為止,我已經嘗試了很多比率,但都沒有成功:

style={{ width: Dimensions.get('screen').width, height: Dimensions.get('screen').height }}
          ref={cropViewRef}
          onImageCrop={(res) => console.warn(res)}
          keepAspectRatio
          aspectRatio={{ width: Dimensions.get('screen').width / 9, height: Dimensions.get('screen').height / 12 }}

ps:忽略這里的值^^
ps2:我在橫向模式下使用平板電腦

如果我正確理解你的問題,你應該將寬度設置為屏幕的寬度,將寬高比設置為{width:1,height:1}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM