From d43dd159c2f32e3326ee9fe4705b08844549b501 Mon Sep 17 00:00:00 2001 From: Shripal Soni Date: Tue, 29 Nov 2016 19:36:33 +0530 Subject: [PATCH] Fix for issue #3181 to maintain cursor position on toggle of secure field. (#3197) --- tns-core-modules/ui/text-field/text-field.android.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tns-core-modules/ui/text-field/text-field.android.ts b/tns-core-modules/ui/text-field/text-field.android.ts index 1f29772f6..95ad65d02 100644 --- a/tns-core-modules/ui/text-field/text-field.android.ts +++ b/tns-core-modules/ui/text-field/text-field.android.ts @@ -8,6 +8,7 @@ function onSecurePropertyChanged(data: dependencyObservable.PropertyChangeData) return; } + var cursorPosition = textField.android.getSelectionStart(); var currentInputType = textField.android.getInputType(); var currentClass = currentInputType & android.text.InputType.TYPE_MASK_CLASS; var currentFlags = currentInputType & android.text.InputType.TYPE_MASK_FLAGS; @@ -35,6 +36,7 @@ function onSecurePropertyChanged(data: dependencyObservable.PropertyChangeData) } textField.android.setInputType(newInputType); + textField.android.setSelection(cursorPosition); } // register the setNativeValue callbacks