Gallery and Camera open and then close instantly.

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.35.0
  • react-native v0.63.2

Platform

Tell us to which platform this issue is related

  • iOS 13.5

Expected behaviour

Gallery opens, I select a photo and crop it successfully.
Camera opens, I take a photo and crop it successfully.

Actual behaviour

Gallery opens and closes instantly.
Camera opens and closes instantly.

Screen Recording 2020-10-12 at 17 08 36

Steps to reproduce

Here is my code

ImagePicker.openPicker({
          mediaType: 'photo',
          compressImageMaxWidth: 500,
          compressImageMaxHeight: 500,
          compressImageQuality: 0.5,
          includeBase64: true,
          cropping: true,
          cropperCircleOverlay: true,
}).then(image => {
          const source = { uri: 'data:image/jpeg;base64,' + image.data };
          console.log(source);
}).catch(e => console.log(e));

Attachments

// stacktrace or any other useful debug info

Love react-native-image-crop-picker? Please consider supporting our collective:
👉 https://opencollective.com/react-native-image-crop-picker/donate

1 possible answer(s) on “Gallery and Camera open and then close instantly.

  1. @rohithZE In my case, there was a modal that would appear to allow give the options of either opening the camera or opening the gallery. The issue on iOS was that upon making the selection, it would open while the modal was still closing, leading to the issue. So what I did was use a setTimeout to give the modal time to close before opening the selection. In my case, my modal was taking 300ms to close so I put a setTimeout of 350ms, and then open either the gallery or camera.