react-native-image-zoom
react-native-image-zoom copied to clipboard
Reset zoom using animation
Actually, I would like to reset the image with a smooth animation, but the current reset() method does not make it smoothly. Maybe, exposing a public function (let's called resetAnimated()) that can achieve that. Something like this can work (I already test it):
public resetAnimated(duration) {
this.scale = 1;
this.positionX = 0;
this.positionY = 0;
Animated.parallel([
Animated.timing(this.animatedScale, {
toValue: this.scale,
duration
}),
Animated.timing(this.animatedPositionX, {
toValue: this.positionX,
duration
}),
Animated.timing(this.animatedPositionY, {
toValue: this.positionY,
duration
})
]).start(() => {
this.imageDidMove('centerOn');
});
}
For my case, I need something like this because I would like to achieve a similar behavior like zoom on Instagram pictures.
I can create a PR with this change but I would like to know your thoughts about this.
Thanks!