Skip to content

Commit

Permalink
fix(android-textfield): returnPress fired twice for GO/SEARCH/SEND (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
manoldonev committed May 16, 2018
1 parent a86d41e commit ca444aa
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,8 @@ function initializeEditTextListeners(): void {
return false;
}

if (actionId === android.view.inputmethod.EditorInfo.IME_NULL ||
if (actionId === android.view.inputmethod.EditorInfo.IME_ACTION_DONE ||
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_UNSPECIFIED ||
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 ||
(event && event.getKeyCode() === android.view.KeyEvent.KEYCODE_ENTER)) {
// If it is TextField, close the keyboard. If it is TextView, do not close it since the TextView is multiline
// https://github.com/NativeScript/NativeScript/issues/3111
Expand All @@ -129,11 +125,9 @@ function initializeEditTextListeners(): void {
}

owner._onReturnPress();
}

// If action is ACTION_NEXT then do not close keyboard
if (actionId === android.view.inputmethod.EditorInfo.IME_ACTION_NEXT
|| actionId === android.view.inputmethod.EditorInfo.IME_ACTION_PREVIOUS) {
} else if (actionId === android.view.inputmethod.EditorInfo.IME_ACTION_NEXT ||
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_PREVIOUS) {
// do not close keyboard for ACTION_NEXT or ACTION_PREVIOUS
owner._onReturnPress();
}

Expand Down

0 comments on commit ca444aa

Please sign in to comment.