Skip to content

feat(iOS): allow hiding aspect ratio button #2185

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ ImagePicker.clean()
| cropperCancelText (ios only) | string (default Cancel) | Cancel button text |
| cropperCancelColor (ios only) | string (default tint `iOS` color ) | HEX format color for the Cancel button. Default value is the default tint iOS color [controlled by TOCropViewController](https://github.com/TimOliver/TOCropViewController/blob/a942414508012b13102f776eb65dac655f31cabb/Objective-C/TOCropViewController/Views/TOCropToolbar.m#L433) |
| cropperRotateButtonsHidden (ios only) | bool (default false) | Enable or disable cropper rotate buttons |
| aspectRatioPickerButtonHidden (ios only)  | bool (default false)         | Enable or disable cropper aspect ratio button |

#### Smart Album Types (ios)

Expand Down
8 changes: 8 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,14 @@ declare module "react-native-image-crop-picker" {
* @default Android: 1, iOS: 0.8
*/
compressImageQuality?: number;

/**
* Enable or disable cropper aspect ratio button.
*
* @platform iOS only
* @default false
*/
aspectRatioPickerButtonHidden?: boolean;
}

type CropperOptions = ImageOptions & {
Expand Down
1 change: 1 addition & 0 deletions ios/src/ImageCropPicker.mm
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,7 @@ - (void)cropImage:(UIImage *)image {
cropVC.doneButtonTitle = [self.options objectForKey:@"cropperChooseText"];
cropVC.cancelButtonTitle = [self.options objectForKey:@"cropperCancelText"];
cropVC.rotateButtonsHidden = [[self.options objectForKey:@"cropperRotateButtonsHidden"] boolValue];
cropVC.aspectRatioPickerButtonHidden = [[self.options objectForKey:@"aspectRatioPickerButtonHidden"] boolValue];

cropVC.modalPresentationStyle = UIModalPresentationFullScreen;
if (@available(iOS 15.0, *)) {
Expand Down
1 change: 1 addition & 0 deletions src/NativeImageCropPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export type PickerOptions = {
enableRotationGesture?: boolean;
disableCropperColorSetters?: boolean;
useFrontCamera?: boolean;
aspectRatioPickerButtonHidden?: boolean;
};

export interface Spec extends TurboModule {
Expand Down