I want to present a textfield inside a sheet.
However when the keyboard is shown, the sheet view produces extra padding even though I explicitly set the frame of the textfield and the presentationDent to be the exact same height.
Reproducible example:
struct ContentView: View {
@State var showSheet: Bool = false
@State var text = ""
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
Button {
showSheet.toggle()
} label: {
Text("Show Sheet")
}
}
.sheet(isPresented: $showSheet) {
TextField("Hello", text: $text)
.frame(height: 44)
.background(.red)
.presentationDetents([.height(44)])
.presentationDragIndicator(.hidden)
}
}
}
Does anyone know how to resolve this issue?