mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +08:00
Do not dismiss keyboard on android, when text-field has return key type set to 'next' (#3239)
This commit is contained in:

committed by
Vladimir Enchev

parent
38d6484539
commit
fee1dd9a59
@ -37,11 +37,11 @@ export class EditableTextBase extends common.EditableTextBase {
|
|||||||
}
|
}
|
||||||
var selectionStart = owner.android.getSelectionStart();
|
var selectionStart = owner.android.getSelectionStart();
|
||||||
owner.android.removeTextChangedListener(owner._textWatcher);
|
owner.android.removeTextChangedListener(owner._textWatcher);
|
||||||
|
|
||||||
//RemoveThisDoubleCall
|
//RemoveThisDoubleCall
|
||||||
owner.style._updateTextDecoration();
|
owner.style._updateTextDecoration();
|
||||||
owner.style._updateTextTransform();
|
owner.style._updateTextTransform();
|
||||||
|
|
||||||
owner.android.addTextChangedListener(owner._textWatcher);
|
owner.android.addTextChangedListener(owner._textWatcher);
|
||||||
owner.android.setSelection(selectionStart);
|
owner.android.setSelection(selectionStart);
|
||||||
},
|
},
|
||||||
@ -105,9 +105,8 @@ export class EditableTextBase extends common.EditableTextBase {
|
|||||||
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_GO ||
|
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_GO ||
|
||||||
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_SEARCH ||
|
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_SEARCH ||
|
||||||
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_SEND ||
|
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_SEND ||
|
||||||
actionId === android.view.inputmethod.EditorInfo.IME_ACTION_NEXT ||
|
|
||||||
(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
|
||||||
if (textView.getMaxLines() === 1){
|
if (textView.getMaxLines() === 1){
|
||||||
@ -115,6 +114,10 @@ export class EditableTextBase extends common.EditableTextBase {
|
|||||||
}
|
}
|
||||||
owner._onReturnPress();
|
owner._onReturnPress();
|
||||||
}
|
}
|
||||||
|
// If action is ACTION_NEXT then do not close keyboard
|
||||||
|
if (actionId === android.view.inputmethod.EditorInfo.IME_ACTION_NEXT) {
|
||||||
|
owner._onReturnPress();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -313,4 +316,4 @@ export class EditableTextBase extends common.EditableTextBase {
|
|||||||
this.android.setKeyListener(null);
|
this.android.setKeyListener(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user