xmartlabs / PagerTabStripView

🚀 Elegant Pager View fully written in pure SwiftUI.
MIT License
774 stars 88 forks source link

cannot swipe if PagerTabStripView in another PagerTabStripView #93

Closed fso-msrl closed 1 year ago

fso-msrl commented 2 years ago

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 commented 2 years ago

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

Thanks ! 😄

mlorenze commented 1 year ago

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

mlorenze commented 1 year ago

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:

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 commented 1 year ago

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

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