Skip to content

Commit 1a4ba39

Browse files
authored
Merge pull request #131 from snaerth/master
Removed old syntax for React refs for React 16 support
2 parents 3510cf5 + 6038804 commit 1a4ba39

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

react-slider.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@
277277
},
278278

279279
_resize: function () {
280-
var slider = this.refs.slider;
281-
var handle = this.refs.handle0;
280+
var slider = this.slider;
281+
var handle = this.handle0;
282282
var rect = slider.getBoundingClientRect();
283283

284284
var size = this._sizeKey();
@@ -477,7 +477,7 @@
477477

478478
_start: function (i, position) {
479479
var activeEl = document.activeElement;
480-
var handleRef = this.refs['handle' + i];
480+
var handleRef = this['handle' + i];
481481
// if activeElement is body window will lost focus in IE9
482482
if (activeEl && activeEl != document.body && activeEl != handleRef) {
483483
activeEl.blur && activeEl.blur();
@@ -741,7 +741,7 @@
741741

742742
return (
743743
React.createElement('div', {
744-
ref: 'handle' + i,
744+
ref: r => (this['handle' + i] = r),
745745
key: 'handle' + i,
746746
className: className,
747747
style: style,
@@ -787,7 +787,7 @@
787787
return (
788788
React.createElement('div', {
789789
key: 'bar' + i,
790-
ref: 'bar' + i,
790+
ref: r => (this['bar' + i] = r),
791791
className: this.props.barClassName + ' ' + this.props.barClassName + '-' + i,
792792
style: this._buildBarStyle(offsetFrom, this.state.upperBound - offsetTo)
793793
})
@@ -856,7 +856,7 @@
856856

857857
return (
858858
React.createElement('div', {
859-
ref: 'slider',
859+
ref: r => (this.slider = r),
860860
style: {position: 'relative'},
861861
className: props.className + (props.disabled ? ' disabled' : ''),
862862
onMouseDown: this._onSliderMouseDown,

0 commit comments

Comments
 (0)