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

Add chooseText and cancelText properties: rebased #699

Merged
merged 5 commits into from
May 16, 2018
Merged
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ ImagePicker.clean().then(() => {
| showCropGuidelines (android only) | bool (default true) | Whether to show the 3x3 grid on top of the image during cropping |
| hideBottomControls (android only) | bool (default false) | Whether to display bottom controls |
| enableRotationGesture (android only) | bool (default false) | Whether to enable rotating the image by hand gesture |
| cropperChooseText (ios only)  |           string (default choose)        | Choose button text |
| cropperCancelText (ios only) | string (default Cancel) | Cancel button text |

#### Smart Album Types (ios)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ class PickerModule extends ReactContextBaseJavaModule implements ActivityEventLi
private boolean disableCropperColorSetters = false;
private ReadableMap options;


//Grey 800
private final String DEFAULT_TINT = "#424242";
private String cropperActiveWidgetColor = DEFAULT_TINT;
Expand Down Expand Up @@ -133,7 +132,7 @@ private void setConfiguration(final ReadableMap options) {
hideBottomControls = options.hasKey("hideBottomControls") ? options.getBoolean("hideBottomControls") : hideBottomControls;
enableRotationGesture = options.hasKey("enableRotationGesture") ? options.getBoolean("enableRotationGesture") : enableRotationGesture;
disableCropperColorSetters = options.hasKey("disableCropperColorSetters") ? options.getBoolean("disableCropperColorSetters") : disableCropperColorSetters;
this.options = options;
this.options = options;
}

private void deleteRecursive(File fileOrDirectory) {
Expand Down
2 changes: 2 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ declare module "react-native-image-crop-picker" {
showCropGuidelines?: boolean;
hideBottomControls?: boolean;
enableRotationGesture?: boolean;
cropperCancelText?: string;
cropperChooseText?: string;
}

export interface Image {
Expand Down
8 changes: 7 additions & 1 deletion ios/src/ImageCropPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ - (instancetype)init
@"compressVideoPreset": @"MediumQuality",
@"loadingLabelText": @"Processing assets...",
@"mediaType": @"any",
@"showsSelectedCount": @YES
@"showsSelectedCount": @YES,
@"cropperCancelText": @"Cancel",
@"cropperChooseText": @"Choose"
};
self.compression = [[Compression alloc] init];
}
Expand Down Expand Up @@ -364,8 +366,12 @@ - (void)startCropping:(UIImage *)image {
imageCropVC.avoidEmptySpaceAroundImage = YES;
imageCropVC.dataSource = self;
imageCropVC.delegate = self;
NSString *cropperCancelText = [self.options objectForKey:@"cropperCancelText"];
NSString *cropperChooseText = [self.options objectForKey:@"cropperChooseText"];
[imageCropVC setModalPresentationStyle:UIModalPresentationCustom];
[imageCropVC setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[imageCropVC.cancelButton setTitle:cropperCancelText forState:UIControlStateNormal];
[imageCropVC.chooseButton setTitle:cropperChooseText forState:UIControlStateNormal];
dispatch_async(dispatch_get_main_queue(), ^{
[[self getRootVC] presentViewController:imageCropVC animated:YES completion:nil];
});
Expand Down