Project: titanium
Issue TIMOB-17203: TextField keyboardType: parity issues between iOS and Android
KeyboardTypes KEYBOARD_NUMBER_PAD and KEYBOARD_DECIMAL_PAD do not act the same on iOS and Android. h5. 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. h5. Workaround Set different keyboardtypes for iOS and Android {code} 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 }); {code}
Story points: 5