TextField text cursor going to the first position after value update
From @yassern on May 25, 2018 19:49
This bug is android only, I have a Slider and a TextField that have the same ngModel attribute reference and when the value of that attribute is updated, the cursor goes to the first position of the input, no matters if the user use the textfield or the slider.
Sample project: https://play.nativescript.org/?template=play-ng&id=O0oLGQ&v=1
Copied from original issue: NativeScript/nativescript-angular#1348
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Hi @yassern, Thank you for contacting us. I tested this case and found that it is reproducible also in a non-Angular project. For further info, please keep track on the issue.
Is there any workaround for this bug?
Seems this is open from last 2 years. Have anyone found any solution to this ?
This is the workaround which i found.
if (isAndroid) { setTimeout(() => { textField.android.setSelection(textField.text.length) }, 0) }
@faisalansari20 Thanks man, you avoided an afternoon headache. Didn't worked out without that timeout, but is still kinda annoying to see the cursor jumping back and forth. Hope they fix these little things some day
having this problem recently also