aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Select.jsx
diff options
context:
space:
mode:
author偏右 <afc163@gmail.com>2017-10-22 16:24:17 +0800
committerGitHub <noreply@github.com>2017-10-22 16:24:17 +0800
commit78598cc9f8608fc8bb1830d3384c8e7fd032eb3f (patch)
treed015484db93d83f9ea17fbe6b5602cd9936d37c8 /src/Select.jsx
parentbcb307b79a2481bad496085b75b701bf864adc6d (diff)
parentb6767d8a08ccfc52836e09e3a0886a5cf225b93f (diff)
downloadtime-picker-78598cc9f8608fc8bb1830d3384c8e7fd032eb3f.tar.gz
time-picker-78598cc9f8608fc8bb1830d3384c8e7fd032eb3f.tar.zst
time-picker-78598cc9f8608fc8bb1830d3384c8e7fd032eb3f.zip
Merge branch 'master' into focus-on-open
Diffstat (limited to 'src/Select.jsx')
-rw-r--r--src/Select.jsx8
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 }