glepur / react-native-swipe-gestures

4-directional swipe gestures for react-native
MIT License
607 stars 162 forks source link

Feature Request - onSwipeBegin #73

Open iway1 opened 2 years ago

iway1 commented 2 years ago

Right now, this component only supports running code when a swipe finishes. It'd be really nice if there was a way to trigger when a swipe begins.

GaraGentor commented 2 years ago

You can simply extend this package by yourself for your use case and save the changes with patch-package until this is updated.

I added a move callback to make some nice animations where my view moves into the same direction the swipe is going.

For you it should be something like that if this helps you:

Add the following in the index.js of react-native-swipe-gestures (see image 1 marked positions) now you can simply add a callback to the GestureRecognizer component which will execute a method from your component. "swipebegincallback" is the callback prop where you should pass in your method. I think this is a fast solution for you, maybe this helps.

Bildschirmfoto 2021-12-24 um 22 19 43