-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stacks and Spacers not behaving properly #336
Comments
The following example breaks after the first button click. It goes from taking up the whole page to just what is required to fit the HStack. struct ContentView: View {
@State var count: Int = 0
@State var items: [Int] = []
var body: some View {
ScrollView {
VStack {
HStack {
Spacer()
Button {
let numToAdd = 5
items.append(contentsOf:(count*numToAdd)..<(count*numToAdd + numToAdd))
count += 1
} label: {
Text("Click me")
}
Spacer()
.frame(width:10.0)
Text("Hello, world! Button clicked \(count) times.")
Spacer()
}
.padding()
VStack(alignment: .leading) {
ForEach(items, id: \.self) { item in
Text("Item \(item)")
}
}
Spacer()
}
}
.background(Color.red)
}
} I just tried Tokamak for the first time today. I'm very excited by its progress, nice work. |
Another thing I've noticed. frame modifiers for Spacers are not acting correctly. For example
setting minimum value acts as setting frame for it. It always have that value. Moreover. If I'm using
it does work. Where for HStack it doesn't |
Everything is captured here in this branch. In order to play with HStack please navigate to |
Another example: import TokamakDOM
struct TokamakApp: App {
var body: some Scene {
WindowGroup("spacer dead") {
ContentView()
}
}
}
// @main attribute is not supported in SwiftPM apps.
// See https://bugs.swift.org/browse/SR-12683 for more details.
TokamakApp.main()
struct ContentView: View {
var body: some View {
ScrollView(.vertical, showsIndicators: false) {
ZStack {
BodyView()
}
}
}
}
struct HeaderView: View {
var body: some View {
Text("Header")
}
}
struct BodyView: View {
var body: some View {
VStack {
HeaderView(coordinator: coordinator)
Spacer() // 💀 This spacer is not working 💀
FooterView()
}
}
}
struct FooterView: View {
var body: some View {
Text("Footer")
}
} |
Another thing I've noticed is that Spacer isn't working.
When I drop Stack ad spacer view is not stretch for the entire screen.
Many problems with them
Best way to play with it is to build some stuff and you will see.
I have project with different branches holding different issues states. Although, you can check develop and have a play.
The text was updated successfully, but these errors were encountered: