-
Notifications
You must be signed in to change notification settings - Fork 18
/
ImageLoader.js
46 lines (39 loc) · 1.15 KB
/
ImageLoader.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
/*
* A smart image loader for react-native apps
* https://github.com/react-native-component/react-native-smart-image-loader/
* Released under the MIT license
* Copyright (c) 2016 react-native-component <[email protected]>
*/
import React, {
PropTypes,
Component,
} from 'react'
import {
View,
requireNativeComponent,
Platform
} from 'react-native'
export default class ImageLoader extends Component {
static propTypes = {
...View.propTypes,
options: PropTypes.shape({
src: PropTypes.string.isRequired,
placeholder: PropTypes.string,
threadSize: PropTypes.number, //only supports android
fadeInDuration: PropTypes.number, //only supports android
rowID: PropTypes.string, //test prop
}).isRequired,
}
constructor(props) {
super(props)
this.state = {}
}
render() {
return (
<NativeImageLoader
{...this.props}
/>
)
}
}
const NativeImageLoader = requireNativeComponent(Platform.OS == 'ios' ? 'RCTImageLazyLoader' : 'RCTLoaderImageView', ImageLoader)