Add test of multiple progress callbacks to example.

This commit is contained in:
Dylan Vann 2017-07-26 21:33:21 -04:00
parent 1666f7c4e5
commit 8953b5aecd
1 changed files with 11 additions and 6 deletions

View File

@ -39,6 +39,14 @@ const getImages = () => {
]
}
const getTestProgressCallbacks = label => ({
onLoadStart: () => console.log(`${label} - onLoadStart`),
onProgress: e => console.log(`${label} - onProgress - ${e.nativeEvent.loaded / e.nativeEvent.total}`),
onLoad: () => console.log(`${label} - onLoad`),
onError: () => console.log(`${label} - onError`),
onLoadEnd: () => console.log(`${label} - onLoadEnd`),
})
const images = getImages()
class FastImageExample extends Component {
@ -90,6 +98,7 @@ class FastImageExample extends Component {
},
priority: FastImage.priority.low,
}}
{...getTestProgressCallbacks('1')}
/>
<FastImage
style={styles.image}
@ -100,6 +109,7 @@ class FastImageExample extends Component {
},
priority: FastImage.priority.normal,
}}
{...getTestProgressCallbacks('2')}
/>
<FastImage
style={styles.image}
@ -110,12 +120,7 @@ class FastImageExample extends Component {
},
priority: FastImage.priority.high,
}}
onLoadStart={() => console.log('onLoadStart')}
onProgress={e =>
console.log(e.nativeEvent.loaded / e.nativeEvent.total)}
onLoad={() => console.log('onLoad')}
onError={() => console.log('onError')}
onLoadEnd={() => console.log('onLoadEnd')}
{...getTestProgressCallbacks('3')}
/>
</ScrollView>
</View>