0

I want to add something like a Hint, on the textInput, as in java using android studio, in react native is it possible to do this? I know you have the option to add a Value, defaultValue and the placeholder, but they don't work like hint.

Tanks!

Samuel Viol
  • 11
  • 1
  • 5
  • create a custom box with hint value & when the user press on the text-input (using onFocus in react native text-input) set visibility of that hint box to true. – SDushan Nov 18 '19 at 18:03

3 Answers3

0

You can use placeholder props

<TextInput 
  placeholder="Input email"
/>
Tuan Luong
  • 3,902
  • 1
  • 16
  • 18
0

Yes it is possible, it's called placeholder, Here is an example from docs.:

<TextInput
      style={{height: 40}}
      placeholder="Type here to translate!"
      onChangeText={(text) => this.setState({text})}
      value={this.state.text}
    />
Panicum
  • 794
  • 1
  • 9
  • 32
0

The only thing you need to do is to add a the placeholder prop.

<TextInput 
...//otherprops
 placeholder="enter your hint here"
/>

I highly suggest you to read more about TextInput in React Native docs here

Ian Vasco
  • 1,280
  • 13
  • 17