Skip to content

Commit 9437f49

Browse files
EddyVerbruggenHristo Hristov
authored andcommitted
NativeScript#3889 Add a 'blur' event to text input fields (NativeScript#3896)
1 parent b6b5465 commit 9437f49

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

tns-core-modules/ui/editable-text-base/editable-text-base-common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { TextBase, Property, CssProperty, Style, Color, booleanConverter, makeVa
44
export * from "../text-base";
55

66
export abstract class EditableTextBase extends TextBase implements EditableTextBaseDefinition {
7+
public static blurEvent = "blur";
78

89
public keyboardType: KeyboardType;
910
public returnKeyType: ReturnKeyType;

tns-core-modules/ui/editable-text-base/editable-text-base.android.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ function initializeEditTextListeners(): void {
9090
owner.dismissSoftInput();
9191
dismissKeyboardTimeoutId = null;
9292
}, 1);
93+
94+
owner.notify({ eventName: EditableTextBase.blurEvent, object: owner });
9395
}
9496
}
9597

tns-core-modules/ui/editable-text-base/editable-text-base.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { TextBase, Property, CssProperty, Style, Color, FormattedString } from "
88
* Represents the base class for all editable text views.
99
*/
1010
export class EditableTextBase extends TextBase {
11+
public static blurEvent: string;
12+
1113
/**
1214
* Gets or sets the soft keyboard type.
1315
*/

tns-core-modules/ui/editable-text-base/editable-text-base.ios.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
1010
public nativeView: UITextField | UITextView;
1111
public dismissSoftInput() {
1212
this.nativeView.resignFirstResponder();
13+
this.notify({ eventName: EditableTextBase.blurEvent, object: this });
1314
}
1415

1516
[keyboardTypeProperty.getDefault](): "datetime"| "phone" | "number" | "url" | "email" | string {

0 commit comments

Comments
 (0)