Saturday, May 11, 2024
113
rated 0 times [  118] [ 5]  / answers: 1 / hits: 66852  / 9 Years ago, sun, may 3, 2015, 12:00:00

One short question.

Is there a way to centralize text in react-native Textinput?



Here is the markup in jsx:



<TextInput style={styles.input} placeholder=Your Account />


In styles.input, just try to add textAlign:center, it's not working.



And same as add alignAlign to the markup as an attribute.
Could anybody do me a favor? Thx.


More From » react-native

 Answers
49

You should use the inputText props to align text to center as below



textAlign={'center'}


And it will look like



<TextInput style={styles.input} textAlign={'center'} placeholder=Your Account />

[#66771] Friday, May 1, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
milo

Total Points: 62
Total Questions: 99
Total Answers: 97

Location: Sweden
Member since Mon, May 8, 2023
1 Year ago
milo questions
Tue, Apr 19, 22, 00:00, 2 Years ago
Wed, Apr 21, 21, 00:00, 3 Years ago
Sun, May 24, 20, 00:00, 4 Years ago
Sat, May 9, 20, 00:00, 4 Years ago
;