The ContentView
popups the underside sheet when press “+”:
struct ContentView: View {
var physique: some View {
VStack {
Button("+") {
isShowingAddingItem.toggle()
}
.sheet(isPresented: $isShowingAddingItem) {
AddingItemView(achieved: { merchandise in
theItems.append(merchandise)
}).presentationDetents([.medium, .large])
}
}
}
That is the underside sheet view:
struct AddingItemView: View {
@State var worth: String = ""
var physique: some View {
VStack {
HStack {
Textual content("take a look at")
TextField("Please enter worth", textual content: $worth)
.keyboardType(.numberPad)
.textFieldStyle(RoundedBorderTextFieldStyle())
}.padding()
Spacer()
}.background(Colour.white)
}
}
When the keyboard seems, then all of the content material is moved as much as the highest of the display screen. That’s the sheet is not the underside .presentationDetents([.medium, .large])
.
Anyway to disable the keyboard pushing the content material up?