-
-
Notifications
You must be signed in to change notification settings - Fork 151
Expand file tree
/
Copy pathImage.res
More file actions
156 lines (128 loc) · 3.02 KB
/
Image.res
File metadata and controls
156 lines (128 loc) · 3.02 KB
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
include NativeElement
type cache = [
| #default
| #reload
| #"force-cache"
| #"only-if-cached"
]
type uriSource = {
uri: string,
bundle?: string,
method?: string,
headers?: dict<string>,
body?: string,
cache?: cache,
scale?: float,
width?: float,
height?: float,
}
module Source = {
type t
external fromRequired: Packager.required => t = "%identity"
external fromUriSource: uriSource => t = "%identity"
external fromUriSources: array<uriSource> => t = "%identity"
}
module ImageLoadEvent = {
type source = {
width: float,
height: float,
uri: string,
}
type payload = {
uri: Js.Nullable.t<string>,
source: source,
}
include Event.SyntheticEvent({
type _payload = payload
})
}
type imageLoadEvent = ImageLoadEvent.t
module ErrorEvent = {
type payload = {error: string}
include Event.SyntheticEvent({
type _payload = payload
})
}
type errorEvent = ErrorEvent.t
module ProgressEvent = {
type payload = {
loaded: float,
total: float,
}
include Event.SyntheticEvent({
type _payload = payload
})
}
type progressEvent = ProgressEvent.t
type resizeMethod = [#auto | #resize | #scale]
type referrerPolicy = [
| #"no-referrer"
| #"no-referrer-when-downgrade"
| #origin
| #"origin-when-cross-origin"
| #"same-origin"
| #"strict-origin"
| #"strict-origin-when-cross-origin"
| #"unsafe-url"
]
type crossOrigin = [
| #anonymous
| #"use-credentials"
]
type imageProps = {
accessibilityLabel?: string,
accessible?: bool,
alt?: string,
blurRadius?: float,
capInsets?: Rect.t,
crossOrigin?: crossOrigin,
defaultSource?: Source.t,
fadeDuration?: float,
height?: float,
loadingIndicatorSource?: array<Source.t>,
onError?: errorEvent => unit,
onLayout?: Event.layoutEvent => unit,
onLoad?: imageLoadEvent => unit,
onLoadEnd?: unit => unit,
onLoadStart?: unit => unit,
onPartialLoad?: unit => unit,
onProgress?: progressEvent => unit,
progressiveRenderingEnabled?: bool,
referrerPolicy?: referrerPolicy,
resizeMethod?: resizeMethod,
resizeMode?: Style.resizeMode,
resizeMultiplier?: float,
source: Source.t,
srcSet?: string,
style?: Style.t,
testID?: string,
tintColor?: Color.t,
width?: float,
}
type props = {
ref?: ref,
...imageProps,
}
@module("react-native")
external make: React.component<props> = "Image"
type sizeError
@module("react-native") @scope("Image")
external getSize: (
~uri: string,
~success: (~width: float, ~height: float) => unit,
~failure: sizeError => unit=?,
) => unit = "getSize"
type requestId
@module("react-native") @scope("Image")
external prefetch: (~uri: string) => requestId = "prefetch"
@module("react-native") @scope("Image")
external abortPrefetch: requestId => unit = "abortPrefetch"
@module("react-native") @scope("Image")
external queryCache: (~uris: array<string>) => unit = "queryCache"
type asset = {
uri: string,
width: float,
height: float,
}
@module("react-native") @scope("Image")
external resolveAssetSource: Source.t => asset = "resolveAssetSource"