From ed31dbba2c8ef455a973f5548f4d43f244fe8fa2 Mon Sep 17 00:00:00 2001 From: Wei Zhu Date: Thu, 7 Sep 2017 11:36:47 +0800 Subject: Refactor string refs to callback --- src/Select.jsx | 8 ++++++-- 1 file 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 { scrollToSelected(duration) { // move to selected item const select = ReactDom.findDOMNode(this); - const list = ReactDom.findDOMNode(this.refs.list); + const list = ReactDom.findDOMNode(this.list); if (!list) { return; } @@ -101,6 +101,10 @@ class Select extends Component { this.setState({ active: false }); } + saveList = (node) => { + this.list = node; + } + render() { if (this.props.options.length === 0) { return null; @@ -118,7 +122,7 @@ class Select extends Component { onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave} > - + ); } -- cgit v1.2.3