From 28f1daa1042e4c812f953c7a2901df543a478400 Mon Sep 17 00:00:00 2001 From: Dawid Date: Mon, 9 Jun 2025 07:00:50 +0200 Subject: [PATCH] Add camera picker reject handler --- ios/src/ImageCropPicker.mm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ios/src/ImageCropPicker.mm b/ios/src/ImageCropPicker.mm index 354ad09c8..f9117fa84 100644 --- a/ios/src/ImageCropPicker.mm +++ b/ios/src/ImageCropPicker.mm @@ -798,6 +798,15 @@ - (void)dismissCropper:(UIViewController *)controller selectionDone:(BOOL)select break; case CAMERA: [controller.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:completion]; + if(selectionDone) { + [controller.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:completion]; + } else { + // if user opened camera picker, tried to crop the image, + // and cancelled cropping, he would return app with promise reject + [controller.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:[self waitAnimationEnd:^{ + self.reject(ERROR_PICKER_CANCEL_KEY, ERROR_PICKER_CANCEL_MSG, nil); + }]]; + } break; } }