question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using `toUpperCase` or `textTransform: 'uppercase'` breaks on an Android controlled TextInput

See original GitHub issue

React Native version: 0.61.4 and lower

Trying to force capitalization of characters inside a TextInput is broken on Android.

  • autoCapitalize="characters" doesn’t seem to do anything
  • Using toUpperCase in the onChangeText hook causes duplication of letters
  • Using textTransform: 'uppercase' in styles block causes the same duplication of letters
  • Using textTransform: 'uppercase' in a non-controlled TextInput does nothing

Steps To Reproduce

  1. Create a controlled TextInput and either use onTextChanged to modify the text to uppercase or use text transform in the styles block
  2. Type multiple lowercase characters into the text box

Describe what you expected to happen: Characters should be capitalized

What actually happens: Characters are capitalized and duplicated

Snack, code example, screenshot, or link to a repository: https://snack.expo.io/@nmi09/rn-android-capitalize-input-bug

ezgif com-video-to-gif

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:20
  • Comments:20

github_iconTop GitHub Comments

22reactions
arthurolgacommented, Oct 24, 2020
22reactions
simon-davies-avturacommented, Apr 17, 2020

keyboardType={Platform.OS === 'ios' ? 'default' : 'visible-password'}

Seems to be the only workaround for me with Android at the moment (I’ve been looking for ages!). Will need some cross platform testing locally though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native: TextInput toUpperCase does not work on ...
However, when I try this on my Android device, I get the following behavior: The first two letters work fine, but whenever I...
Read more >
JavaScript String toUpperCase() Method - W3Schools
The toUpperCase() method converts a string to uppercase letters. The toUpperCase() method does not change the original string.
Read more >
Entry - .NET MAUI - Microsoft Learn
In this article. Create an Entry; Set character spacing; Limit input length; Set the cursor position and text selection length; Display a clear ......
Read more >
31349 - text-transform:uppercase; and option / select tags
you select an it becomes upper case. Putting the CSS property in the ... text-transform:uppercase isn't working in Chrome or, at least, not...
Read more >
text-transform - CSS: Cascading Style Sheets - MDN Web Docs
The text-transform CSS property specifies how to capitalize an element's text. It can be used to make text appear in all-uppercase or ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found