Home > Net >  react-native-image-crop-tools aspect ration of an image for a perfect square
react-native-image-crop-tools aspect ration of an image for a perfect square

Time:07-26

I'm on a react-native project and on an image crop with react-native-image-crop-tools...
To display a perfect square with the size, width of my screen, do you know how to do it?
So far, I have tried a lot of ratios, but without success:

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: ignore the values ​​here ^^
ps2: i'm on tablet in landscape mode

CodePudding user response:

if i understand your question correctly, you should set the width to the width of your screen and the aspect ratio to {width:1,height:1}

  • Related