I'm finding that `TextField`s on iOS are often ins...
# compose-ios
j
I'm finding that `TextField`s on iOS are often inserting spaces between characters when tapping within the text field or long-press moving the cursor. The
onValueChange
lambda is being called with the additional space added after tapping/dragging. The space is added where the cursor is before the tap/drag cursor move. It seems to limit the change to one space between each character. Tapping around eventually results in a space between each character. E.g. typing t-e-s-t and tapping/dragging around:
Copy code
t
te
tes
test
te st
t e st
t e s t
Any idea what's going on here? It's the same behavior on Jetbrains Compose plugin 1.6.10-1.8.1 and Kotlin 2.0.21-2.1.21.
Ok, weird. It's doing this same thing in a
TextField
in SwiftUI! Maybe this is a bug with the iOS simulator?
My theory is this has something to do with the gesture for moving the cursor by holding down the space bar. I can reproduce the same behavior of a space being added by holding down the space bar and dragging to move the cursor. A space is added when the space bar is held down right at the same time as the keys turn blank, allowing to drag to move the cursor. A space only appears if there isn't already a space either before or after the cursor. With the space bar gesture, it only adds one space when the gesture first begins. With the long-press drag gesture, it will continuously add spaces everywhere you drag the cursor to if there's not already a space between the characters.
Apparently this is caused by the "Predictive Text" keyboard setting. I have no idea why, but turning off this setting fixes this issue in the iOS simulator. No more spaces added between characters when moving the cursor! Hopefully this is helpful if someone else runs into this.
😮 2
🙈 1