Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PanGestureHandler only for vertical movement #388

Closed
enahum opened this issue Dec 18, 2018 · 4 comments
Closed

PanGestureHandler only for vertical movement #388

enahum opened this issue Dec 18, 2018 · 4 comments

Comments

@enahum
Copy link

enahum commented Dec 18, 2018

This is more of a question really.

I have tried every combination that I could think of but the gesture event is still triggering for horizontal movement when I only want it to become active on vertical movement only.

Any pointers?

source code available here https://github.com/mattermost/mattermost-mobile/blob/master/app/components/slide_up_panel/slide_up_panel.js

@wcandillon
Copy link

If you need only one direction, the ScrollView component might be enough for you (you can get a version from gesture-handler which is wrap to support BaseGestureHandler.
Otherwise, if you only listen to translationY, then it will only work for vertical movement if that makes sense.
You can also play with the activeOffsetY property. For instance activeOffsetY={[-10, 10]} will only activate the gesture handler when vertically swiped up or down to 10 pixels.

I hope this helps.

@dmitryshelomanov
Copy link

@wcandillon how to move element only down ? And less the original position or equal.

@ShaharyarMaroof
Copy link

@userbq201 I've done this to handle the swipe down gesture only. In the onHandlerStateChange for the PanGestureHandler, I've checked if the nativeEvent.velocityY > 0 which means it is swiping down.

@jakub-gonet
Copy link
Member

Seems to be resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants