When a TextField is set to a rightToLeft layout, it gets strange and unnecessary padding on the left side. This pushes the text away from the edge. This issue doesn't occur in the leftToRight layout, where the text aligns correctly. Does anyone know how to get rid of this extra padding?
Environment:
- Xcode version: 26.0.1
- Device: iPhone 13
- iOS version: 26.0
Code:
struct ContentView: View {
@State var textInput: String = ""
var body: some View {
VStack {
Text("rightToLeft")
TextField("placeholder", text: $textInput)
.background(Color.red)
.environment(\.layoutDirection, .rightToLeft)
Text("leftToRight")
TextField("placeholder", text: $textInput)
.background(Color.red)
.environment(\.layoutDirection, .leftToRight)
}
.padding()
}
}