react-native-swipe-gestures icon indicating copy to clipboard operation
react-native-swipe-gestures copied to clipboard

Prevent unused directions being blocked.

Open flikQ opened this issue 8 years ago • 8 comments

Hi there,

I am making good use of the package at the moment however there seems to be an 'issue' or in my case likely an oversight. Most situations I am only applying a behaviour to one or 2 of the directions available, for example I am making use of left and right swipe in conjunction with a sliding pane component, however the gestures are blocking the regular up and down ScollView/ListView from being able to scroll up and down (forces them to 2 fingers). Even though I am omitting anything to do with the Swipe Up & Down, it seems those are still reserved (for lack of a better word) by the package regardless of whether they are used or not.

Is there a way to free up the unused gestures to perform their normal behaviour?

Thanks

flikQ avatar Nov 07 '17 16:11 flikQ

+1 Same here.

However, You can try my fork: https://github.com/thegamenicorus/react-native-swipe-gestures. I've add some configuration for enable/disable gesture direction.

<GestureRecognizer
      onSwipeLeft={this.doSomethingWithSwipeLeft}
      config={{
        detectSwipeUp: false,
        detectSwipeDown: false,
        detectSwipeRight: false
      }}
>
   //..list view
</GestureRecognizer>

It's ok for my project. Hope it help.

thegamenicorus avatar Nov 14 '17 08:11 thegamenicorus

@thegamenicorus this worked a charm for us, thanks! :)

flikQ avatar Nov 14 '17 15:11 flikQ

It will be really nice to include that solution in this repo

raideltorres avatar May 01 '18 17:05 raideltorres

@thegamenicorus That is exactly what I have been looking for, thank you for making that so easy.

ClintBaker avatar May 10 '18 23:05 ClintBaker

@thegamenicorus Perfect! Thanks!

lucasharada avatar Jun 14 '18 14:06 lucasharada

@thegamenicorus Thanks for your tweak, I have discovered a small bug however, if you disable a direction in one instance of GestureRecognizer it appears to be disabled for other instances too - I discovered this when trying to essentially make a way of swiping between screens and could only go in one direction until I stopped it being disabled on the first screen, the simple fix was to just not handle the opposite direction if it was not needed, but just thought it might be useful to know

dysfunctional-apps avatar Aug 16 '18 23:08 dysfunctional-apps

@thegamenicorus worked perfectly thanks! Would be nice to have this in the actual npm maintained repo.

dooleyb1 avatar Jan 31 '20 21:01 dooleyb1

For anyone looking out for a solution, you can try this library: https://www.npmjs.com/package/rn-swipe-gestures It's basically a clone of react-native-swipe-gestures. The only difference is you can add props to the config such as detectSwipeUp, detectSwipeDown, etc. This will solve your problem.

RazaShehryar avatar Mar 22 '21 08:03 RazaShehryar