#3889 Add a 'blur' event to text input fields (#3896)

This commit is contained in:
Eddy Verbruggen
2017-04-20 16:57:03 +02:00
committed by Hristo Hristov
parent b6b5465d32
commit 9437f49aed
4 changed files with 6 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import { TextBase, Property, CssProperty, Style, Color, booleanConverter, makeVa
export * from "../text-base"; export * from "../text-base";
export abstract class EditableTextBase extends TextBase implements EditableTextBaseDefinition { export abstract class EditableTextBase extends TextBase implements EditableTextBaseDefinition {
public static blurEvent = "blur";
public keyboardType: KeyboardType; public keyboardType: KeyboardType;
public returnKeyType: ReturnKeyType; public returnKeyType: ReturnKeyType;

View File

@ -90,6 +90,8 @@ function initializeEditTextListeners(): void {
owner.dismissSoftInput(); owner.dismissSoftInput();
dismissKeyboardTimeoutId = null; dismissKeyboardTimeoutId = null;
}, 1); }, 1);
owner.notify({ eventName: EditableTextBase.blurEvent, object: owner });
} }
} }

View File

@ -8,6 +8,8 @@ import { TextBase, Property, CssProperty, Style, Color, FormattedString } from "
* Represents the base class for all editable text views. * Represents the base class for all editable text views.
*/ */
export class EditableTextBase extends TextBase { export class EditableTextBase extends TextBase {
public static blurEvent: string;
/** /**
* Gets or sets the soft keyboard type. * Gets or sets the soft keyboard type.
*/ */

View File

@ -10,6 +10,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
public nativeView: UITextField | UITextView; public nativeView: UITextField | UITextView;
public dismissSoftInput() { public dismissSoftInput() {
this.nativeView.resignFirstResponder(); this.nativeView.resignFirstResponder();
this.notify({ eventName: EditableTextBase.blurEvent, object: this });
} }
[keyboardTypeProperty.getDefault](): "datetime"| "phone" | "number" | "url" | "email" | string { [keyboardTypeProperty.getDefault](): "datetime"| "phone" | "number" | "url" | "email" | string {