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
448 stars 19 forks source link

presentation glitches when using `custom` detent #67

Open ohwhen opened 1 week ago

ohwhen commented 1 week ago

Have a weird issue where on iOS 17.* the presentation modifier is glitching (animating twice, opening full screen and then dismisses) when using a custom detent, works fine with .medium detent.

/// works
.presentation(transition: .sheet(detents: [.medium]), isPresented: $isPresenting) {
    Text("Test Sheet")
}

/// glitches
.presentation(transition: .sheet(detents: [.constant("checkoutView", height: 420)]), isPresented: $isPresenting) {
    Text("Test Sheet")
}

https://github.com/user-attachments/assets/f419a6d4-5193-490c-9190-ffc11c4bb9b6

nathantannar4 commented 1 day ago

Could you please share an example that reproduces? And how you are testing: Xcode version, simulator version.

I could not reproduce on Xcode 18.1, iOS 18.1/17.0

struct Issue67: View {
    var body: some View {
        ContentView()
    }

    struct ContentView: View {
        @State var isPresented = false
        var body: some View {
            VStack {
                Button("Present") {
                    withAnimation {
                        isPresented = true
                    }
                }
            }
            .presentation(
                transition: .sheet(
                    detents: [.constant("checkoutView", height: 420)]
                ),
                isPresented: $isPresented
            ) {
                Text("Test Sheet")
            }
        }
    }
}