似乎打开ModalView会将List单元的水平填充从16.0
更改为20.0
。有没有人注意到这种行为并找到解决方法?
简单示例的完整代码:
import SwiftUI
struct ContentView: View {
@State private var showModal: Bool = false
var body: some View {
List(0..<40) {_ in
Button(action: {
self.showModal = true
print("123")
}) {
Text("Hello World")
}.sheet(isPresented: self.$showModal) {
ModalView()
}
}
}
}
struct ModalView: View {
var body: some View {
Text("This is a modal")
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}