iOS crop to square using ImagePicker?

The ImagePicker component documentation states,

[The aspect option] is only applicable on Android, since on iOS the crop rectangle is always a square.

Except, on iOS 15.7, the image is only cropped to the original aspect ratio of the image, and is not forced to be a square. I actually do want this to be forced to a square crop (I’m able to do this on Android). The documentation is either incorrect, or I’m not properly setting up the picker options?

Here is what I have:

ImagePicker.launchImageLibraryAsync({
      allowsEditing: true,
      aspect: [1, 1],
      quality: 0.75,
      exif: false,
      allowsMultipleSelection: false,
      mediaTypes: ImagePicker.MediaTypeOptions.Images,
      presentationStyle: UIImagePickerPresentationStyle.FULL_SCREEN,
    })

Any thoughts on how I can force this to square on iOS, or do I need to implement an editor component for iOS users?

Please provide the following:

  1. SDK Version: 45
  2. Platforms(Android/iOS/web/all): iOS

I can’t reproduce this issue- I always get a square on iOS. Now, on a landscape image, I do see that it’s all the way zoomed out, so, there’s a 4:3 image inside, but it’s inside a square crop box with black bars on the top and bottom. Then, if I zoom in, the square is completely full. Is that what you’re seeing?

The capabilities of ImagePicker are constrained by the native cropper UI provided by Apple. If you want more fine-grained control, you may want to look into alternative image editor/ cropper libraries. With EAS Build and Development Builds, you can integrate most any React Native package.

It is not what I’m seeing; on iPad, I get the image selector, then (I’m in portrait mode) I can pinch to zoom and crop, but it’s always at the dimensions of the original image (which also happens to be portrait.) But as you say, this is entirely dependent on the UI so I imagine Expo’s ability to force anything here is limited, so if I really want to control this experience I need to use a library.

Thanks for the reply.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.