How to remove speech to text (mic) from Google Keyboard in NativeScript?

255 Views Asked by At

I have tried a few options available in the following links. 1. Disable speech to text button (Micro phone) on soft input keyboard in android programmatically 2. How to disable displaying "suggestions" on the Soft Keyboard

doesn't seem to work.

<TextField fieldFocusClass returnKeyType="done" autocorrect="false" formControlName="pin" > </TextField>

1

There are 1 best solutions below

0
Manoj On

Well privateImeOptions doesn't seem to work with current version of Android. You could set input type to TYPE_TEXT_VARIATION_VISIBLE_PASSWORD

HTML

<TextField (loaded)="onLoaded($event)"></TextField>

TS

onLoaded(event) {
    const textField = event.object;
    if (textField.android) {
        setTimeout(() => {
            textField.android.setInputType(android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
        }, 500);
    }
}

Note: If you like to avoid timeout, you might want to extend existing textfield to create your own that applies custom input type.