Skip to content

Commit 8524a1e

Browse files
Rahul1dvtrifonov
authored andcommitted
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: #8523 Co-authored-by: Vasil Trifonov <v.trifonov@gmail.com>
1 parent a34a5a1 commit 8524a1e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

nativescript-core/ui/editable-text-base/editable-text-base.android.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,13 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
227227
this._keyListenerCache = listener;
228228
}
229229

230-
// clear the listener if editable is false
230+
// clear these fields instead of clearing listener.
231+
// this allows input Type to be changed even after editable is false.
231232
if (!this.editable) {
232-
nativeView.setKeyListener(null);
233+
nativeView.setFocusable(false);
234+
nativeView.setFocusableInTouchMode(false);
235+
nativeView.setLongClickable(false);
236+
nativeView.setClickable(false);
233237
}
234238
}
235239

0 commit comments

Comments
 (0)