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

Nested interactive presentation transition issue #43

Closed PhilipDukhov closed 3 months ago

PhilipDukhov commented 3 months ago

In 1.2.0 it works as expected:

https://github.com/nathantannar4/Transmission/assets/6103621/4abd042b-1592-4a17-9890-25911399b0de

In 1.2.1 second sheet jumps when third presentation begins:

https://github.com/nathantannar4/Transmission/assets/6103621/dd7a0250-6423-4b85-9019-fff1979c6a04

struct Issue43: View {
    var body: some View {
        RecursiveSheet(index: 0)
    }
}

struct RecursiveSheet: View {
    var index: Int

    @State var isPresented = false

    var body: some View {
        Button("Show \(index + 1)") {
            withAnimation {
                isPresented = true
            }
        }
        .frame(maxWidth: .infinity, maxHeight: .infinity)
        .background(index % 2 == 0 ? Color.gray : Color.yellow)
        .overlay {
            Rectangle()
                .stroke((index % 2 == 0 ? Color.yellow : Color.gray), lineWidth: 4)
        }
        .presentation(
            transition: .slide(
                options: .init(
                    edge: .bottom,
                    prefersScaleEffect: true,
                    isInteractive: true
                )
            ),
            isPresented: $isPresented
        ) {
            RecursiveSheet(index: index + 1)
        }
    }
}
PhilipDukhov commented 3 months ago

This seems to be fixed in 1.2.2, thank you!