Uppercase Keyboard when focusing a TextInput

Viewed 8212

I have a TextInput field in react-native and I set autofocus to true so it automatically opens the keyboard when loaded.

What I want is that it opens a keyboard in uppercase letters (not only for the first characters, I want the uppercase key to be enabled so all letters are uppercase when typing)

enter image description here

According to the TextInput documentation I can specify which kind of keyboard to use with the keyboardType prop.

There are several keyboards available: default, email, numeric, phone...

However none of them do what I want :(

How can I force the keyboard to be uppercase when focusing a TextInput?

2 Answers

I overlooked Cherniv's comment when I was first here and ended up finding the same solution, so I'll make it an answer to give it more visibility.

<TextInput autoCapitalize='characters' />

Use this android:inputType="textCapCharacters"

(OR)

Set the input type to TYPE_CLASS_TEXT| TYPE_TEXT_FLAG_CAP_CHARACTERS. The keyboard should honor that.

Related