panresponder_demo
panresponder_demo copied to clipboard
How to limit X axis?
Hey @Hyra !!!
I've read your post about PanResponder and I have to say it is amazing.
What I'm not being able to acomplish is to limit the X value between X1 and X2. Lets try to clarify. When the object is rendered the first time it starts in position 0, so it should never be under zero.
This is what I've tried so far:
onPanResponderGrant: (e, gestureState) => {
let x = (this.state.pan.x._value < 0) ? 0 : this.state.pan.x._value;
this.state.pan.setOffset({ x, y: 0 });
},
Is there any way to do that?
Thanks man!!! I really appreciate your help.
hello, found any solution for this ?
Any Updates ?