TokamakUI / Tokamak

SwiftUI-compatible framework for building browser apps with WebAssembly and native apps for other platforms
Apache License 2.0
2.57k stars 106 forks source link

ZStack doesn't render it's contents frames well #390

Open Joannis opened 3 years ago

Joannis commented 3 years ago

Describe the bug A ZStack doesn't respect its childrens' frame preferences. They're aligned in a grid which is constrained in size. So the ZStack renders its 'expected size' (without taking #387 into consideration). But the contents of this ZStack don't follow this pattern.

To Reproduce

struct TokamakApp: App {
    var body: some Scene {
        WindowGroup("Tokamak App") {
            ContentView()
        }
    }
}

struct ContentView: View {
    var body: some View {
        ZStack {
            Color(white: 0.15).frame(
                minWidth: 0,
                maxWidth: .infinity,
                minHeight: 0,
                maxHeight: .infinity
            )
        }.frame(
            minWidth: 0,
            maxWidth: .infinity,
            minHeight: 0,
            maxHeight: .infinity
        )
    }
}

Expected behavior The ZStack is rendered full-screen and its contents also are rendered in the full size of the ZStack frame.

Screenshots The view is black on the left, but nothing renders throughout the right.

image

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

j-f1 commented 3 years ago

I think a lot of these things will be fixed by abandoning CSS layout in favor of a custom solution in #379

Joannis commented 3 years ago

Thanks @j-f1, I hope so!