mirror of https://github.com/embarklabs/embark.git
use e.key instead of e.which
This commit is contained in:
parent
8b7a374313
commit
785edf4c9d
|
@ -38,7 +38,7 @@ class Communication extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleEnter(e, cb) {
|
handleEnter(e, cb) {
|
||||||
if (e.which === 13) {
|
if (e.key === 'Enter') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
cb(e);
|
cb(e);
|
||||||
}
|
}
|
||||||
|
@ -121,9 +121,9 @@ class Communication extends Component {
|
||||||
<FormGroup label="Message">
|
<FormGroup label="Message">
|
||||||
<Label htmlFor="message">Message</Label>
|
<Label htmlFor="message">Message</Label>
|
||||||
<Input value={this.state.message}
|
<Input value={this.state.message}
|
||||||
placeholder="Message"
|
placeholder="Message"
|
||||||
id="message"
|
id="message"
|
||||||
onChange={e => this.handleChange(e, 'message')}
|
onChange={e => this.handleChange(e, 'message')}
|
||||||
onKeyPress={e => this.handleEnter(e, this.sendMessage.bind(this))}/>
|
onKeyPress={e => this.handleEnter(e, this.sendMessage.bind(this))}/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<Button color="primary" disabled={!this.state.channelIsValid} onClick={(e) => this.sendMessage(e)}>Send Message</Button>
|
<Button color="primary" disabled={!this.state.channelIsValid} onClick={(e) => this.sendMessage(e)}>Send Message</Button>
|
||||||
|
|
Loading…
Reference in New Issue