From 8953b5aecdffbe108188a73904bedcba48717d3b Mon Sep 17 00:00:00 2001 From: Dylan Vann Date: Wed, 26 Jul 2017 21:33:21 -0400 Subject: [PATCH] Add test of multiple progress callbacks to example. --- example/FastImageExample.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/example/FastImageExample.js b/example/FastImageExample.js index 8a09932..fa3e177 100644 --- a/example/FastImageExample.js +++ b/example/FastImageExample.js @@ -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')} /> 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')} />