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
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.
@wcandillon how to move element only down ? And less the original position or equal.
@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.
Seems to be resolved.
Most helpful comment
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
activeOffsetYproperty. For instanceactiveOffsetY={[-10, 10]}will only activate the gesture handler when vertically swiped up or down to 10 pixels.I hope this helps.