React Native Set Hint PlaceHolder Align Center Inside TextInput
Tags: android, mobileapplicationd, reactnative
Published: 2019-01-20 09:20:36

---
title: React Native Set Hint PlaceHolder Align Center Inside TextInput
published: true
tags: android,Mobile Application D,React Native
canonical_url: 
---

--------
Source : <a href="https://www.skptricks.com/2019/01/react-native-set-hint-placeholder-align.html" > React Native Set Hint PlaceHolder Align Center Inside TextInput</a>
---------

This tutorial explains **how to display Hint or Placeholder field inside the TextInput component**. This placeholder provides information to user, about fields input parameter pattern. In this example we will use TextInput component and display the placeholder or hint in centered align order. In order to display hint or placeholder in centered align, we need to use css style-sheet property this is  **textAlign: 'center'**.  
  

[![React Native Set Hint PlaceHolder Align Center Inside TextInput](https://4.bp.blogspot.com/-zeDO31F_PQw/XD1dgqaqROI/AAAAAAAACVg/8A6igkep0Y0IQEUJ1kIdxjmM3b3fd9p_wCLcBGAs/s640/placegolder.png "React Native Set Hint PlaceHolder Align Center Inside TextInput")](https://4.bp.blogspot.com/-zeDO31F_PQw/XD1dgqaqROI/AAAAAAAACVg/8A6igkep0Y0IQEUJ1kIdxjmM3b3fd9p_wCLcBGAs/s1600/placegolder.png)
  
  

## **React Native Set Hint or PlaceHolder Inside TextInput **
Lets see the below source code that helps to display hint or placeholder in TextInput component in react native application.  

```
/\*\*  
 \* Sample React Native App  
 \* https://github.com/facebook/react-native  
 \* @flow  
 \*/  
  
import React, { Component } from "react";  
import { Platform, StyleSheet, View, Button, TextInput, } from "react-native";  
  
export default class App extends Component {  
  
  render() {  
return (  
<View style={styles.container}>  
  
<TextInput  
 **placeholder**** ="Enter Your Userame"**  
          underlineColorAndroid='transparent'  
          style={styles.TextInputStyle}  
/>  
  
<TextInput  
 **placeholder**** ="Enter Your Password"**  
          underlineColorAndroid='transparent'  
          style={styles.TextInputStyle}  
          secureTextEntry={true}  
/>  
  
</View>  
);  
}  
}  
  
const styles = StyleSheet.create({  
  container: {  
    flex: 1,  
    justifyContent: 'center',  
},  
  headerText: {  
    fontSize: 20,  
    textAlign: "center",  
    margin: 10,  
    fontWeight: "bold"  
},  
TextInputStyle: {  
 **textAlign**** : 'center',**  
    height: 40,  
    borderRadius: 10,  
    borderWidth: 2,  
    borderColor: '#009688',  
    marginBottom: 10  
}  
});
```
  
**Screenshot :**  

[![React Native Set Hint PlaceHolder Align Center Inside TextInput](https://1.bp.blogspot.com/-Xo0Z8oS8-N0/XD1cLqOYDgI/AAAAAAAACVU/dctYo9d5JC40cryjb4165vmyWR6AEr5-wCLcBGAs/s400/Screenshot_1547525149.png "React Native Set Hint PlaceHolder Align Center Inside TextInput")](https://1.bp.blogspot.com/-Xo0Z8oS8-N0/XD1cLqOYDgI/AAAAAAAACVU/dctYo9d5JC40cryjb4165vmyWR6AEr5-wCLcBGAs/s1600/Screenshot_1547525149.png)
  
This is all about  **React Native Set Hint PlaceHolder Align Center Inside TextInput.**  Thank you for reading this article, and if you have any problem, have a another better useful solution about this article, please write message in the comment section.