hzdg / hz-core

HZ's internal library of React Components 🚧
https://hz-core.netlify.com
0 stars 0 forks source link

[useGesture] add option to disable horizontal or vertical gesture detection #35

Open aamorozov opened 4 years ago

aamorozov commented 4 years ago

Description

Currently the hook tries to detect the gesture in both directions, which causes the issues with the carousels that need to be swiped only left to right/right to left.

Steps to Reproduce

Can be replicated here: https://hz-core.netlify.com/use-page-gesture#example Or here: https://2u.netlify.com/components/carousel

Expected Result

orientation prop on the options object that is being passed to usePageGesture hook should prevent detection of the orientation that is not specified. I.e. if horizontal is specified only that direction should be detected.

Actual Result

It looks like usePageGesture hook already accepts an options object with orientation prop on it, but it doesn't seem to have any affect at the moment.