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

Content jumps when presenting nested ideal presentation #22

Closed PhilipDukhov closed 10 months ago

PhilipDukhov commented 11 months ago

I have second ideal presentation presented over the first one.

When the second one appears, first one moves down, so user can only see one at the time - which looks super cool.

But content of the second view jumps up without animation when animation starts. When second one is dismissed, first one appears with nice expected animation.

Below stop frame displays view state when animation starts:

@State var isPresented = false

var body: some View {
    ZStack {}
        .presentation(
            transition: .sheet(
                options: .init(
                    detents: [.ideal],
                    prefersSourceViewAlignment: true,
                    options: .init()
                )
            ),
            isPresented: .constant(true)
        ) {
            Button {
                withAnimation {
                    isPresented = true
                }
            } label: {
                Image(systemName: "photo.tv")
                    .resizable()
                    .frame(maxWidth: .infinity)
                    .aspectRatio(contentMode: .fill)
            }
            .frame(maxHeight: .infinity, alignment: .top)
                .presentation(
                    transition: .sheet(
                        options: .init(
                            detents: [.ideal],
                            options: .init(
                                preferredPresentationBackgroundColor: .red
                            )
                        )
                    ),
                    isPresented: $isPresented
                ) {
                    Text("title")
                }
        }
}
nathantannar4 commented 11 months ago

Will look into seeing if I can improve this by default!

nathantannar4 commented 10 months ago

Will be fixed in 1.1.0