nathantannar4 / Transmission

Bridges UIKit presentation APIs to a SwiftUI API so you can use presentation controllers, interactive transitions and more.
BSD 2-Clause "Simplified" License
378 stars 13 forks source link

Slide presentation gesture doesn't work while presented view is tab view with page style #53

Closed automactic closed 1 month ago

automactic commented 1 month ago

https://github.com/user-attachments/assets/a99729f2-eb99-4d32-9f20-6134e15716dd

Thanks for making and maintaining this very useful package!!

When the presented view is a TabView with page style (or a UIPageViewController), the interactive dismiss gesture for slide transition doesn't work. However, interestingly if the horizontal swipe gesture for the tab view / page view has started, then the dismiss gesture will work

Minimal reproducible case:

struct ContentView: View {
    @State private var items = (0..<100).map({Item(id: $0)})
    @State private var selectedItemID: Int = 0
    @State private var isPageViewPresented = false

    var body: some View {
        NavigationStack {
            List(items) { item in
                Button(item.name) {
                    withAnimation {
                        selectedItemID = item.id
                        isPageViewPresented = true
                    }
                }
            }.navigationTitle("List")
        }
        .presentation(transition: .slide, isPresented: $isPageViewPresented) {
            TabView(selection: $selectedItemID) {
                ForEach(items) { item in
                    Text(item.name).tag(item.id)
                }
            }.tabViewStyle(.page)
        }
    }
}

struct Item: Identifiable, Hashable {
    let id: Int

    var name: String {
        "Item: \(id)"
    }
}
nathantannar4 commented 1 month ago

Fixed in 1.4.2!