diff options
author | Andreas Fehn <andi.fehn@gmail.com> | 2017-02-04 07:57:06 +0100 |
---|---|---|
committer | Andreas Fehn <andi.fehn@gmail.com> | 2017-02-04 07:57:06 +0100 |
commit | fa912931fa6952cf85fe4b35bd15cd83f3e32876 (patch) | |
tree | 79b2b5f2db33314557c63af00881ba3e5d9896ed /src/TimePicker.jsx | |
parent | 74b83c4ad0b380a3a82c569c19267491af408684 (diff) | |
download | time-picker-fa912931fa6952cf85fe4b35bd15cd83f3e32876.tar.gz time-picker-fa912931fa6952cf85fe4b35bd15cd83f3e32876.tar.zst time-picker-fa912931fa6952cf85fe4b35bd15cd83f3e32876.zip |
Fix react error about refs
Diffstat (limited to 'src/TimePicker.jsx')
-rw-r--r-- | src/TimePicker.jsx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/TimePicker.jsx b/src/TimePicker.jsx index ec3eda0..28857a0 100644 --- a/src/TimePicker.jsx +++ b/src/TimePicker.jsx | |||
@@ -69,6 +69,7 @@ const Picker = React.createClass({ | |||
69 | }, | 69 | }, |
70 | 70 | ||
71 | getInitialState() { | 71 | getInitialState() { |
72 | this.saveInputRef = refFn.bind(this, 'picker'); | ||
72 | this.savePanelRef = refFn.bind(this, 'panelInstance'); | 73 | this.savePanelRef = refFn.bind(this, 'panelInstance'); |
73 | const { defaultOpen, defaultValue, open = defaultOpen, value = defaultValue } = this.props; | 74 | const { defaultOpen, defaultValue, open = defaultOpen, value = defaultValue } = this.props; |
74 | return { | 75 | return { |
@@ -104,7 +105,7 @@ const Picker = React.createClass({ | |||
104 | 105 | ||
105 | onEsc() { | 106 | onEsc() { |
106 | this.setOpen(false); | 107 | this.setOpen(false); |
107 | this.refs.picker.focus(); | 108 | this.picker.focus(); |
108 | }, | 109 | }, |
109 | 110 | ||
110 | onKeyDown(e) { | 111 | onKeyDown(e) { |
@@ -212,7 +213,7 @@ const Picker = React.createClass({ | |||
212 | <span className={`${prefixCls} ${className}`} style={style}> | 213 | <span className={`${prefixCls} ${className}`} style={style}> |
213 | <input | 214 | <input |
214 | className={`${prefixCls}-input`} | 215 | className={`${prefixCls}-input`} |
215 | ref="picker" type="text" placeholder={placeholder} | 216 | ref={this.saveInputRef} type="text" placeholder={placeholder} |
216 | readOnly | 217 | readOnly |
217 | onKeyDown={this.onKeyDown} | 218 | onKeyDown={this.onKeyDown} |
218 | disabled={disabled} value={value && value.format(this.getFormat()) || ''} | 219 | disabled={disabled} value={value && value.format(this.getFormat()) || ''} |