mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
fix (android/TextField): set focusable, clickable to false when editable is false (#8525)
Do not clear key listener when editable is false This prevents the input type to be changed. Instead, we can set focusable, clickable to false. This allows to change input Type i.e (secure) at run time when editable is false. Reference issue: https://github.com/NativeScript/NativeScript/issues/8523 Co-authored-by: Vasil Trifonov <v.trifonov@gmail.com>
This commit is contained in:
@ -227,9 +227,13 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
|
||||
this._keyListenerCache = listener;
|
||||
}
|
||||
|
||||
// clear the listener if editable is false
|
||||
// clear these fields instead of clearing listener.
|
||||
// this allows input Type to be changed even after editable is false.
|
||||
if (!this.editable) {
|
||||
nativeView.setKeyListener(null);
|
||||
nativeView.setFocusable(false);
|
||||
nativeView.setFocusableInTouchMode(false);
|
||||
nativeView.setLongClickable(false);
|
||||
nativeView.setClickable(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user