I have a VStack with TextField inside a sheet, sheet has a presentation detent of the exact height of the content. When editing starts, sheet seems to expand and show extra padding at the top and at the bottom. VStack is already ignoring safe area, but the padding is still visible. Why is it happening and how can I fix this?
Attaching minimal reproducible code:
struct TestView: View {
@State private var text = ""
var body: some View {
Color.white
.sheet(isPresented: .constant(true)) {
VStack(alignment: .leading, spacing: 0) {
Text("Title")
.frame(height: 30)
TextField("Text", text: $text)
.frame(height: 30)
}
.padding(20)
.background(Color.gray)
.ignoresSafeArea()
.presentationDetents([.height(100)])
}
}
}
Attaching screenshots of the sheet before and after editing starts, extra padding is white: