Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-28312

Android: Can't enter decimal comma in TextField on some devices


    • Story Points:
    • Sprint:
      2021 Sprint 2


      Some Android devices such as Samsung and Huawei do not have localized decimal keyboards. They only support a decimal point '.' which makes it impossible to enter a decimal separator into a TextField for locales that use a decimal comma ',' character.

      This never happens in the Android emulator or Google's own devices.

      This is actually a bug with some 3rd party devices, not in Titanium. We can't control the localization of the virtual keyboard. But that said, we need a work-around of some kind.

      Steps to reproduce:

      1. Acquire a Samsung or Huawei Android device.
      2. Go to: Settings -> System -> Languages & Input -> Languages
      3. Select a European language such as French or German.
      4. Build and run the below code.
      5. Tap on the TextField.
      6. Notice keyboard has a "," button but not a "." button. (We can't fix this.)
      7. Attempt to enter a decimal value such as 1,5 or 1.5.
      8. Notice you can't enter a decimal separator. (This is only an issue on some devices.)

      const value = 1234.5;
      const window = Ti.UI.createWindow();
      const textField = Ti.UI.createTextField({
      	value: value.toLocaleString(Ti.Locale.currentLocale),
      	keyboardType: Ti.UI.KEYBOARD_TYPE_DECIMAL_PAD,
      	width: "80%",
      textField.addEventListener("change", (e) => {
      	console.log("@@@ value: " + Ti.Locale.parseDecimal(e.value));

      Recommended Solution:
      For locales that do not use a decimal point, we should automatically substitute the "." character as it's typed in. This would also mean we won't allow user's to enter a thousands separator for European locales, but unfortunately there doesn't appear to be any other solution to this issue.


          Issue Links



              • Assignee:
                jquick Joshua Quick
                jquick Joshua Quick
                Gary Mathews
                Lokesh Choudhary
              • Watchers:
                3 Start watching this issue


                • Created:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration