-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
81 lines (75 loc) · 2.54 KB
/
index.js
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
import React,{
requireNativeComponent,
Component,
PropTypes,
View
} from 'react-native';
export default class ImageViewCache extends Component {
static propTypes = {
...View.propTypes,
src: PropTypes.string,
resizeMode : React.PropTypes.oneOf(["MATRIX","FIT_XY","FIT_START","FIT_CENTER","FIT_END","CENTER","CENTER_CROP","CENTER_INSIDE"]),
oval: PropTypes.bool,
onLoad : PropTypes.func,
scale: PropTypes.number,
};
constructor(props) {
super(props);
}
render() {
return <ImageCacheView {...this.props} />;
}
}
const ImageCacheView = requireNativeComponent('ImageViewCache', ImageViewCache, {
nativeOnly: {onChange: true}
});
export const resizeModes = {
/**
* Scale using the image matrix when drawing. The image matrix can be set using
* {@link ImageView#setImageMatrix(Matrix)}. From XML, use this syntax:
* <code>android:scaleType="matrix"</code>.
*/
matrix : "MATRIX",
/**
* Scale the image using {@link Matrix.ScaleToFit#FILL}.
* From XML, use this syntax: <code>android:scaleType="fitXY"</code>.
*/
fitXy : "FIT_XY",
/**
* Scale the image using {@link Matrix.ScaleToFit#START}.
* From XML, use this syntax: <code>android:scaleType="fitStart"</code>.
*/
fitStart : "FIT_START",
/**
* Scale the image using {@link Matrix.ScaleToFit#CENTER}.
* From XML, use this syntax:
* <code>android:scaleType="fitCenter"</code>.
*/
fitCenter : "FIT_CENTER",
/**
* Scale the image using {@link Matrix.ScaleToFit#END}.
* From XML, use this syntax: <code>android:scaleType="fitEnd"</code>.
*/
fitEnd : "FIT_END",
/**
* Center the image in the view, but perform no scaling.
* From XML, use this syntax: <code>android:scaleType="center"</code>.
*/
center : "CENTER",
/**
* Scale the image uniformly (maintain the image's aspect ratio) so
* that both dimensions (width and height) of the image will be equal
* to or larger than the corresponding dimension of the view
* (minus padding). The image is then centered in the view.
* From XML, use this syntax: <code>android:scaleType="centerCrop"</code>.
*/
centerCrop : "CENTER_CROP",
/**
* Scale the image uniformly (maintain the image's aspect ratio) so
* that both dimensions (width and height) of the image will be equal
* to or less than the corresponding dimension of the view
* (minus padding). The image is then centered in the view.
* From XML, use this syntax: <code>android:scaleType="centerInside"</code>.
*/
centerInside : "CENTER_INSIDE",
}