Swipe events block scrolling

Swipe events block scrolling

  

Hi,

I want to implement swipe navigation on the screen in mobile app. I need only left and right swipe detection to trigger next/prev functionality. Adding SwipeEvents widget works fine for this purpose except that it also blocks vertical scroll on the assigned widget. Is there a workaround for only catching horizontal swipes?

Thanks

Solution

Hello Mykola,


I have some good and some bad news for you. If you clone the MobilePatterns eSpace, you'll be able to see that TouchEvents - which is used by SwipeEvents - relies on a JavaScript file named TouchTrack. This binds the touchstart, touchend, touchmove events to specific actions:

and

Unfortunately, the touch events doesn't include touch left and touch right.


A quick search on StackOverflow lead to very interesting answers on this subject. I'll suggest that you take a look and, surely, you'll end up having to do a custom version of the SwipeEvents. Once it's done, share with us :)


If you need further help, let us know so we can (try to) help you!


Happy (low)coding!

Solution

Hi Armando,

Thanks for you reply. 

I've ended up with quick fix - having clone of SwipeEvents and remove "prevent defaults" script and set false to input parameter of touch events and remove trigerrig up/down events. As our screen width is fixed  it now works as I want - have left/right swipes trigger some screen action and have normal vertical scroll.

Glad you worked it out! :)

I am facing same issue, Can anyone specify the Marked Solution, how to use it.

Thanks

Hi,

I just wanted to also point out that there is a forge component that could probably help you out:

https://www.outsystems.com/forge/component/3374/custom-touch-events/?Unfollow=False

Justin