For different reasons I'm trying to reproduce the pan behaviour of a scroll view. I'm using Animated.decay in my PanResponder, but I need to clamp the values between 0 and the size of my content so it doesn't go out of bounds
I used Animated.diffClamp to do that, but it doesn't exactly clamp the values of the AnimatedValue, it just creates a new clamped AnimatedValue from that value.
The best solution for me would be to be able to specify bounds in the Animated.decay configuration, such as:
Animated.decay(this.state.animatedPos, {
velocity: {vx: vx, vy: vy},
bounds: [0, viewWidth, 0, viewHeight]
}).start();
But I didn't see anything like that in the doc. What would be the best way to achieve that?
Thanks!