I have some development requirements that have really stumped me. Our login page must only allow ascii characters to be entered for the username, but if a device is set to Japanese, the default Japanese keyboard shows up.
We are using TMPro 2.1.1. Password fields always show the ascii keyboard but have the unwanted feature of hiding the text as the user types. I’ve tried using Custom/ASCII Capable, but that still displays the default Japanese keyboard.
I have also tried setting the default keyboard type to password, and then swapping to alphanumeric once the field is focused, but that has bad side effects like:
- When reselecting the field all previous text will convert to asterisks
I would be thankful for any suggestions or directions
This was a fairly drastic solution, but I was able to find a workaround. I embedded TMPro into the project so I could modify the source. I added an extra boolean to TMP_InputField that would allow the field to display the password as plain text. I set the username field to have a content type of password and enabled the display password option.
Finally I removed the white input box above the soft keyboard, as that would still display as a ‘password’ type.
I’ll have to walk this answer back. After testing I discovered that the Back button was causing a 5s hang in the engine. Here are the relevant logs:
I/WindowManager: Input event dispatching timed out . Reason: Waiting because no window has focus but there is a focused application that may eventually add a window when it finishes starting up.
W/InputDispatcher: Asynchronous input event injection timed out.