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.
In the Format Text Box dialog box, click the Text Box tab. In the Vertical alignment box, select Top, Middle, or Bottom. Click OK.
To align text to the top multiline TextInput with React Native, we can set the textAlignVertical style to 'top' . to add the multiline prop to make the TextInput a multiline input. We set the numberOfLines to set the text input height to 5 lines high.
Using the <center></center> tags One way to center text or put it in the middle of the page is to enclose it within <center></center> tags.
To just center the text inside an element, use text-align: center; This text is centered.
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" />
This bug has been around for a while already, but it looks like a fix will be merged soon: https://github.com/facebook/react-native/pull/772
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