 |
React Native TextInput |
You can see details of text input handling on
React Native page.
This is the way mentioned on the page.
<TextInput
style={{height: 40}}
placeholder="Type here to translate!"
onChangeText={(text) => this.setState({text})}
/>
You can also do it this way to associate multiple input with respective keys.
handleInput(key, val) {
this.props.getInputData({
key,
value: val
});
// do something else, maybe
}
<TextInput
style={{height: 40}}
placeholder=“What is your most favourite food?”
onChangeText={this.handleInput.bind(this, 'food')}
/>
<TextInput
style={{height: 40}}
placeholder=“What is your most favourite beverage?”
onChangeText={this.handleInput.bind(this, 'beverage')}
/>
Thank you for reading!
Jun
Comments
Post a Comment