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

Presentation resets whole environment #46

Closed PhilipDukhov closed 3 months ago

PhilipDukhov commented 3 months ago

PresentedView content shows 0, 10 is expected. It doesn't happen with a system .sheet.

struct Issue46: View {
    var body: some View {
        ZStack {

        }
//        .sheet(
        .presentation(
            isPresented: .constant(true)
        ) {
            PresentedView()
        }
        .lineSpacing(10)
    }
}

struct PresentedView: View {
    @Environment(\.lineSpacing) var lineSpacing

    var body: some View {
        Text(lineSpacing.description)
    }
}
nathantannar4 commented 3 months ago

Yea, this is a known limitation. Unfortunately SwiftUI doesn't correctly bridge the environment automatically. Its also not as simple as just copying over the environment that existed from the presenter, as that can override some of the environment values that SwiftUI does setup.

PhilipDukhov commented 3 months ago

Yea, this is a known limitation. Unfortunately SwiftUI doesn't correctly bridge the environment automatically. Its also not as simple as just copying over the environment that existed from the presenter, as that can override some of the environment values that SwiftUI does setup.

I see, thank you😌