小编典典

react-native-image-crop-tools 完美正方形图像的纵横比

javascript

我正在进行一个 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:忽略这里的值^^


阅读 96

收藏
2022-07-26

共1个答案

小编典典

如果我正确理解您的问题,您应该将宽度设置为屏幕宽度,将宽高比设置为{width:1,height:1}

2022-07-26