0

I've seen a few threads on keyboard avoidance but none seem to address my exact situation.

My view is basically laid out like this:

VStack() {

            Picker("Which tab?", selection: $selectedSegment) {
                ForEach(tab.indices, id: \.self) { index in
                    Text(tab[index])
                }
            }.pickerStyle(.segmented)
         
            
            HeaderSubView()
            
            if selectedSegment == 0 {
                ScrollView(){

                      TextField("Text1", text: $text1)
                      \\Just left one textfield for simplicity

                }
                    
                    FooterSubview()

}

When I click the textfield to type the footer slides up on top of the keyboard, blocking the textfield from being seen. How do I keep the selected textfield focused in the view?

I've tried using .ignoreSafeAreas() and I attempted a geometryReader but it didn't work as expected either.

bb4
  • 15
  • 3
  • Put your views inside ScrollView it will solve your issue for more detail check this [link](https://stackoverflow.com/questions/76473957/how-to-stop-view-content-from-moving-up-when-we-open-keyboard) – Iftikhar Hussain Orakzai Jun 24 '23 at 07:22
  • That doesn't work. The issue is I have a Scrollview embedded in a VStack, but I'm not sure how to fix it. – bb4 Jun 24 '23 at 17:30

0 Answers0