[fix] TextInput keyPress events when child of Touchable

Fix #612
This commit is contained in:
Nicolas Gallagher
2017-09-07 11:40:00 -07:00
parent 5e98107617
commit 26bdf44a4c
3 changed files with 48 additions and 0 deletions
+3
View File
@@ -301,6 +301,9 @@ class TextInput extends Component {
};
_handleKeyDown = e => {
// prevent key events bubbling (see #612)
e.stopPropagation();
// Backspace, Tab, and Cmd+Enter only fire 'keydown' DOM events
if (e.which === 8 || e.which === 9 || (e.which === 13 && e.metaKey)) {
this._handleKeyPress(e);