Search code examples
androidnativescriptnativescript-vue

How do I stop moving focus on Enter keypress in Nativescript (Android)?


Playground example: https://play.nativescript.org/?template=play-vue&id=FZ3GR1&v=4

I'm using Nativescript-Vue on an Android device, if you type a value into the first textfield and then press enter, focus is moved to the second textfield.

How do I stop this? I do not want the focus to change at all as I will be handling the Enter keypress. I can move the focus back but I would rather it didn't move at all.

I feel I'm missing something very obvious!?


Solution

  • Nativescript's TextField has a property called returnKeyType that sets the soft keyboard's return type. You can set it to done if you want to just close the keyboard.

    <TextField returnKeyType="done"></TextField>
    

    More information about that in the docs