Using `toUpperCase` or `textTransform: 'uppercase'` breaks on an Android controlled TextInput
See original GitHub issueReact 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
- Create a controlled TextInput and either use onTextChanged to modify the text to uppercase or use text transform in the styles block
- 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
Issue Analytics
- State:
- Created 4 years ago
- Reactions:20
- Comments:20
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
autoCapitalize={'characters'}
Seems to solve the problem. https://www.reddit.com/r/reactnative/comments/jhdref/any_solution_to_the_touppercase_problemkeyboardType={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.