This repository has been archived by the owner on Oct 11, 2022. It is now read-only.
forked from ivpusic/react-native-image-crop-picker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
152 lines (140 loc) · 4.49 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
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;
height?: number;
multiple?: boolean;
path?: string;
includeBase64?: boolean;
includeExif?: boolean;
avoidEmptySpaceAroundImage?: boolean;
cropperActiveWidgetColor?: string;
cropperStatusBarColor?: string;
cropperToolbarColor?: string;
cropperToolbarTitle?: string;
cropperToolbarWidgetColor?: string;
freeStyleCropEnabled?: boolean;
cropperTintColor?: string;
cropperCircleOverlay?: boolean;
disableCropperColorSetters?: boolean;
maxFiles?: number;
waitAnimationEnd?: boolean;
smartAlbums?: SmartAlbums[];
useFrontCamera?: boolean;
compressVideoPreset?: CompressVideoPresets;
compressImageMaxWidth?: number;
compressImageMaxHeight?: number;
compressImageQuality?: number;
loadingLabelText?: string;
mediaType?: 'photo' | 'video' | 'any';
showsSelectedCount?: boolean;
forceJpg?: boolean;
sortOrder?: 'none' | 'asc' | 'desc';
showCropGuidelines?: boolean;
hideBottomControls?: boolean;
enableRotationGesture?: boolean;
cropperCancelText?: string;
cropperChooseText?: string;
writeTempFile?: boolean;
}
export interface Image {
path: string;
size: number;
data: null | string;
width: number;
height: number;
mime: string;
exif: null | object;
cropRect: null | CropRect;
filename: string;
creationDate: string;
modificationDate?: string;
duration: null | number;
}
export interface CropRect {
x: number;
y: number;
width: number;
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>;
export function clean(): Promise<void>;
export function cleanSingle(path: string): Promise<void>;
export interface ImageCropPicker {
openPicker(options: Options): Promise<Image | Image[]>;
openCamera(options: Options): Promise<Image | Image[]>;
openCropper(options: Options): Promise<Image>;
clean(): Promise<void>;
cleanSingle(path: string): Promise<void>;
}
const ImageCropPicker: ImageCropPicker;
export default ImageCropPicker;
}