mirror of
https://github.com/status-im/react-native-image-crop-picker.git
synced 2025-02-23 10:58:16 +00:00
Add mediaType
and showsSelectedCount
options for ios
This commit is contained in:
parent
2b04e10b4f
commit
ef68e61d97
@ -89,6 +89,8 @@ ImagePicker.clean().then(() => {
|
||||
| compressImageMaxHeight | number (default none) | Compress image with maximum height |
|
||||
| compressImageQuality | number (default 1) | Compress image with quality (from 0 to 1, where 1 is best quality) |
|
||||
| loadingLabelText (ios only) | string (default "Processing assets...") | Text displayed while photo is loading in picker |
|
||||
| mediaType (ios only) | string (default any) | Accepted mediaType for image selection, can be one of: 'photo', 'video', or 'any' |
|
||||
| showsSelectedCount (ios only) | bool (default true) | Whether to show the number of selected assets |
|
||||
#### Response Object
|
||||
|
||||
| Property | Type | Description |
|
||||
|
@ -60,6 +60,8 @@ RCT_EXPORT_MODULE();
|
||||
@"compressImageQuality": @1,
|
||||
@"compressVideoPreset": @"MediumQuality",
|
||||
@"loadingLabelText": @"Processing assets...",
|
||||
@"mediaType": @"any",
|
||||
@"showsSelectedCount": @YES
|
||||
};
|
||||
self.compression = [[Compression alloc] init];
|
||||
}
|
||||
@ -230,7 +232,7 @@ RCT_EXPORT_METHOD(openPicker:(NSDictionary *)options
|
||||
imagePickerController.delegate = self;
|
||||
imagePickerController.allowsMultipleSelection = [[self.options objectForKey:@"multiple"] boolValue];
|
||||
imagePickerController.maximumNumberOfSelection = [[self.options objectForKey:@"maxFiles"] intValue];
|
||||
imagePickerController.showsNumberOfSelectedAssets = YES;
|
||||
imagePickerController.showsNumberOfSelectedAssets = [[self.options objectForKey:@"showsSelectedCount"] boolValue];
|
||||
|
||||
if ([self.options objectForKey:@"smartAlbums"] != nil) {
|
||||
NSDictionary *smartAlbums = @{
|
||||
@ -252,7 +254,16 @@ RCT_EXPORT_METHOD(openPicker:(NSDictionary *)options
|
||||
if ([[self.options objectForKey:@"cropping"] boolValue]) {
|
||||
imagePickerController.mediaType = QBImagePickerMediaTypeImage;
|
||||
} else {
|
||||
imagePickerController.mediaType = QBImagePickerMediaTypeAny;
|
||||
NSString *mediaType = [self.options objectForKey:@"mediaType"];
|
||||
|
||||
if ([mediaType isEqualToString:@"any"]) {
|
||||
imagePickerController.mediaType = QBImagePickerMediaTypeAny;
|
||||
} else if ([mediaType isEqualToString:@"photo"]) {
|
||||
imagePickerController.mediaType = QBImagePickerMediaTypeImage;
|
||||
} else {
|
||||
imagePickerController.mediaType = QBImagePickerMediaTypeVideo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[[self getRootVC] presentViewController:imagePickerController animated:YES completion:nil];
|
||||
|
Loading…
x
Reference in New Issue
Block a user