diff --git a/README.md b/README.md index 1ce96d4c6..4035ca08b 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java b/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java index 7e4e00431..83aa24ba6 100644 --- a/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java +++ b/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java @@ -79,7 +79,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; @@ -134,7 +133,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) { diff --git a/index.d.ts b/index.d.ts index 2040c2b5d..4eda8d3c6 100644 --- a/index.d.ts +++ b/index.d.ts @@ -28,6 +28,8 @@ declare module "react-native-image-crop-picker" { showCropGuidelines?: boolean; hideBottomControls?: boolean; enableRotationGesture?: boolean; + cropperCancelText?: string; + cropperChooseText?: string; } export interface Image { diff --git a/ios/src/ImageCropPicker.m b/ios/src/ImageCropPicker.m index 848ee6d5b..f156108be 100644 --- a/ios/src/ImageCropPicker.m +++ b/ios/src/ImageCropPicker.m @@ -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]; } @@ -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]; });