FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(android-textfield): returnPress fired twice for GO/SEARCH/SEND (#… · NativeScript/NativeScript@ca444aa · GitHub

Commit ca444aa

Browse files
authored
fix(android-textfield): returnPress fired twice for GO/SEARCH/SEND (#5727)
1 parent a86d41e commit ca444aa

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,8 @@ function initializeEditTextListeners(): void {
115115
return false;
116116
}
117117

118-
if (actionId === android.view.inputmethod.EditorInfo.IME_NULL ||
118+
if (actionId === android.view.inputmethod.EditorInfo.IME_ACTION_DONE ||
119119
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_UNSPECIFIED ||
120-
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_DONE ||
121-
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_GO ||
122-
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_SEARCH ||
123-
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_SEND ||
124120
(event && event.getKeyCode() === android.view.KeyEvent.KEYCODE_ENTER)) {
125121
// If it is TextField, close the keyboard. If it is TextView, do not close it since the TextView is multiline
126122
// https://github.com/NativeScript/NativeScript/issues/3111
@@ -129,11 +125,9 @@ function initializeEditTextListeners(): void {
129125
}
130126

131127
owner._onReturnPress();
132-
}
133-
134-
// If action is ACTION_NEXT then do not close keyboard
135-
if (actionId === android.view.inputmethod.EditorInfo.IME_ACTION_NEXT
136-
|| actionId === android.view.inputmethod.EditorInfo.IME_ACTION_PREVIOUS) {
128+
} else if (actionId === android.view.inputmethod.EditorInfo.IME_ACTION_NEXT ||
129+
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_PREVIOUS) {
130+
// do not close keyboard for ACTION_NEXT or ACTION_PREVIOUS
137131
owner._onReturnPress();
138132
}
139133

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL