Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17203] TextField keyboardType: parity issues between iOS and Android

GitHub Issuen/a
TypeImprovement
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2020-04-09T18:53:24.000+0000
Affected Version/sRelease 3.3.0
Fix Version/sRelease 9.0.1
ComponentsAndroid, iOS
Labelsparity
ReporterJon Alter
AssigneeYordan Banev
Created2014-06-24T21:10:36.000+0000
Updated2020-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
    });

Comments

  1. jithinpv 2014-08-27

    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
  2. Thomas Neerup 2014-08-28

    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...
  3. Shameer Jan 2014-09-25

    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
  4. Hans Knöchel 2015-11-03

    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.
  5. Yordan Banev 2019-08-12

    PR: https://github.com/appcelerator/titanium_mobile/pull/11134
  6. Satyam Sekhri 2020-03-25

    FR passed on master branch. Merged master branch PR.
  7. Satyam Sekhri 2020-03-25

    Need to cherry-pick the changes to 9_0_X branch
  8. Christopher Williams 2020-04-09

    cherry-picked merged commit d72b0044a6aee71753181884ec27e4132caeb9db over to 9_0_X branch
  9. Satyam Sekhri 2020-04-09

    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,

JSON Source