This commit is contained in:
Peter Staev
2015-09-24 19:13:23 +03:00
parent 84b3eb545d
commit 7ece24f714
5 changed files with 16 additions and 1 deletions

View File

@ -81,8 +81,10 @@ export class EditableTextBase extends common.EditableTextBase {
if (actionId === android.view.inputmethod.EditorInfo.IME_ACTION_DONE ||
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_GO ||
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_SEARCH ||
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_SEND) {
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_SEND ||
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_NEXT) {
owner.dismissSoftInput();
owner._onReturnPress();
}
}
@ -96,6 +98,10 @@ export class EditableTextBase extends common.EditableTextBase {
// abstract
}
public _onReturnPress() {
// abstract
}
public _onDetached(force?: boolean) {
this._imm = undefined;
this._android = undefined;

View File

@ -13,6 +13,8 @@ export var secureProperty = new dependencyObservable.Property(
global.moduleMerge(textBase, exports);
export class TextField extends editableTextBase.EditableTextBase implements definition.TextField {
public static returnPressEvent = "returnPress";
constructor(options?: definition.Options) {
super(options);
}

View File

@ -49,4 +49,8 @@ export class TextField extends common.TextField {
this.android.setMaxLines(1);
this.android.setHorizontallyScrolling(true);
}
public _onReturnPress() {
this.notify({ eventName: TextField.returnPressEvent, object: this })
}
}

View File

@ -8,6 +8,8 @@ declare module "ui/text-field" {
* Represents an editable text field.
*/
export class TextField extends editableTextBase.EditableTextBase {
public static returnPressEvent: string;
constructor(options?: editableTextBase.Options);
/**

View File

@ -50,6 +50,7 @@ class UITextFieldDelegateImpl extends NSObject implements UITextFieldDelegate {
public textFieldShouldReturn(textField: UITextField): boolean {
// Called when the user presses the return button.
this._owner.dismissSoftInput();
this._owner.notify({ eventName: TextField.returnPressEvent, object: this._owner });
return true;
}