flip-ya-numbers
Advanced tools
Comparing version 0.0.1-beta.3 to 0.0.1-beta.4
@@ -11,6 +11,2 @@ 'use strict'; | ||
var _debounce = require('lodash/debounce'); | ||
var _debounce2 = _interopRequireDefault(_debounce); | ||
var _reactSimpleAnimate = require('react-simple-animate'); | ||
@@ -60,10 +56,4 @@ | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = FlipNumber.__proto__ || Object.getPrototypeOf(FlipNumber)).call.apply(_ref, [this].concat(args))), _this), _this.state = { | ||
degree: 0, | ||
isStatic: false | ||
}, _this.makeStatic = (0, _debounce2.default)(function () { | ||
_this.setState({ isStatic: true }); | ||
}, _this.props.durationSeconds * 1000), _this.makeDynamic = function () { | ||
_this.setState({ isStatic: false }); | ||
degree: 0 | ||
}, _this.updateNumber = function (activeNumber) { | ||
_this.makeDynamic(); | ||
_this.setState(function () { | ||
@@ -81,3 +71,3 @@ var animateDegree = numbers.findIndex(function (v) { | ||
}; | ||
}, _this.makeStatic); | ||
}); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
@@ -104,4 +94,4 @@ } | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
return nextProps.activeNumber !== this.props.activeNumber || this.state.degree === 0 || nextProps.startAnimation !== this.props.startAnimation || nextState.isStatic !== this.state.isStatic; | ||
value: function shouldComponentUpdate(nextProps) { | ||
return nextProps.activeNumber !== this.props.activeNumber || this.state.degree === 0 || nextProps.startAnimation !== this.props.startAnimation; | ||
} | ||
@@ -112,3 +102,2 @@ }, { | ||
clearTimeout(this.updateNumberTimeout); | ||
this.makeStatic.cancel(); | ||
} | ||
@@ -130,5 +119,3 @@ }, { | ||
position = _props.position; | ||
var _state = this.state, | ||
degree = _state.degree, | ||
isStatic = _state.isStatic; | ||
var degree = this.state.degree; | ||
@@ -203,4 +190,3 @@ var viewPortSize = { | ||
background: background, | ||
transform: 'rotateX(0deg) translateZ(' + translateZ + 'px)', | ||
visibility: isStatic ? 'visible' : 'hidden' | ||
transform: 'rotateX(0deg) translateZ(' + translateZ + 'px)' | ||
}) | ||
@@ -207,0 +193,0 @@ }, |
{ | ||
"name": "flip-ya-numbers", | ||
"version": "0.0.1-beta.3", | ||
"version": "0.0.1-beta.4", | ||
"description": "flip your numbers", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
// @flow | ||
import debounce from 'lodash/debounce'; | ||
import Animate from 'react-simple-animate'; | ||
@@ -33,3 +32,2 @@ import React from 'react'; | ||
degree: number, | ||
isStatic: boolean, | ||
}; | ||
@@ -42,3 +40,2 @@ | ||
degree: 0, | ||
isStatic: false, | ||
}; | ||
@@ -54,8 +51,7 @@ | ||
shouldComponentUpdate(nextProps: PropTypes, nextState: StateTypes) { | ||
shouldComponentUpdate(nextProps: PropTypes) { | ||
return ( | ||
nextProps.activeNumber !== this.props.activeNumber || | ||
this.state.degree === 0 || | ||
nextProps.startAnimation !== this.props.startAnimation || | ||
nextState.isStatic !== this.state.isStatic | ||
nextProps.startAnimation !== this.props.startAnimation | ||
); | ||
@@ -66,3 +62,2 @@ } | ||
clearTimeout(this.updateNumberTimeout); | ||
this.makeStatic.cancel(); | ||
} | ||
@@ -72,12 +67,3 @@ | ||
makeStatic = debounce(() => { | ||
this.setState({ isStatic: true }); | ||
}, this.props.durationSeconds * 1000); | ||
makeDynamic = () => { | ||
this.setState({ isStatic: false }); | ||
}; | ||
updateNumber = (activeNumber: number) => { | ||
this.makeDynamic(); | ||
this.setState(() => { | ||
@@ -93,3 +79,3 @@ const animateDegree = numbers.findIndex(v => v === activeNumber) * rotateDegreePerNumber; | ||
}; | ||
}, this.makeStatic); | ||
}); | ||
}; | ||
@@ -111,3 +97,3 @@ | ||
} = this.props; | ||
const { degree, isStatic } = this.state; | ||
const { degree } = this.state; | ||
const viewPortSize = { | ||
@@ -183,3 +169,2 @@ width: `${width}px`, | ||
transform: `rotateX(0deg) translateZ(${translateZ}px)`, | ||
visibility: isStatic ? 'visible' : 'hidden', | ||
}} | ||
@@ -186,0 +171,0 @@ > |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
235373
622