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

0

9

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)
            }
        }
    }
}
Spanish answered 9/8, 2021 at 23:46 Comment(1)
Answer is here https://mcmap.net/q/742618/-texteditor-is-obscured-by-keyboard-in-swiftui.Barbuto

© 2022 - 2024 — McMap. All rights reserved.