aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAndreas Fehn <andi.fehn@gmail.com>2017-02-04 07:57:06 +0100
committerAndreas Fehn <andi.fehn@gmail.com>2017-02-04 07:57:06 +0100
commitfa912931fa6952cf85fe4b35bd15cd83f3e32876 (patch)
tree79b2b5f2db33314557c63af00881ba3e5d9896ed /src
parent74b83c4ad0b380a3a82c569c19267491af408684 (diff)
downloadtime-picker-fa912931fa6952cf85fe4b35bd15cd83f3e32876.tar.gz
time-picker-fa912931fa6952cf85fe4b35bd15cd83f3e32876.tar.zst
time-picker-fa912931fa6952cf85fe4b35bd15cd83f3e32876.zip
Fix react error about refs
Diffstat (limited to 'src')
-rw-r--r--src/TimePicker.jsx5
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()) || ''}