From 3b0f8233e8eb82b861e0a2f6bec4d1fb7afea788 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 16 Dec 2019 17:22:00 +0000 Subject: [PATCH] delint --- src/components/views/dialogs/AddressPickerDialog.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/views/dialogs/AddressPickerDialog.js b/src/components/views/dialogs/AddressPickerDialog.js index 988d22b113..ede261b81b 100644 --- a/src/components/views/dialogs/AddressPickerDialog.js +++ b/src/components/views/dialogs/AddressPickerDialog.js @@ -143,6 +143,8 @@ module.exports = createReactClass({ }, onKeyDown: function(e) { + const textInput = this._textinput.current ? this._textinput.current.value : undefined; + if (e.key === Key.ESCAPE) { e.stopPropagation(); e.preventDefault(); @@ -159,23 +161,23 @@ module.exports = createReactClass({ e.stopPropagation(); e.preventDefault(); if (this.addressSelector) this.addressSelector.chooseSelection(); - } else if (this._textinput.current.value.length === 0 && this.state.selectedList.length && e.key === Key.BACKSPACE) { + } else if (textInput.length === 0 && this.state.selectedList.length && e.key === Key.BACKSPACE) { e.stopPropagation(); e.preventDefault(); this.onDismissed(this.state.selectedList.length - 1)(); } else if (e.key === Key.ENTER) { e.stopPropagation(); e.preventDefault(); - if (this._textinput.current.value === '') { + if (textInput === '') { // if there's nothing in the input box, submit the form this.onButtonClick(); } else { - this._addAddressesToList([this._textinput.current.value]); + this._addAddressesToList([textInput]); } } else if (e.key === Key.COMMA || e.key === Key.TAB) { e.stopPropagation(); e.preventDefault(); - this._addAddressesToList([this._textinput.current.value]); + this._addAddressesToList([textInput]); } },