Skip to content

Commit d34a006

Browse files
authored
Add camera picker reject handler
1 parent 748898a commit d34a006

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ios/src/ImageCropPicker.mm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,15 @@ - (void)dismissCropper:(UIViewController *)controller selectionDone:(BOOL)select
798798
break;
799799
case CAMERA:
800800
[controller.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:completion];
801+
if(selectionDone) {
802+
[controller.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:completion];
803+
} else {
804+
// if user opened camera picker, tried to crop the image,
805+
// and cancelled cropping, he would return app with promise reject
806+
[controller.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:[self waitAnimationEnd:^{
807+
self.reject(ERROR_PICKER_CANCEL_KEY, ERROR_PICKER_CANCEL_MSG, nil);
808+
}]];
809+
}
801810
break;
802811
}
803812
}

0 commit comments

Comments
 (0)