mirror of
https://github.com/status-im/react-native-image-crop-picker.git
synced 2025-02-23 10:58:16 +00:00
Merge pull request #68 from superandrew213/original-without-loader
Add smart album option iOS only
This commit is contained in:
commit
a67b067c86
@ -69,6 +69,7 @@ ImagePicker.clean().then(() => {
|
||||
| includeBase64 | bool (default false) | Enable or disable returning base64 data with image |
|
||||
| maxFiles (ios only) | number (default 5) | Max number of files to select when using `multiple` option |
|
||||
| compressVideo (ios only) | number (default true) | When video is selected, compress it and convert it to mp4 |
|
||||
| smartAlbums (ios only) | array (default ['UserLibrary', 'PhotoStream', 'Panoramas', 'Videos', 'Bursts']) |
|
||||
|
||||
#### Response Object
|
||||
|
||||
|
@ -186,6 +186,23 @@ RCT_EXPORT_METHOD(openPicker:(NSDictionary *)options
|
||||
imagePickerController.maximumNumberOfSelection = [[self.options objectForKey:@"maxFiles"] intValue];
|
||||
imagePickerController.showsNumberOfSelectedAssets = YES;
|
||||
|
||||
if ([self.options objectForKey:@"smartAlbums"] != nil) {
|
||||
NSDictionary *smartAlbums = @{
|
||||
@"UserLibrary" : @(PHAssetCollectionSubtypeSmartAlbumUserLibrary),
|
||||
@"PhotoStream" : @(PHAssetCollectionSubtypeAlbumMyPhotoStream),
|
||||
@"Panoramas" : @(PHAssetCollectionSubtypeSmartAlbumPanoramas),
|
||||
@"Videos" : @(PHAssetCollectionSubtypeSmartAlbumVideos),
|
||||
@"Bursts" : @(PHAssetCollectionSubtypeSmartAlbumBursts),
|
||||
};
|
||||
NSMutableArray *albumsToShow = [NSMutableArray arrayWithCapacity:5];
|
||||
for (NSString* album in [self.options objectForKey:@"smartAlbums"]) {
|
||||
if ([smartAlbums objectForKey:album] != nil) {
|
||||
[albumsToShow addObject:[smartAlbums objectForKey:album]];
|
||||
}
|
||||
}
|
||||
imagePickerController.assetCollectionSubtypes = albumsToShow;
|
||||
}
|
||||
|
||||
if ([[self.options objectForKey:@"cropping"] boolValue]) {
|
||||
imagePickerController.mediaType = QBImagePickerMediaTypeImage;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user