Monday, October 23, 2023
HomeiOS Developmentios - SwiftUI: stop backside sheet transfer as much as full...

ios – SwiftUI: stop backside sheet transfer as much as full display screen


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)


    }

}

enter image description here

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]).

enter image description here

Anyway to disable the keyboard pushing the content material up?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments