diff options
author | Wei Zhu <yesmeck@gmail.com> | 2017-09-07 11:36:47 +0800 |
---|---|---|
committer | Wei Zhu <yesmeck@gmail.com> | 2017-09-07 11:36:47 +0800 |
commit | ed31dbba2c8ef455a973f5548f4d43f244fe8fa2 (patch) | |
tree | d9d7dc09dfbc0e4e9c9ebf319cf896afaf618df3 /src/Select.jsx | |
parent | 35d5ed7815f4707c79565a45261ffadc21d604be (diff) | |
download | time-picker-ed31dbba2c8ef455a973f5548f4d43f244fe8fa2.tar.gz time-picker-ed31dbba2c8ef455a973f5548f4d43f244fe8fa2.tar.zst time-picker-ed31dbba2c8ef455a973f5548f4d43f244fe8fa2.zip |
Refactor string refs to callback
Diffstat (limited to 'src/Select.jsx')
-rw-r--r-- | src/Select.jsx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Select.jsx b/src/Select.jsx index 49fed5b..a51ffd2 100644 --- a/src/Select.jsx +++ b/src/Select.jsx | |||
@@ -79,7 +79,7 @@ class Select extends Component { | |||
79 | scrollToSelected(duration) { | 79 | scrollToSelected(duration) { |
80 | // move to selected item | 80 | // move to selected item |
81 | const select = ReactDom.findDOMNode(this); | 81 | const select = ReactDom.findDOMNode(this); |
82 | const list = ReactDom.findDOMNode(this.refs.list); | 82 | const list = ReactDom.findDOMNode(this.list); |
83 | if (!list) { | 83 | if (!list) { |
84 | return; | 84 | return; |
85 | } | 85 | } |
@@ -101,6 +101,10 @@ class Select extends Component { | |||
101 | this.setState({ active: false }); | 101 | this.setState({ active: false }); |
102 | } | 102 | } |
103 | 103 | ||
104 | saveList = (node) => { | ||
105 | this.list = node; | ||
106 | } | ||
107 | |||
104 | render() { | 108 | render() { |
105 | if (this.props.options.length === 0) { | 109 | if (this.props.options.length === 0) { |
106 | return null; | 110 | return null; |
@@ -118,7 +122,7 @@ class Select extends Component { | |||
118 | onMouseEnter={this.handleMouseEnter} | 122 | onMouseEnter={this.handleMouseEnter} |
119 | onMouseLeave={this.handleMouseLeave} | 123 | onMouseLeave={this.handleMouseLeave} |
120 | > | 124 | > |
121 | <ul ref="list">{this.getOptions()}</ul> | 125 | <ul ref={this.saveList}>{this.getOptions()}</ul> |
122 | </div> | 126 | </div> |
123 | ); | 127 | ); |
124 | } | 128 | } |