mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
fix(android-textfield): returnPress fired twice for GO/SEARCH/SEND (#5727)
This commit is contained in:
@ -115,12 +115,8 @@ function initializeEditTextListeners(): void {
|
|||||||
return false;
|
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_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)) {
|
(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
|
// 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
|
// https://github.com/NativeScript/NativeScript/issues/3111
|
||||||
@ -129,11 +125,9 @@ function initializeEditTextListeners(): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
owner._onReturnPress();
|
owner._onReturnPress();
|
||||||
}
|
} else if (actionId === android.view.inputmethod.EditorInfo.IME_ACTION_NEXT ||
|
||||||
|
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_PREVIOUS) {
|
||||||
// If action is ACTION_NEXT then do not close keyboard
|
// do not close keyboard for ACTION_NEXT or ACTION_PREVIOUS
|
||||||
if (actionId === android.view.inputmethod.EditorInfo.IME_ACTION_NEXT
|
|
||||||
|| actionId === android.view.inputmethod.EditorInfo.IME_ACTION_PREVIOUS) {
|
|
||||||
owner._onReturnPress();
|
owner._onReturnPress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user