mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
implements #713
This commit is contained in:
@ -81,8 +81,10 @@ export class EditableTextBase extends common.EditableTextBase {
|
|||||||
if (actionId === android.view.inputmethod.EditorInfo.IME_ACTION_DONE ||
|
if (actionId === android.view.inputmethod.EditorInfo.IME_ACTION_DONE ||
|
||||||
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_GO ||
|
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_GO ||
|
||||||
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_SEARCH ||
|
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.dismissSoftInput();
|
||||||
|
owner._onReturnPress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,6 +98,10 @@ export class EditableTextBase extends common.EditableTextBase {
|
|||||||
// abstract
|
// abstract
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public _onReturnPress() {
|
||||||
|
// abstract
|
||||||
|
}
|
||||||
|
|
||||||
public _onDetached(force?: boolean) {
|
public _onDetached(force?: boolean) {
|
||||||
this._imm = undefined;
|
this._imm = undefined;
|
||||||
this._android = undefined;
|
this._android = undefined;
|
||||||
|
@ -13,6 +13,8 @@ export var secureProperty = new dependencyObservable.Property(
|
|||||||
global.moduleMerge(textBase, exports);
|
global.moduleMerge(textBase, exports);
|
||||||
|
|
||||||
export class TextField extends editableTextBase.EditableTextBase implements definition.TextField {
|
export class TextField extends editableTextBase.EditableTextBase implements definition.TextField {
|
||||||
|
public static returnPressEvent = "returnPress";
|
||||||
|
|
||||||
constructor(options?: definition.Options) {
|
constructor(options?: definition.Options) {
|
||||||
super(options);
|
super(options);
|
||||||
}
|
}
|
||||||
|
@ -49,4 +49,8 @@ export class TextField extends common.TextField {
|
|||||||
this.android.setMaxLines(1);
|
this.android.setMaxLines(1);
|
||||||
this.android.setHorizontallyScrolling(true);
|
this.android.setHorizontallyScrolling(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public _onReturnPress() {
|
||||||
|
this.notify({ eventName: TextField.returnPressEvent, object: this })
|
||||||
|
}
|
||||||
}
|
}
|
2
ui/text-field/text-field.d.ts
vendored
2
ui/text-field/text-field.d.ts
vendored
@ -8,6 +8,8 @@ declare module "ui/text-field" {
|
|||||||
* Represents an editable text field.
|
* Represents an editable text field.
|
||||||
*/
|
*/
|
||||||
export class TextField extends editableTextBase.EditableTextBase {
|
export class TextField extends editableTextBase.EditableTextBase {
|
||||||
|
public static returnPressEvent: string;
|
||||||
|
|
||||||
constructor(options?: editableTextBase.Options);
|
constructor(options?: editableTextBase.Options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,6 +50,7 @@ class UITextFieldDelegateImpl extends NSObject implements UITextFieldDelegate {
|
|||||||
public textFieldShouldReturn(textField: UITextField): boolean {
|
public textFieldShouldReturn(textField: UITextField): boolean {
|
||||||
// Called when the user presses the return button.
|
// Called when the user presses the return button.
|
||||||
this._owner.dismissSoftInput();
|
this._owner.dismissSoftInput();
|
||||||
|
this._owner.notify({ eventName: TextField.returnPressEvent, object: this._owner });
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user