SwiftUI ModalView更改列表单元格的填充

时间:2019-10-20 23:35:39

标签: ios swift tableview swiftui

似乎打开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()
    }
}

padding 16

padding 20

0 个答案:

没有答案