I'm building an app with NativeScript 6.4.1 and Angular 8.
My objective: dismiss the keyboard if the user taps outside of the text box.
I have read the documentation here:
https://docs.nativescript.org/angular/ui/ng-components/text-field
It indicates that there is indeed a 'blur' event that I can use.
From the documentation:
<TextField hint="Enter Date"
[text]='name'
secure="false"
keyboardType="datetime"
returnKeyType="done"
(returnPress)="onReturnPress($event)"
autocorrect="false"
maxLength="10"
(focus)="onFocus($event)"
(blur)="onBlur($event)">
</TextField>
I have tried to implement this 'blur' even in my code and the event does not appear to fire. Here is my playground: https://play.nativescript.org/?template=play-ng&id=vLwHYf&v=4
code snippet:
<TextField
(blur)="onBlur($event)"
returnKeyType="done"
autocorrect="false"
autocapitalizationType="none">
</TextField>
public onBlur(args) {
console.log(' on blur '); //this code is not executed
var myTextField = args.object;
myTextField.dismissSoftInput();
}
I'm building an app with NativeScript 6.4.1 and Angular 8.
My objective: dismiss the keyboard if the user taps outside of the text box.
I have read the documentation here:
https://docs.nativescript.org/angular/ui/ng-components/text-field
It indicates that there is indeed a 'blur' event that I can use.
From the documentation:
I have tried to implement this 'blur' even in my code and the event does not appear to fire. Here is my playground: https://play.nativescript.org/?template=play-ng&id=vLwHYf&v=4
code snippet: