Kent
Kent

Reputation: 1374

SwiftUI, iOS 14, Keyboard Avoidance in Form{ TextEditor() }

I am having a problem on a simple Form{}. Automatic Keyboard Avoidance is not working. Below is a small form with a TextEditor(). When run, the keyboard sits on top the input field, requiring the user to scroll the view so thay can enter a location. Remove the Form{} and Automatic Keyboard Avoidance works. Am I missing something I need to do in a Form{} to get this behavior?

import SwiftUI
struct ContentView: View {
    @State private var stopLocation: String = ""
    var body: some View {
        Form {
            let desc = "\n\n\n\n\n\n\n\n\n\n\n\nEnter Location"
            Text(desc)
            VStack {
                TextEditor(text: $stopLocation)
            }
        }
    }
}

Upvotes: 9

Views: 388

Answers (0)

Related Questions