@@ -39,44 +39,19 @@ function generateRequestId() {
39
39
}
40
40
41
41
/**
42
- * <Image> - A react component for displaying different types of images,
42
+ * A React component for displaying different types of images,
43
43
* including network images, static resources, temporary local images, and
44
- * images from local disk, such as the camera roll. Example usage:
44
+ * images from local disk, such as the camera roll.
45
45
*
46
- * renderImages: function() {
47
- * return (
48
- * <View>
49
- * <Image
50
- * style={styles.icon}
51
- * source={require('./myIcon.png')}
52
- * />
53
- * <Image
54
- * style={styles.logo}
55
- * source={{uri: 'https://facebook.github.io/react-native/img/opengraph.png'}}
56
- * />
57
- * </View>
58
- * );
59
- * },
60
- *
61
- * More example code in ImageExample.js
46
+ * See https://facebook.github.io/react-native/docs/image.html
62
47
*/
63
-
64
48
var Image = createReactClass ( {
65
49
displayName : 'Image' ,
66
50
propTypes : {
67
51
...ViewPropTypes ,
68
52
style : StyleSheetPropType ( ImageStylePropTypes ) ,
69
53
/**
70
- * `uri` is a string representing the resource identifier for the image, which
71
- * could be an http address, a local file path, or a static image
72
- * resource (which should be wrapped in the `require('./path/to/image.png')` function).
73
- *
74
- * `headers` is an object representing the HTTP headers to send along with the request
75
- * for a remote image.
76
- *
77
- * This prop can also contain several remote `uri`, specified together with
78
- * their width and height. The native side will then choose the best `uri` to display
79
- * based on the measured size of the image container.
54
+ * See https://facebook.github.io/react-native/docs/image.html#source
80
55
*/
81
56
source : PropTypes . oneOfType ( [
82
57
PropTypes . shape ( {
@@ -97,12 +72,12 @@ var Image = createReactClass({
97
72
] ) ,
98
73
/**
99
74
* blurRadius: the blur radius of the blur filter added to the image
75
+ *
76
+ * See https://facebook.github.io/react-native/docs/image.html#blurradius
100
77
*/
101
78
blurRadius : PropTypes . number ,
102
79
/**
103
- * similarly to `source`, this property represents the resource used to render
104
- * the loading indicator for the image, displayed until image is ready to be
105
- * displayed, typically after when it got downloaded from network.
80
+ * See https://facebook.github.io/react-native/docs/image.html#loadingindicatorsource
106
81
*/
107
82
loadingIndicatorSource : PropTypes . oneOfType ( [
108
83
PropTypes . shape ( {
@@ -137,40 +112,14 @@ var Image = createReactClass({
137
112
* The mechanism that should be used to resize the image when the image's dimensions
138
113
* differ from the image view's dimensions. Defaults to `auto`.
139
114
*
140
- * - `auto`: Use heuristics to pick between `resize` and `scale`.
141
- *
142
- * - `resize`: A software operation which changes the encoded image in memory before it
143
- * gets decoded. This should be used instead of `scale` when the image is much larger
144
- * than the view.
145
- *
146
- * - `scale`: The image gets drawn downscaled or upscaled. Compared to `resize`, `scale` is
147
- * faster (usually hardware accelerated) and produces higher quality images. This
148
- * should be used if the image is smaller than the view. It should also be used if the
149
- * image is slightly bigger than the view.
150
- *
151
- * More details about `resize` and `scale` can be found at http://frescolib.org/docs/resizing-rotating.html.
152
- *
153
- * @platform android
115
+ * See https://facebook.github.io/react-native/docs/image.html#resizemethod
154
116
*/
155
117
resizeMethod : PropTypes . oneOf ( [ 'auto' , 'resize' , 'scale' ] ) ,
156
118
/**
157
119
* Determines how to resize the image when the frame doesn't match the raw
158
120
* image dimensions.
159
121
*
160
- * 'cover': Scale the image uniformly (maintain the image's aspect ratio)
161
- * so that both dimensions (width and height) of the image will be equal
162
- * to or larger than the corresponding dimension of the view (minus padding).
163
- *
164
- * 'contain': Scale the image uniformly (maintain the image's aspect ratio)
165
- * so that both dimensions (width and height) of the image will be equal to
166
- * or less than the corresponding dimension of the view (minus padding).
167
- *
168
- * 'stretch': Scale width and height independently, This may change the
169
- * aspect ratio of the src.
170
- *
171
- * 'center': Scale the image down so that it is completely visible,
172
- * if bigger than the area of the view.
173
- * The image will not be scaled up.
122
+ * See https://facebook.github.io/react-native/docs/image.html#resizemode
174
123
*/
175
124
resizeMode : PropTypes . oneOf ( [ 'cover' , 'contain' , 'stretch' , 'center' ] ) ,
176
125
} ,
@@ -198,6 +147,8 @@ var Image = createReactClass({
198
147
/**
199
148
* Prefetches a remote image for later use by downloading it to the disk
200
149
* cache
150
+ *
151
+ * See https://facebook.github.io/react-native/docs/image.html#prefetch
201
152
*/
202
153
prefetch ( url : string , callback : ?Function ) {
203
154
const requestId = generateRequestId ( ) ;
@@ -206,7 +157,9 @@ var Image = createReactClass({
206
157
} ,
207
158
208
159
/**
209
- * Abort prefetch request
160
+ * Abort prefetch request.
161
+ *
162
+ * See https://facebook.github.io/react-native/docs/image.html#abortprefetch
210
163
*/
211
164
abortPrefetch ( requestId : number ) {
212
165
ImageLoader . abortRequest ( requestId ) ;
@@ -215,9 +168,7 @@ var Image = createReactClass({
215
168
/**
216
169
* Perform cache interrogation.
217
170
*
218
- * @param urls the list of image URLs to check the cache for.
219
- * @return a mapping from url to cache status, such as "disk" or "memory". If a requested URL is
220
- * not in the mapping, it means it's not in the cache.
171
+ * See https://facebook.github.io/react-native/docs/image.html#querycache
221
172
*/
222
173
async queryCache (
223
174
urls : Array < string > ,
@@ -226,9 +177,9 @@ var Image = createReactClass({
226
177
} ,
227
178
228
179
/**
229
- * Resolves an asset reference into an object which has the properties `uri`, `width`,
230
- * and `height`. The input may either be a number (opaque type returned by
231
- * require('./foo.png')) or an `ImageSource` like { uri: '<http location || file path>' }
180
+ * Resolves an asset reference into an object.
181
+ *
182
+ * See https://facebook.github.io/react-native/docs/image.html#resolveassetsource
232
183
*/
233
184
resolveAssetSource : resolveAssetSource ,
234
185
} ,
0 commit comments