You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Android: Setting null KeyboardType on TextView causes no keyboard/input. #9194
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
CLI:
✔ Component nativescript has 7.1.2 version and is up to date.
✔ Component @nativescript/core has 7.1.4 version and is up to date.
✔ Component @nativescript/ios has 7.1.1 version and is up to date.
✔ Component @nativescript/android has 7.0.1 version and is up to date.
XCode Version: Version 12.4 (12D4e)
Plugin(s): Happens from scratch, see demo repo.
Describe the bug
I have a TextView wrapping component in @nativescript/angular. In this component I pass-through the keyboardType property, and set the default to null.
On iOS, the null default is as I would expect, a standard soft keyboard.
On Android, the keyboard does not show on the view and the caret does not show within the TextView.
Changing the keyboardType default to undefined shows the keyboard as expected, there probably shouldn't be a difference between undefined and null here, and the KeyboardType enum doesn't appear to have a 'default' option.
If you set the type to null, it should default and show the soft keyboard.
Currently this happens if you set the type to undefined.
Behaviour is correct on iOS.
In these cases there could be a case null where we set the keyboard to the default, but there is also a TYPE_NULL keyboard type in android which doesn't bring up the keyboard on on purpose.
Activity
janoshrubos commentedon Feb 7, 2021
NativeScript/packages/core/ui/editable-text-base/index.android.ts
Line 255 in b688994
In these cases there could be a
case nullwhere we set the keyboard to the default, but there is also aTYPE_NULLkeyboard type in android which doesn't bring up the keyboard on on purpose.Maybe is this an expected behavior?
jamescodesthings commentedon Feb 10, 2021
I've just checked what the iOS version of this is doing to compare.
I don't think it's expected behaviour, In the iOS side the keyboard type is either parsed or set to default:
This would make sense on the android side too. You could still pass the native value, but the fallback for an invalid value would be the default.
It might also be worth updating the typings to show that the property can accept the native value?
Will open a PR when I get the time.
fix(android): null keyboardType shows the default text keyboard (#11576)