'SwiftUI 3: automatic keyboard avoidance for TextField in a ScrollView doesn't include padding
The automatic keyboard avoidance feature in (SwiftUI 3) doesn't move TextField up correctly if that TextField has a padding around and is inside a ScrollView.
Here is the code and result when the TextField is inside a ScrollView:
ScrollView {
VStack {
Rectangle().frame(height: 370)
Spacer()
Group {
TextField("enter text", text: $myText)
}
.padding()
.background(Color.gray)
}
}
and here's the code and result when the TextField is NOT inside the ScroolView:
VStack {
Spacer()
Group {
TextField("enter text", text: $myText)
}
.padding()
.background(Color.gray)
}
is there a way to move the TextField extra space up when it's inside a ScrollView ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


