Skip to content

Commit

Permalink
Updates per the nits
Browse files Browse the repository at this point in the history
  • Loading branch information
jaygarcia committed Jun 10, 2016
1 parent 5041725 commit 4b29cc1
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import {
const shallowCompare = require('react-addons-shallow-compare'),
styleEqual = require('style-equal');

const TRACK_SIZE = 4,
THUMB_SIZE = 20;
var TRACK_SIZE = 4;
var THUMB_SIZE = 20;

function Rect(x, y, width, height) {
this.x = x;
Expand All @@ -33,7 +33,7 @@ Rect.prototype.containsPoint = function(x, y) {
&& y <= this.y + this.height);
};

const DEFAULT_ANIMATION_CONFIGS = {
var DEFAULT_ANIMATION_CONFIGS = {
spring : {
friction : 7,
tension : 100
Expand Down Expand Up @@ -183,7 +183,7 @@ var Slider = React.createClass({
thumbTintColor: '#343434',
thumbTouchSize: {width: 40, height: 40},
debugTouchArea: false,
animationType: 'spring'
animationType: 'timing'
};
},
componentWillMount() {
Expand All @@ -198,12 +198,10 @@ var Slider = React.createClass({
});
},
componentWillReceiveProps: function(nextProps) {
var props = this.props,
oldValue = props.value,
newValue = nextProps.value;
var newValue = nextProps.value;

if (oldValue !== newValue) {
if (props.animateTransitions) {
if (this.props.value !== newValue) {
if (this.props.animateTransitions) {
this._setCurrentValueAnimated(newValue);
}
else {
Expand Down Expand Up @@ -405,12 +403,11 @@ var Slider = React.createClass({
},

_setCurrentValueAnimated(value: number) {
var props = this.props,
animationType = props.animationType,
animationConfig = Object.assign(
var animationType = this.props.animationType;
var animationConfig = Object.assign(
{},
DEFAULT_ANIMATION_CONFIGS[animationType],
props.animationConfig,
this.props.animationConfig,
{toValue : value}
);

Expand Down

0 comments on commit 4b29cc1

Please sign in to comment.