glepur / react-native-swipe-gestures

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

Anyone Working about Enable/Disable Swipe? #58

Open Eumhongin opened 4 years ago

Eumhongin commented 4 years ago

i am using react-native-carousel inside react-native-swipe-gestures but... recognize duplicate in my view..

stevesobol commented 3 years ago

Please tell me if I'm not interpreting your problem correctly...

TL,DR: I'm not familiar with react-native-carousel, but I can offer this: make sure that the carousel component, or a parent component, isn't handling swipes itself.

Today, I'm working on an app that uses a Stack.Navigator. Specifically, I'm working on the main screen of the app, where you're supposed to swipe right to log out. Do that, and I put up a dialog asking for confirmation, and only navigate back to my app's login screen if you confirm that you want to log out.

I had it working, but if I swiped from the left edge of my phone's screen, it navigated back to the login screen without executing my "confirm that the user wants to log out" logic. So I set gestureEnabled to false on each of the screens handled by the navigator, and now my logic, and only my logic, processes swipes.