So I am writing my app in typescript and I want to disable predictions which appear when you are typing something in input. I want to disable them even if they are enabled on the device. I get the reference to my input (textField) element like this, which works:
this.page.getViewById("place")
In nativescript documentation I don't see an option to turn off predictions programmatically, but I do know it can be done through native functions (https://developer.android.com/reference/android/widget/EditText.html) with setInputType
method and passing a flag TYPE_TEXT_FLAG_NO_SUGGESTIONS
.
So I access the native function like this:
var input_type = new android.text.InputType("TYPE_TEXT_FLAG_NO_SUGGESTIONS");
this.page.getViewById("place").android.setInputType( input_type );
But I guess I am initializing the InputType class incorrectly, because it throws an error:
First argument must be implementation object
Ah, for the love of God, finally worked with this:
this.page.getViewById<textFieldModule.TextField>("place").android.setInputType(android.text.InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);