I'd like to change the ScrollBar offset when tapping on a TextField in a ScrollBar which is located at the bottom (so keyboard avoidance will trigger).
When I select a TextField, the ScrollBar adjusts. But the bottom part of the TextField (the gray background) is cut off. Is there a way to adjust this so that the whole TextField is visible?
Thanks for answering!
struct ContentView: View {
var body: some View {
VStack {
ScrollView {
ForEach(0..<20, id: \.self) { i in
TextField("Textfield \(i)", text: .constant(""))
.padding()
.background(Color.gray.opacity(0.2).cornerRadius(5))
.padding(.horizontal)
}
}
}
}
}