11import React from 'react' ;
2- import PropTypes from 'prop-types' ;
32import { View , StyleSheet , Animated } from 'react-native' ;
4- import AnimatedImage from '../animatedImage' ;
3+ import AnimatedImage , { AnimatedImageProps } from '../animatedImage' ;
54import { Colors } from '../../style' ;
65
76/**
8- * @description : Image component that loads first a small thumbnail of the images,
7+ * @description : Image component that loads first a small thumbnail of the images,
98 * and fades-in the full-sized image with animation once it's loaded
109 * @extends : AnimatedImage
1110 * @example : https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/ProgressiveImageScreen.js
1211 */
13- class ProgressiveImage extends React . Component {
12+
13+ export type ProgressiveImageProps = {
14+ /**
15+ * small thumbnail source to display while the full-size image is loading
16+ */
17+ thumbnailSource : AnimatedImageProps [ 'source' ] ;
18+ } ;
19+
20+ class ProgressiveImage extends React . Component < ProgressiveImageProps , { } > {
1421 static displayName = 'ProgressiveImage' ;
15- static propTypes = {
16- /**
17- * small thumbnail source to display while the full-size image is loading
18- */
19- thumbnailSource : PropTypes . object
20- } ;
2122
2223 thumbnailAnimated = new Animated . Value ( 0 ) ;
2324 imageAnimated = new Animated . Value ( 0 ) ;
2425
2526 getThumbnail = ( ) => {
2627 const { thumbnailSource, ...props } = this . props ;
2728
28- return (
29- < AnimatedImage
30- { ...props }
31- source = { thumbnailSource }
32- loader = { < View style = { styles . container } /> }
33- />
34- ) ;
29+ return < AnimatedImage { ...props } source = { thumbnailSource } loader = { < View style = { styles . container } /> } /> ;
3530 } ;
3631
37- render ( ) {
38- return (
39- < AnimatedImage
40- { ...this . props }
41- loader = { this . getThumbnail ( ) }
42- />
43- ) ;
32+ render ( ) {
33+ //@ts -ignore
34+ return < AnimatedImage { ...this . props } loader = { this . getThumbnail ( ) } /> ;
4435 }
4536}
4637
@@ -50,5 +41,4 @@ const styles = StyleSheet.create({
5041 }
5142} ) ;
5243
53-
5444export default ProgressiveImage ;
0 commit comments