I'm trying to make a simple animation that indicates the progress of the upload. For that I use the great react-native-fetch-blob
library in order to upload and track the progress of the upload. I'm updating the state as you can see below but I'm having a hard time animating the width of my view.
.uploadProgress({ interval : 50 },(written, total) => {
this.setState({progressBarValue: parseInt((written / total) * 100)});
console.log("State Progress Value", this.state.progressBarValue);
})
I tried with Animated.View
and the interpolate function to map the values but It did not work. With the method below it is animating but I can't the values to match my screen size.
<View style={{position: 'absolute', top:0, right:0, left:0, height: 2}}>
<Animated.View style={[
{ backgroundColor: 'red', height: 2},
{
width: this.state.progressBarValue
}
]} />
</View>
I know there are already built components to display progress but I want to animate during the time I'm uploading the photo with the progress value that I get from the callback.
Do you have any ideas ?