Skip to content
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

cannot swipe if PagerTabStripView in another PagerTabStripView #93

Closed
fso-msrl opened this issue Nov 3, 2022 · 4 comments
Closed

cannot swipe if PagerTabStripView in another PagerTabStripView #93

fso-msrl opened this issue Nov 3, 2022 · 4 comments

Comments

@fso-msrl
Copy link

fso-msrl commented Nov 3, 2022

Is your feature request related to a problem? Please describe.
My use case is my page have 2 levels, one for main-categories: A, B, C,
and one for sub-categories: B1, B2, B3
something like that:
A is some view
B is PagerTabStripView with 3 pages: B1, B2, B3 (both are some view)
C is some view
I can swipe from A to B, but I cant swipe from B1 to A, and
I can swipe from C to B, but I cant swipe from B3 to C

Describe the solution you'd like
I can swipe from B1 to A, and
I can swipe from B3 to C

Describe alternatives you've considered
none

Additional context
none

@coffmark
Copy link
Contributor

coffmark commented Nov 4, 2022

Could you please attach the code where the problem occurred?
I would like to understand your issue.

Thanks ! 😄

@mlorenze
Copy link
Contributor

Hi!
We are working in a solution for this behavior.

@mlorenze
Copy link
Contributor

mlorenze commented Jan 31, 2023

On master branch is implemented a solution for this behavior (available for iOS 16+).
In Readme is available this documentation to work with that:

The user can also configure if the swipe action is enable or not (the swipe is based on a drag gesture) and setup what edges have the gesture disabled.

Params:

  • swipeGestureEnabled: swipe is enabled or not (default is true).
  • edgeSwipeGestureDisabled: is an HorizontalContainerEdge (OptionSet) value where the array could have this options: .left, .right, .both or be empty (default is an empty array).

What is the importance to have this parameter?
Regarding the next PagerTabStripView example in MyPagerView2: if the pager is in the first page and the user try to swipe to the left, is possible to catch a parent view gesture (where this pager is embebbed) instead of catching the actual pager swipe gesture because it is disabled with the edgeSwipeGestureDisabled paramenter.

struct MyPagerView2: View {

    @State var selection = 1

    var body: some View {
        PagerTabStripView(swipeGestureEnabled: .constant(true),	
			  edgeSwipeGestureDisabled: .constant([.left]),
			  selection: $selection) {
            MyFirstView()
                .pagerTabItem(tag: 1) {
                    TitleNavBarItem(title: "Tab 1")
                }
            ...
            ..
            .
        }
    }
}

@mlorenze
Copy link
Contributor

Also is available an example in the Example App (in SegmentedView).

Here is the actual code:
Screenshot 2023-01-31 at 15 25 21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants