Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes when width/height options set on iOS #74

Open
mreall opened this issue Sep 21, 2020 · 1 comment
Open

Crashes when width/height options set on iOS #74

mreall opened this issue Sep 21, 2020 · 1 comment

Comments

@mreall
Copy link

mreall commented Sep 21, 2020

If the demo apps cannot help and there is no issue for your problem, tell us about it

I upgraded to the latest version (4.0.1) and now when I pass in a width and height to the show() method per the instructions it throws an error. Stepping through the debugger, it looks like UIGraphicsGetImageFromCurrentImageContext() in imagecropper.ios.js is returning null.

Passing a width and height prior to upgrading worked fine. Also, if I don't pass a width and height, the cropper works as expected.

Which platform(s) does your issue occur on?

  • iOS 14
  • emulator: iPhone 8

Please, provide the following version numbers that your issue occurs with:

  • CLI: 7.0.8
  • Cross-platform modules: 7.0.3
  • Runtime(s): ios: 7.0.0
@mreall
Copy link
Author

mreall commented Sep 21, 2020

As a workaround, I resize the image before sending it to the cropper using the ImageAsset object.

const context = imagepicker.create(options);
context
  .authorize()
  .then(() => context.present())
  .then((selection) => {
    let asset = selection[0];
    asset.options = {
      width: newWidth,
      height: newHeight,
      keepAspectRatio: true,
      autoScaleFactor: false,
    };

    ImageSource.fromAsset(asset).then((image) => {
      const imageCropper = new ImageCropper();
      imageCropper
        .show(image, {
          //width: newWidth,
          //height: newHeight,
          lockSquare: true,
          circularCrop: true,
        })
        .then((args) => {
          // Process the cropped image.
        })
    });
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant