-
-
Notifications
You must be signed in to change notification settings - Fork 986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to disable left swipe gesture in react-native-gesture-handler/Swipeable? #2409
Comments
This is the maximum explaination. |
You might be able to try: renderLeftActions={() => null} I have a list where I want to swipe right -> left to display a delete button, but I wanted to disable any other left -> right swiping, and that seemed to do the trick. |
I'm having the same issue too,It prevents the default right-swipe event for iOS to return to the previous page. How do you solve it? |
I'm also having this issue. I have a list of swipeable with a right action and no left action. However, when swiping from the left edge of the screen it blocks the ability to return to the previous page. |
I'm also having the same issue. I create a minimal reproduction snack |
Also having this issue. Has anyone come up with a fix? |
Hi! @luvnish19, could you please prepare a reproduction? I've tried to use the one provided by @alexandcote, but it seems to work fine (as you can see on the video below) Nagranie.z.ekranu.2024-01-15.o.09.28.55.mov |
+1 |
What I Do
Swipeable Components Source CodePanGestureHandler API |
@m-bert I just tested it again on my device and I was able to replicate the issue. I have an iPhone and I see you tried to replicate the issue on Android. Maybe the issue only affect iOS devices? |
I took some time and recorded a video Recording.480p.mov |
Thanks for pointing this out @alexandcote! You can disable left swipe by using <Swipeable
...
dragOffsetFromLeftEdge={Number.MAX_VALUE}
> will effectively disable swipe from left. Let me know if this is something that you were looking for! |
Description
We are creating a component similar like Instagram where we have a Posts screen and Messaging screen. When perform swipe from right to left, screen navigates from Posts screen to Messaging screen. For swiping, we are using @react-navigation/material-top-tabs
In Messaging screen, Flatlist component is used to show conversations list where react-native-gesture-handler/Swipeable is used to show controls which are delete and mute button when user performs "right to left" swipe similar like Instagram which is working 100% fine but when trying to navigating back to post screen using left to right swipe on Flatlist then react-native-gesture-handler/Swipeable gesture executes and their "onSwipeableOpen" callback calls which should not execute so that smoothly translation should be perform from Messaging to Post Screen.
As well as there is no way to disable left to right swipe on FlatList. Is there any solution/ workaround or any suggestion to achieve this task?
Steps to reproduce
Take reference of Instagram where we have Posts screen and Conversations Screen
Snack or a link to a repository
https://stackoverflow.com/questions/75369425/how-to-disable-left-swipe-gesture-in-react-native-gesture-handler-swipeable/75371366#75371366
Gesture Handler version
2.8.0
React Native version
0.70.6
Platforms
Android, iOS
JavaScript runtime
None
Workflow
None
Architecture
None
Build type
None
Device
None
Device model
No response
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: