Skip to content

Instantly share code, notes, and snippets.

@romreed
Created June 16, 2017 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romreed/212c3808739cf1cbff22cafc202cbb50 to your computer and use it in GitHub Desktop.
Save romreed/212c3808739cf1cbff22cafc202cbb50 to your computer and use it in GitHub Desktop.
enter event react
add(event) {
if (event.key === 'Enter') {
this.props.search(this.state.value)
}
}
<TextField style={this.state.close === true ? styles.showInput : styles.hideInput}
id="text-field-controlled"
value={this.state.value}
inputStyle={styles.colorInput}
onChange={this.handleChange}
ref={(input) => this.focusInput = input}
onKeyPress={this.add.bind(this)}
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment