import React, { Component } from 'react' import { StyleSheet, View, Text } from 'react-native' import withCacheBust from './withCacheBust' import SectionFlex from './SectionFlex' import FastImage from 'react-native-fast-image' import Section from './Section' import FeatureText from './FeatureText' const IMAGE_URL = 'https://media.giphy.com/media/GEsoqZDGVoisw/giphy.gif' class ProgressExample extends Component { state = { mount: new Date(), start: undefined, progress: undefined, end: undefined, } render() { const { onPressReload, bust } = this.props const { mount, start, progress, end } = this.state return (
this.setState({ start: Date.now() })} onProgress={e => this.setState({ progress: Math.round( 100 * (e.nativeEvent.loaded / e.nativeEvent.total), ), }) } onLoad={() => this.setState({ end: Date.now() })} onLoadEnd={() => {}} /> onLoadStart {start !== undefined && ` - ${start - mount} ms`} onProgress {progress !== undefined && ` - ${progress} %`} onLoad {end !== undefined && ` - ${end - mount} ms`}
) } } const styles = StyleSheet.create({ image: { height: 100, backgroundColor: '#ddd', margin: 20, width: 100, flex: 0, }, }) export default withCacheBust(ProgressExample)