forked from alwx/react-native-photo-view
-
Notifications
You must be signed in to change notification settings - Fork 35
/
index.d.ts
172 lines (162 loc) · 4.37 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
declare module "react-native-photo-view-ex" {
import * as React from 'react'
import {
AccessibilityProperties,
ImageRequireSource,
ImageURISource,
LayoutChangeEvent,
NativeSyntheticEvent,
StyleProp,
TransformsStyle,
} from 'react-native'
type PhotoViewResizeMode = "center" | "contain" | "cover" | "fitStart" | "fitEnd" | "stretch"
export interface PhotoViewStyle extends TransformsStyle {
bottom?: number,
display?: 'flex' | 'none',
end?: number,
flex?: number,
flexGrow?: number,
flexShrink?: number,
height?: number | string
left?: number,
margin?: number,
marginBottom?: number,
marginEnd?: number,
marginHorizontal?: number,
marginLeft?: number,
marginRight?: number,
marginStart?: number,
marginTop?: number,
marginVertical?: number,
maxHeight?: number,
maxWidth?: number,
minHeight?: number,
minWidth?: number,
opacity?: number,
position?: 'absolute' | 'relative',
right?: number,
start?: number,
top?: number,
width?: number | string,
zIndex?: number,
}
// helper for event interface
export interface PhotoViewEvent<T = {}> extends NativeSyntheticEvent<{}> {
nativeEvent: T
}
export type PhotoViewProgressEvent = PhotoViewEvent<{
loaded: number,
total: number,
}>
export type PhotoViewScaleEvent = PhotoViewEvent<{
scale: number,
scaleFactor: number,
focusX: number,
focusY: number,
}>
export type PhotoViewTapEvent = PhotoViewEvent<{
scale: number,
x: number,
y: number,
}>
export type PhotoViewViewTapEvent = PhotoViewEvent<{
scale: number,
x: number,
y: number,
}>
export interface PhotoViewProps extends AccessibilityProperties {
/**
* The same as `source` for other React images, except that it does not handle arrays.
*/
source: ImageRequireSource | ImageURISource;
/**
* Similarly to `source`, but used to render the loading indicator.
*
* __NOTE:__ Must be a local image.
*/
loadingIndicatorSource?: ImageRequireSource | ImageURISource;
/**
* Duration of image fade (in ms)
*/
fadeDuration?: number;
/**
* Set zoom scale programmatically.
*/
scale?: number;
/**
* The maximum allowed zoom scale.
* @default 3.0
*/
maximumZoomScale?: number;
/**
* The minimum allowed zoom scale.
* @default 1.0
*/
minimumZoomScale?: number;
/**
* __Android only:__ One of the default Android scale types.
* @default "cover"
*/
resizeMode?: PhotoViewResizeMode;
/**
* style supports a subset of the default react-native style.
*/
style?: StyleProp<PhotoViewStyle>;
/**
* __iOS only:__ When true, shows a horizontal scroll indicator.
* @default true
*/
showsHorizontalScrollIndicator?: boolean;
/**
* __iOS only:__ When true, shows a vertical scroll indicator.
* @default true
*/
showsVerticalScrollIndicator?: boolean;
/**
* __Android only:__ Double-tap zoom transition duration
*/
zoomTransitionDuration?: number;
/**
* A unique identifier for this element to be used in UI Automation testing scripts.
*/
testID?: string;
/**
* Invoked on load error.
* Currently, it sends nothing in `nativeEvent`.
*/
onError?: (error: PhotoViewEvent) => void;
/**
* Invoked on mount and layout changes.
*/
onLayout?: (event: LayoutChangeEvent) => any;
/**
* Invoked when load completes successfully.
*/
onLoad?: (event: PhotoViewEvent) => any;
/**
* Invoked when load either succeeds or fails.
*/
onLoadEnd?: (event: PhotoViewEvent) => any;
/**
* Invoked on load start.
*/
onLoadStart?: (event: PhotoViewEvent) => any;
/**
* __iOS only:__ Callback function invoked on download progress.
*/
onProgress?: (event: PhotoViewProgressEvent) => any;
/**
* Callback function called on scale changes.
*/
onScale?: (event: PhotoViewScaleEvent) => any;
/**
* Callback function called on image tap.
*/
onTap?: (event: PhotoViewTapEvent) => any;
/**
* Callback function called on tap outside of the image.
*/
onViewTap?: (event: PhotoViewViewTapEvent) => any;
}
export default class PhotoView extends React.Component<PhotoViewProps, any> {}
}