From 9a92e65e537c8adb340ee8e97b763092f2d46ffc Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Fri, 11 Mar 2016 15:30:16 +0200 Subject: [PATCH] dismissSoftInput fixed --- ui/editable-text-base/editable-text-base.android.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ui/editable-text-base/editable-text-base.android.ts b/ui/editable-text-base/editable-text-base.android.ts index e66f71924..7c102c414 100644 --- a/ui/editable-text-base/editable-text-base.android.ts +++ b/ui/editable-text-base/editable-text-base.android.ts @@ -84,12 +84,16 @@ export class EditableTextBase extends common.EditableTextBase { var editorActionListener = new android.widget.TextView.OnEditorActionListener({ onEditorAction: function(textView: android.widget.TextView, actionId: number, event: android.view.KeyEvent): boolean { var owner = that.get(); - if (owner) { - if (!event) { + if (owner) { + 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_NEXT) { owner.dismissSoftInput(); } - else if (event.getKeyCode() === android.view.KeyEvent.KEYCODE_ENTER) { - owner.dismissSoftInput(); + + if (event && event.getKeyCode() === android.view.KeyEvent.KEYCODE_ENTER) { owner._onReturnPress(); } }