Sometimes, we want to change TextInput placeHolder alignment with React Native
In this article, we’ll look at how to change TextInput placeHolder alignment with React Native.
How to change TextInput placeHolder alignment with React Native?
To change TextInput placeHolder alignment with React Native, we can set the textAlign style to 'center'.
For instance, we write:
import * as React from 'react';
import { View, TextInput } from 'react-native';
import Constants from 'expo-constants';
import { Card } from 'react-native-paper';
export default function App() {
return (
<View>
<TextInput placeholder="Name" style={{ textAlign: 'center' }} />
</View>
);
}
to align the placeholder at the center of the screen by setting textAlign set to 'center'.
Conclusion
To change TextInput placeHolder alignment with React Native, we can set the textAlign style to 'center'.