-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.d.ts
332 lines (249 loc) · 7.18 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
import { ImageStyle, StyleProp, ViewStyle } from 'react-native'
import React, { Ref } from 'react'
type ResizeMode = "contain" | "cover"
type CompressFormat = "jpeg" | "png"
type ScaleType = "contain" | "cover"
type Orientation = "vertical" | "horizontal"
type Priority = "low" | "normal" | "high"
type DiskCacheStrategy = "automatic" | "all" | "none" | "data" | "resource"
type Gravity = "left" | "top" | "right" | "bottom"
type LineCap = "butt" | "round" | "square"
export type ImageSource = {
uri?:string| null,
asGif?:boolean | null,
headers?:Object | null,
priority?:Priority,
placeholder?:string | null,
width?:number | null,
height?:number | null,
resizeMode?: ResizeMode,
skipMemoryCache?:boolean | null,
diskCacheStrategy?:DiskCacheStrategy,
}
type ImageError = {
error?:string | null
}
type ImageSuccess = {
width?:number,
height?:number
}
type EventImageError = {
nativeEvent?:ImageError | null,
}
type EventImageSuccess = {
nativeEvent?:ImageSuccess | null,
}
export interface ImageProps {
style?: StyleProp<ImageStyle>;
source:ImageSource | null;
scaleType?:ScaleType;
onLoadStart?:() => void | null;
onLoadEnd?:() => void | null;
onLoadError?:(event:EventImageError) => void | null;
onLoadSuccess?:(event:EventImageSuccess) => void | null;
}
export class Image extends React.Component<ImageProps> {
}
type PhotoKitRequestimage = {
uri?: string | null,
width?: number,
height?: number,
resizeMode?:ResizeMode
quality?: number,
format?: CompressFormat
}
type MediaQuery = "all" | "gif" | "image" | "photo" | "video" | "video_photo" | "video_gif"
type PhotoKitQuery = {
query?:MediaQuery,
limit?:number | null,
offset?:number | null,
names?:string[] | null
}
export type Media ={
albumId: number,
albumName: string,
displayName:string,
uri:string,
mediaType:string,
date:number,
duration:number,
height:number,
width:number
}
export type Album = {
id: number,
name:string,
count:number,
uri:string,
mediaType:string,
}
type PhotoKitResult ={
albums: Album[],
media: Media[]
}
export class PhotoKit {
static AUTHORIZED:number
static UNDETERMINED:number
static DENIED:number
static fetch(query:PhotoKitQuery | null): Promise<PhotoKitResult>
static requestRaw(uri?:string | null):Promise<string>
static requestImage(request:PhotoKitRequestimage):Promise<string>
static isPermissionGranted():Promise<boolean>
static requestPermission():Promise<number>
static clearMemoryCache():Promise<boolean>
static fetchAlbums(query:string): Promise<Album[]>
static requestImageByRef(ref:Image | undefined | null,format?:CompressFormat,quality?:number): Promise<string>
static clearImage(ref: Image | undefined | null): void
}
type ImageListViewOptions = {
spanCount?: number | null,
orientation?: Orientation,
selectable?:boolean | null,
selectableColor?:string| null,
selectableIconSize?:number| null,
threshold?: number | null,
videoIconVisible?:boolean | null,
videoIconSize?:number | null,
durationVisible?:boolean | null,
durationTextSize?:number | null,
progressVisible?:boolean | null,
progressSize?: number | null,
progressCellSize?:number | null,
progressColor?:string| null,
allowGif?:boolean | null
}
type ImageListViewResize = {
width?: number | null,
heigth?: number | null,
mode?: ResizeMode
}
type Margin = {
left?:number,
right?:number,
top?:number,
bottom?:number
}
type ImageListViewCell = {
size?: number | null,
backgroundColor?: string | null,
margin?: Margin | null,
scaleType?: ScaleType
}
type ImageListViewSource = {
data?: Object[] | null,
options?:ImageListViewOptions,
resize?:ImageListViewResize,
cell?:ImageListViewCell
}
type ImageListViewItem = {
uri?: string | null,
mediaType?: string | null
}
export type ImageListViewResultItemClicked = {
item?:ImageListViewItem | null
}
export type EventImageListViewItemClicked = {
nativeEvent:ImageListViewResultItemClicked
}
export interface ImageListViewProps{
style?: StyleProp<ViewStyle>
source?: ImageListViewSource | null
onEndReached?:()=>void
onItemClicked?:(event:EventImageListViewItemClicked)=> void
}
export class ImageListView extends React.Component<ImageListViewProps> {
addItems(arr:Object[]):void
getSelectedItems():Promise<Object[]>
}
export interface BadgeProps {
style?: StyleProp<ViewStyle>
text?:String | null
textSize?:number | null
font?:string | null
textColor?:string | null
strokeColor?:string | null
strokeWidth?:number | null
isTextHidden?:boolean| null
textOffsetX?:number | null
textOffsetY?:number | null
insetX?:number | null
insetY?:number | null
}
export class Badge extends React.Component<BadgeProps>{
}
type Output = {
quality?: number
format?: number
width?: number
height?: number
}
type CropperTransform = {
image?: string | null
rotate: number
flipVertically: boolean
flipHorizontally: boolean
output?: Output
}
type CropperCrop = {
image?: string | null
rect: Rect
crop: Rect
rotate: number
flipVertically: boolean
flipHorizontally: boolean
output?: Output
}
export class Cropper {
static jpeg:number
static png:number
static transform(t:CropperTransform): Promise<string>
static makeCrop(c:CropperCrop): Promise<string>
}
export class Toast {
static SHORT:number
static LONG:number
static show(msg:string,lenght:number): Promise<string>
}
export interface ClipRectProps {
gravity?:Gravity
inset?:number
progress?:number
}
export class ClipRectView extends React.Component<ClipRectProps> {
}
export interface CircleProgressProps {
strokeWidth?:number
colors?: string[] | null
positions?: number[] | null
backColors?: string[] | null
backPositions?: number[] | null
cap?: LineCap | null
progress?:number
}
export class CircleProgressView extends React.Component<CircleProgressProps>{
}
export type Rect = {
left:number
top:number
right:number
bottom:number
}
export class RectUtils {
static fitCenterRect: (width:number,height:number,cw:number,ch:number)=>Rect
static centerRect: (width:number,height:number,cw:number,ch:number)=>Rect
static offset: (rect:Rect,dx:number,dy:number)=>Rect
static scale: (rect:Rect,scale:number)=>Rect
static rotate: (rect:Rect,degrees:number)=>Rect
static inset: (rect:Rect,dx:number,dy:number)=>Rect
static insetBr: (rect:Rect,distance:number)=>Rect
static insetBl: (rect:Rect,distance:number)=>Rect
static insetTl: (rect:Rect,distance:number)=>Rect
static insetTr: (rect:Rect,distance:number)=>Rect
static insetBlr: (rect:Rect,distance:number)=>Rect
static insetTlr: (rect:Rect,distance:number)=>Rect
static insetLtb: (rect:Rect,distance:number)=>Rect
static insetRtb: (rect:Rect,distance:number)=>Rect
static width: (rect:Rect)=>number
static height: (rect:Rect)=>number
static contains: (rect:Rect,contains:Rect) => boolean
}