How to set <Text> some text </Text>
as upper case in react native?
<Text style={{}}> Test </Text>
Need to show that Test
as TEST
.
This is an Example to Convert Text to Upper or Lower Case in React Native. To do this we will use the string property toUpperCase() and toLowerCase() which will convert your text to Upper case and lower case respectively.
To use a keyboard shortcut to change between lowercase, UPPERCASE, and Capitalize Each Word, select the text and press SHIFT + F3 until the case you want is applied.
Converting text to upper case or to lower case is pretty easy in react native. You can use JavaScript methods toLowerCase() as well as toUpperCase() on strings. The usage case of toLowerCase and toUpperCase in react native is as given below: const sentence = "Hello World!"; const toLower = sentence.
iOS textTransform support has been added to react-native in 0.56 version. Android textTransform support has been added in 0.59 version. It accepts one of these options:
The actual iOS commit, Android commit and documentation
Example:
<View> <Text style={{ textTransform: 'uppercase'}}> This text should be uppercased. </Text> <Text style={{ textTransform: 'capitalize'}}> Mixed:{' '} <Text style={{ textTransform: 'lowercase'}}> lowercase{' '} </Text> </Text> </View>
@Cherniv Thanks for the answer
<Text style={{}}> {'Test'.toUpperCase()} </Text>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With