Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed old syntax for React refs for React 16 support #131

Merged
merged 1 commit into from
Mar 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions react-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@
},

_resize: function () {
var slider = this.refs.slider;
var handle = this.refs.handle0;
var slider = this.slider;
var handle = this.handle0;
var rect = slider.getBoundingClientRect();

var size = this._sizeKey();
Expand Down Expand Up @@ -477,7 +477,7 @@

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

return (
React.createElement('div', {
ref: 'handle' + i,
ref: r => (this['handle' + i] = r),
key: 'handle' + i,
className: className,
style: style,
Expand Down Expand Up @@ -787,7 +787,7 @@
return (
React.createElement('div', {
key: 'bar' + i,
ref: 'bar' + i,
ref: r => (this['bar' + i] = r),
className: this.props.barClassName + ' ' + this.props.barClassName + '-' + i,
style: this._buildBarStyle(offsetFrom, this.state.upperBound - offsetTo)
})
Expand Down Expand Up @@ -856,7 +856,7 @@

return (
React.createElement('div', {
ref: 'slider',
ref: r => (this.slider = r),
style: {position: 'relative'},
className: props.className + (props.disabled ? ' disabled' : ''),
onMouseDown: this._onSliderMouseDown,
Expand Down