I'm having an issue with SwiftUI where only the top part of the button is clickable, while the bottom part is not clickable at all.
Here is my code snippet. Does anyone know how I can fix this?
var body: some View {
VStack(spacing: 0) {
ScrollView(.horizontal) {
HStack {
Button(action: {}, label: {
ZStack {
Color.green
Text("Button")
.padding(8)
.contentShape(Rectangle())
}
})
}
}
.background(Color.blue)
.frame(height: 40)
TabView {
ZStack {
Color.yellow
Text("my view")
}
}
}
}
}
Selecting any option will automatically load the page