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
[BUG] Pager within NavigationView scrolls to next page during edge swipe gesture (for navigating back) #252
Comments
I'm having the exact same issue, but with swiping from the top edge to view the notification center. |
Hi @robinst thanks for the suggestion. I'll take a look, I'm aware of the issue of that exists when you combine gestures in (or views that implicitly have a gesture) in SwiftUI. In UIKit there are option to request a gesture to fail before being recognized but the same doesn't apply here. I'll take a look at your suggestion. I can always create a beta version and get feedback from it. @denizdogan have you tried the suggestion above? |
Out of curiosity, have you tried |
@fermoya My use of the component is currently very "barebones", but I'm thinking maybe it would be simpler to just adjust the "gesturable area", so that it doesn't react when the touch starts outside of the safe area? |
That should be already possible, the library ships with Problem here is there's no such thing as a safe area here. Similarly, using I'll take a look at |
Yeah just tried that, it doesn't change anything.
Note that that breaks the "More" example where swiping is vertical or right to left (because of |
this should be fixed here in case you want to check it out: |
Yess, that fixes it, thank you :)! Hopefully it fixes @denizdogan's problem too. |
Thanks for the quick fix @fermoya, I've bought you a few coffees as a thank you :) |
@fermoya So you just to circle back, |
@denizdogan try the mates version |
@fermoya Sorry, I should have mentioned I was already using 2.3.3. That's unfortunate to hear, IMO the library would do good to allow us to define offsets from the edges where the pager should ignore gestures. |
@denizdogan please open a new issue and share your code or a small snippet to reproduce, maybe a video too. But please, first check out the examples in the repo. I’m using a please open a new thread |
Describe the bug
When using a Pager within subview of a
NavigationView
and then navigating back using a swipe gesture from the left screen edge, the gesture causes the pager to go to the next page while the swipe gesture is being performed, see video below.To Reproduce
NavigationView
that contains aNavigationLink
with a destination view that contains aPager
Expected: Navigates back to the previous view, the pager doesn't change.
Actual: The pager swipes to the next page while the gesture is being performed. It's doesn't always happen but pretty often, maybe depending on how quick the gesture is performed.
Code to reproduce (drop into the Examples in SwiftUIPagerExample):
Screenshots / Videos
SwiftUIPager.in.NavigationView.mp4
Notice how, while performing the edge swipe gesture to navigate back, the pager goes to the next page (from blue to red).
Environment:
Additional context
Some observations:
onDragChanged
inPagerContent
. When adding a print fornewOffset
at the end of the method, I'm getting values like 0.0, 4.0, -386.0. The last one seems strange. I'm not sure how exactly the ongoing gesture forNavigationView
affects the pager's gesture coordinates, but somewhere there seems to be the problem.swipeGesture
toDragGesture(minimumDistance: minimumDistance, coordinateSpace: .global)
, it fixes the problem in this particular case, but that would probably have other unintended side effects.The text was updated successfully, but these errors were encountered: