react / react/react-native

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

Open
#27,449 36 comments 38 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Component: TextInput Never gets stale Platform: Android
Dominant language
C++
Stars
127k
Forks
25.3k
Avg merge
1d 23h
Merged PRs (30d)
4

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Snack reproduction and the controlled Android TextInput entry point, testing autoCapitalize, onChangeText transformations, and textTransform: 'uppercase'. Confirm that lowercase input is capitalized without duplicated characters, and check the reported non-controlled behavior as well.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, react-native
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.