Add types for smart albums, compressed video presets, and picker errors (#1332)
* Added picker error code types * Added types for CompressVideoPresets and iOS SmartAlbums
This commit is contained in:
parent
1d2baa507b
commit
a0c7a8f4b5
|
@ -154,6 +154,7 @@ ImagePicker.clean().then(() => {
|
|||
|
||||
#### Smart Album Types (ios)
|
||||
|
||||
NOTE: Some of these types may not be available on all iOS versions. Be sure to check this to avoid issues.
|
||||
```
|
||||
['PhotoStream', 'Generic', 'Panoramas', 'Videos', 'Favorites', 'Timelapses', 'AllHidden', 'RecentlyAdded', 'Bursts', 'SlomoVideos', 'UserLibrary', 'SelfPortraits', 'Screenshots', 'DepthEffect', 'LivePhotos', 'Animated', 'LongExposure']
|
||||
```
|
||||
|
|
|
@ -1,4 +1,53 @@
|
|||
declare module "react-native-image-crop-picker" {
|
||||
/**
|
||||
* AVAssetExportPreset presets.
|
||||
*
|
||||
* @see https://developer.apple.com/documentation/avfoundation/avassetexportsession/export_preset_names_for_quicktime_files_of_a_given_size
|
||||
*/
|
||||
type CompressVideoPresets =
|
||||
| '640x480'
|
||||
| '960x540'
|
||||
| '1280x720'
|
||||
| '1920x1080'
|
||||
| 'HEVC3840x2160'
|
||||
| 'LowQuality'
|
||||
| 'MediumQuality'
|
||||
| 'HighestQuality'
|
||||
| 'Passthrough';
|
||||
|
||||
/**
|
||||
* iOS smart album types
|
||||
*
|
||||
* @see https://developer.apple.com/documentation/photokit/phassetcollectionsubtype
|
||||
*/
|
||||
type SmartAlbums =
|
||||
| 'Regular'
|
||||
| 'SyncedEvent'
|
||||
| 'SyncedFaces'
|
||||
| 'SyncedAlbum'
|
||||
| 'Imported'
|
||||
| 'PhotoStream'
|
||||
| 'CloudShared'
|
||||
| 'Generic'
|
||||
| 'Panoramas'
|
||||
| 'Videos'
|
||||
| 'Favorites'
|
||||
| 'Timelapses'
|
||||
| 'AllHidden'
|
||||
| 'RecentlyAdded'
|
||||
| 'Bursts'
|
||||
| 'SlomoVideos'
|
||||
| 'UserLibrary'
|
||||
| 'Screenshots'
|
||||
| 'SelfPortraits'
|
||||
/** >= iOS 10.2 */
|
||||
| 'DepthEffect'
|
||||
/** >= iOS 10.3 */
|
||||
| 'LivePhotos'
|
||||
/** >= iOS 11 */
|
||||
| 'Animated'
|
||||
| 'LongExposure';
|
||||
|
||||
export interface Options {
|
||||
cropping?: boolean;
|
||||
width?: number;
|
||||
|
@ -19,9 +68,9 @@ declare module "react-native-image-crop-picker" {
|
|||
disableCropperColorSetters?: boolean;
|
||||
maxFiles?: number;
|
||||
waitAnimationEnd?: boolean;
|
||||
smartAlbums?: string[];
|
||||
smartAlbums?: SmartAlbums[];
|
||||
useFrontCamera?: boolean;
|
||||
compressVideoPreset?: string;
|
||||
compressVideoPreset?: CompressVideoPresets;
|
||||
compressImageMaxWidth?: number;
|
||||
compressImageMaxHeight?: number;
|
||||
compressImageQuality?: number;
|
||||
|
@ -60,6 +109,29 @@ declare module "react-native-image-crop-picker" {
|
|||
height: number;
|
||||
}
|
||||
|
||||
type PickerErrorCodeCommon =
|
||||
| 'E_PICKER_CANCELLED'
|
||||
| 'E_NO_IMAGE_DATA_FOUND'
|
||||
| 'E_PERMISSION_MISSING'
|
||||
| 'E_ERROR_WHILE_CLEANING_FILES';
|
||||
|
||||
type PickerErrorCodeIOS =
|
||||
| 'E_PICKER_CANNOT_RUN_CAMERA_ON_SIMULATOR'
|
||||
| 'E_PICKER_NO_CAMERA_PERMISSION'
|
||||
| 'E_CROPPER_IMAGE_NOT_FOUND'
|
||||
| 'E_CANNOT_SAVE_IMAGE'
|
||||
| 'E_CANNOT_PROCESS_VIDEO';
|
||||
|
||||
type PickerErrorCodeAndroid =
|
||||
| 'E_ACTIVITY_DOES_NOT_EXIST'
|
||||
| 'E_CALLBACK_ERROR'
|
||||
| 'E_FAILED_TO_SHOW_PICKER'
|
||||
| 'E_FAILED_TO_OPEN_CAMERA'
|
||||
| 'E_CAMERA_IS_NOT_AVAILABLE'
|
||||
| 'E_CANNOT_LAUNCH_CAMERA';
|
||||
|
||||
export type PickerErrorCode = PickerErrorCodeCommon | PickerErrorCodeIOS | PickerErrorCodeAndroid;
|
||||
|
||||
export function openPicker(options: Options): Promise<Image | Image[]>;
|
||||
export function openCamera(options: Options): Promise<Image | Image[]>;
|
||||
export function openCropper(options: Options): Promise<Image>;
|
||||
|
|
Loading…
Reference in New Issue