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?
Asked
Active
Viewed 242 times
1

gkeenley
- 6,088
- 8
- 54
- 129
1 Answers
1
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())} />
}

Sameer Kumar Jain
- 2,074
- 1
- 13
- 22
-
Well this adds duplicate characters if user enters alphabet in lower case. – Rohit Aggarwal Dec 20 '22 at 05:24