Skip to content

Commit fee1dd9

Browse files
pgrzeszczakenchev
authored andcommitted
Do not dismiss keyboard on android, when text-field has return key type set to 'next' (NativeScript#3239)
1 parent 38d6484 commit fee1dd9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ export class EditableTextBase extends common.EditableTextBase {
3737
}
3838
var selectionStart = owner.android.getSelectionStart();
3939
owner.android.removeTextChangedListener(owner._textWatcher);
40-
40+
4141
//RemoveThisDoubleCall
4242
owner.style._updateTextDecoration();
4343
owner.style._updateTextTransform();
44-
44+
4545
owner.android.addTextChangedListener(owner._textWatcher);
4646
owner.android.setSelection(selectionStart);
4747
},
@@ -105,16 +105,19 @@ export class EditableTextBase extends common.EditableTextBase {
105105
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_GO ||
106106
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_SEARCH ||
107107
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_SEND ||
108-
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_NEXT ||
109108
(event && event.getKeyCode() === android.view.KeyEvent.KEYCODE_ENTER)) {
110-
109+
111110
// If it is TextField, close the keyboard. If it is TextView, do not close it since the TextView is multiline
112111
// https://github.com/NativeScript/NativeScript/issues/3111
113112
if (textView.getMaxLines() === 1){
114113
owner.dismissSoftInput();
115114
}
116115
owner._onReturnPress();
117116
}
117+
// If action is ACTION_NEXT then do not close keyboard
118+
if (actionId === android.view.inputmethod.EditorInfo.IME_ACTION_NEXT) {
119+
owner._onReturnPress();
120+
}
118121
}
119122

120123
return false;
@@ -313,4 +316,4 @@ export class EditableTextBase extends common.EditableTextBase {
313316
this.android.setKeyListener(null);
314317
}
315318
}
316-
}
319+
}

0 commit comments

Comments
 (0)