add support to cropperCircleOverlay on iOS

This commit is contained in:
Eduardo Sganzerla 2016-12-18 17:08:36 -02:00
parent 611de3dbd8
commit 87dd9ad6fc
3 changed files with 13 additions and 3 deletions

View File

@ -68,7 +68,7 @@ ImagePicker.clean().then(() => {
| multiple | bool (default false) | Enable or disable multiple image selection |
| includeBase64 | bool (default false) | Enable or disable returning base64 data with image |
| cropperTintColor (android only) | string (default `"#424242"`) | When cropping image, determines the color of Toolbar and other UX elements. Uses UCrop's `setToolbarColor, setActiveWidgetColor, and setStatusBarColor` with color specified. |
| cropperCircleOverlay (android only) | bool (default false) | Enable or disable circular cropping mask. |
| cropperCircleOverlay | bool (default false) | Enable or disable circular cropping mask. |
| maxFiles (ios only) | number (default 5) | Max number of files to select when using `multiple` option |
| compressVideo (ios only) | bool (default true) | When video is selected, compress it and convert it to mp4 |
| smartAlbums (ios only) | array (default ['UserLibrary', 'PhotoStream', 'Panoramas', 'Videos', 'Bursts']) | List of smart albums to choose from |

View File

@ -37,7 +37,8 @@ export default class App extends Component {
pickSingleWithCamera(cropping) {
ImagePicker.openCamera({
cropping,
cropping: true,
// cropperCircleOverlay: true,
width: 500,
height: 500
}).then(image => {
@ -88,6 +89,8 @@ export default class App extends Component {
width: 300,
height: 300,
cropping: cropit,
cropping: true,
cropperCircleOverlay: true,
compressVideo: true
}).then(image => {
console.log('received image', image);

View File

@ -38,6 +38,7 @@ RCT_EXPORT_MODULE();
self.defaultOptions = @{
@"multiple": @NO,
@"cropping": @NO,
@"cropperCircleOverlay": @NO,
@"includeBase64": @NO,
@"compressVideo": @YES,
@"maxFiles": @5,
@ -472,7 +473,13 @@ RCT_EXPORT_METHOD(openPicker:(NSDictionary *)options
}
if ([[[self options] objectForKey:@"cropping"] boolValue]) {
RSKImageCropViewController *imageCropVC = [[RSKImageCropViewController alloc] initWithImage:image cropMode:RSKImageCropModeCustom];
RSKImageCropViewController *imageCropVC = [[RSKImageCropViewController alloc] initWithImage:image];
if ([[[self options] objectForKey:@"cropperCircleOverlay"] boolValue]) {
imageCropVC.cropMode = RSKImageCropModeCircle;
} else {
imageCropVC.cropMode = RSKImageCropModeCustom;
}
imageCropVC.avoidEmptySpaceAroundImage = YES;
imageCropVC.dataSource = self;