[TIMOB-17203] TextField keyboardType: parity issues between iOS and Android
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-04-09T18:53:24.000+0000 |
Affected Version/s | Release 3.3.0 |
Fix Version/s | Release 9.0.1 |
Components | Android, iOS |
Labels | parity |
Reporter | Jon Alter |
Assignee | Yordan Banev |
Created | 2014-06-24T21:10:36.000+0000 |
Updated | 2020-06-02T13:54:46.000+0000 |
Description
KeyboardTypes KEYBOARD_NUMBER_PAD and KEYBOARD_DECIMAL_PAD do not act the same on iOS and Android.
Steps to repro:
0. Create a basic app with a window and add a textField to it (text field code is available below). 1. Create a textField with a keyboardType of Ti.UI.KEYBOARD_NUMBER_PAD 2. Run the app on iOS and Android 3. Notice that on iOS there are numbers but no decimal point 4. Notice on Android there are numbers and a decimal point, and you can type as many decimal points as you like. 5. Create a textField with a keyboardType of Ti.UI.KEYBOARD_DECIMAL_PAD 6. Run the app on iOS and Android 7. Notice that on iOS there are numbers and a decimal point, and you can type as many decimal points as you like. 8. Notice on Android there are numbers and a decimal point, but you can only type one decimal point. In our documentation is says: "Use a keyboard with decimal numbers only". http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI-property-KEYBOARD_DECIMAL_PAD So this seems like it would be correct behavior of Android, but it is not consistent across both platforms.Workaround
Set different keyboardtypes for iOS and Android
var ipAddress = Ti.UI.createTextField({
hintText: 'IP Address',
top: 10,
height: 40,
borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
autocapitalization: Ti.UI.TEXT_AUTOCAPITALIZATION_NONE,
keyboardType: (Ti.Platform.name === 'android') ? Ti.UI.KEYBOARD_NUMBER_PAD : Ti.UI.KEYBOARD_DECIMAL_PAD
});
Issue reproduces Titanium SDK version 3.4.0 master, 3.3.0.GA Titanium Studio, build: 3.3.0.201407100905 Titanium Command-Line Interface CLI version 3.3.0, Android device : Motorola Moto G, Android version : 4.4.4 iOS simulator : iPhone Retina (3.5-inch), iOS 7.0.3
Just found this bug in my app... This should be an easy fix?... Why is it not scheduled to be fixed yet?... This breaks all my applications...
Titanium SDK version 3.4.0 master, 3.3.0.GA Titanium Studio, build: 3.3.0.201407100905 Titanium Command-Line Interface CLI version 3.3.0, iOS SDK: 7.1 iOS iPhone Simulator: 7.1
Changing to
Improvement
since it is no bug and everything still works. Will but this ticket on hold until someone provides a comprehensible reason why we should swap this against the naming of Apple.PR: https://github.com/appcelerator/titanium_mobile/pull/11134
FR passed on master branch. Merged master branch PR.
Need to cherry-pick the changes to 9_0_X branch
cherry-picked merged commit d72b0044a6aee71753181884ec27e4132caeb9db over to 9_0_X branch
Verified on: Mac OS: 10.15.4 SDK: 9.0.1.v20200409100807, 9.1.0.v20200409073825 Appc CLI: 8.0.0 JDK: 11.0.4 Node: 10.17.0 Studio: 6.0.0.202003132109 Device: Nexus4(v5.1.1) device, Pixel3(v10.0) emulator,