Hi, I had written a program a while back that includes numerous textfields. Previously, when typing in those fields, if the input was longer than the width of the field, the cursor would move and it would scroll horizontally so you could see what was being typed. For some reason, it suddenly stopping doing that and I'm not sure why. I've tried removing all modifiers and all textfield styles with no luck. Any help with this would be immensely appreciated. Thanks!
Swift TextField Not Horizontally Scrolling
I've tried removing all modifiers
Is it UIKit or SwiftUI ?
SwiftUI, sorry I should have specified that.
I have the same issue. SwiftUI macOS 12.3.1.
I just tested in Xcode 13.2.1 and iOS 15.2 simulator. And in Xcode 13.3. with iOS 15.4. Also tested inside a NavigationView and a List.
struct ContentView: View {
@State var row = "Test"
var body: some View {
TextField("Fruit", text: $row)
}
}
Text scrolls correctly.
Please show the code.
Same for me with SwiftUI. I tried it with a small example project because I first thought, I had broken something but this was enough to reproduce the behaviour:
struct ContentView: View {
@State var testString: String = ""
var body: some View {
TextField("Test", text: $testString)
.frame(width: 200, height: 20, alignment: .center)
}
}
Thank y'all for the responses! The code you posted is almost identical to mine. Sure seems like it has something to do with some Mac update but it's stumping me.
@Raphael95 : I tested on SwiftUI Mac.
I used your exact code and typed: This is a test aa. Does it scroll on MacOS
Beginning of typing:
Later in typing
We see text has scrolled to the left.
I tested on MacOS 11.6.5 with Xcode 13.2.1.
I repeated the test on MacOS 12.3.1 Xcode 13.3.1 and Xcode 13.3 and Xcode 13.2: does NOT scroll indeed.
So problem seems to come from Monterey, not Xcode.
It is worth a bug report.