Recognizing Horizontal Swiping
seanavery opened this issue · 1 comments
Hi @glepur. I am having trouble triggering onSwipe
for horizontal swipe gestures. I have used default config parameters
const config = {
velocityThreshold: 0.3,
directionalOffsetThreshold: 100
};
I have messed around altering params but still cannot reliable horizontal swipe when using ios simulator.
Could you provide more context on the range of velocityThreshold
and directionalOffsetThreshold
Hi @seanavery.
velocityThreshold
is minimum swipe speed required to trigger callbacks. I'm comparing it to vx
and vy
properties of gestureState
internally.
directionalOffsetThreshold
is used so callbacks would not trigger on diagonal swipes. i.e. when you are swiping the screen horizontally if your total vertical movement when the gesture finishes is higher than directionalOffsetThreshold
callbacks will not trigger. Check dx
and dy
properties of gestureState
.
So basically if you have hard time triggering callbacks on simulator you would want to reduce velocityThreshold
and increase directionalOffsetThreshold
.
If you have any ideas about how to improve documentation, or this repo in general, I'd be happy to receive PR's.