React Native: is it possible to force characters in TextInput to be capitals?

275 Views Asked by At

I'm using a TextInput in my React Native app with autocapitalize: 'characters'. It autocapitalizes all characters, but I'm still able to press the shift key (iOS), which switches to lowercase. I want to prevent the user from being able to switch to lowercase. Does anyone know if there's a way to do this?

1

There are 1 best solutions below

1
On

One of the workarounds could be following

export default function MyUpperCaseText() {
  const [text, setText] = React.useState("")
  return <TextInput value={text} onChangeText={(text)=>setText(text.toUpperCase())} />
}