react-motion
Advanced tools
Comparing version 0.4.4 to 0.4.5
{ | ||
"name": "react-motion", | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"homepage": "https://github.com/chenglou/react-motion", | ||
@@ -14,3 +14,3 @@ "authors": [ | ||
"dependencies": { | ||
"react": ">=0.13.2 || ^0.14" | ||
"react": ">=0.13.2 || ^0.14 || ^15.0.0" | ||
}, | ||
@@ -17,0 +17,0 @@ "keywords": [ |
@@ -179,3 +179,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
for (var key in destStyle) { | ||
if (!destStyle.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(destStyle, key)) { | ||
continue; | ||
@@ -211,3 +211,3 @@ } | ||
// call cb? No, otherwise accidental parent rerender causes cb trigger | ||
this.animationID = _raf2['default'](function () { | ||
this.animationID = _raf2['default'](function (timestamp) { | ||
// check if we need to animate in the first place | ||
@@ -229,3 +229,3 @@ var propsStyle = _this.props.style; | ||
var currentTime = _performanceNow2['default'](); | ||
var currentTime = timestamp || _performanceNow2['default'](); | ||
var timeDelta = currentTime - _this.prevTime; | ||
@@ -255,3 +255,3 @@ _this.prevTime = currentTime; | ||
for (var key in propsStyle) { | ||
if (!propsStyle.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(propsStyle, key)) { | ||
continue; | ||
@@ -354,3 +354,3 @@ } | ||
for (var key in obj) { | ||
if (obj.hasOwnProperty(key)) { | ||
if (Object.prototype.hasOwnProperty.call(obj, key)) { | ||
ret[key] = 0; | ||
@@ -380,3 +380,3 @@ } | ||
for (var key in style) { | ||
if (!style.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(style, key)) { | ||
continue; | ||
@@ -405,3 +405,3 @@ } | ||
var reusedTuple = []; | ||
var reusedTuple = [0, 0]; | ||
@@ -484,6 +484,87 @@ function stepper(secondPerFrame, x, v, destX, k, b, precision) { | ||
// shim for using process in browser | ||
'use strict'; | ||
var process = module.exports = {}; | ||
// cached from whatever global is present so that test runners that stub it | ||
// don't break things. But we need to wrap it in a try catch in case it is | ||
// wrapped in strict mode code which doesn't define any globals. It's inside a | ||
// function because try/catches deoptimize in certain engines. | ||
var cachedSetTimeout; | ||
var cachedClearTimeout; | ||
function defaultSetTimout() { | ||
throw new Error('setTimeout has not been defined'); | ||
} | ||
function defaultClearTimeout() { | ||
throw new Error('clearTimeout has not been defined'); | ||
} | ||
(function () { | ||
try { | ||
if (typeof setTimeout === 'function') { | ||
cachedSetTimeout = setTimeout; | ||
} else { | ||
cachedSetTimeout = defaultSetTimout; | ||
} | ||
} catch (e) { | ||
cachedSetTimeout = defaultSetTimout; | ||
} | ||
try { | ||
if (typeof clearTimeout === 'function') { | ||
cachedClearTimeout = clearTimeout; | ||
} else { | ||
cachedClearTimeout = defaultClearTimeout; | ||
} | ||
} catch (e) { | ||
cachedClearTimeout = defaultClearTimeout; | ||
} | ||
})(); | ||
function runTimeout(fun) { | ||
if (cachedSetTimeout === setTimeout) { | ||
//normal enviroments in sane situations | ||
return setTimeout(fun, 0); | ||
} | ||
// if setTimeout wasn't available but was latter defined | ||
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { | ||
cachedSetTimeout = setTimeout; | ||
return setTimeout(fun, 0); | ||
} | ||
try { | ||
// when when somebody has screwed with setTimeout but no I.E. maddness | ||
return cachedSetTimeout(fun, 0); | ||
} catch (e) { | ||
try { | ||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | ||
return cachedSetTimeout.call(null, fun, 0); | ||
} catch (e) { | ||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error | ||
return cachedSetTimeout.call(this, fun, 0); | ||
} | ||
} | ||
} | ||
function runClearTimeout(marker) { | ||
if (cachedClearTimeout === clearTimeout) { | ||
//normal enviroments in sane situations | ||
return clearTimeout(marker); | ||
} | ||
// if clearTimeout wasn't available but was latter defined | ||
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { | ||
cachedClearTimeout = clearTimeout; | ||
return clearTimeout(marker); | ||
} | ||
try { | ||
// when when somebody has screwed with setTimeout but no I.E. maddness | ||
return cachedClearTimeout(marker); | ||
} catch (e) { | ||
try { | ||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | ||
return cachedClearTimeout.call(null, marker); | ||
} catch (e) { | ||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. | ||
// Some versions of I.E. have different rules for clearTimeout vs setTimeout | ||
return cachedClearTimeout.call(this, marker); | ||
} | ||
} | ||
} | ||
var queue = []; | ||
@@ -495,2 +576,5 @@ var draining = false; | ||
function cleanUpNextTick() { | ||
if (!draining || !currentQueue) { | ||
return; | ||
} | ||
draining = false; | ||
@@ -511,3 +595,3 @@ if (currentQueue.length) { | ||
} | ||
var timeout = setTimeout(cleanUpNextTick); | ||
var timeout = runTimeout(cleanUpNextTick); | ||
draining = true; | ||
@@ -529,3 +613,3 @@ | ||
draining = false; | ||
clearTimeout(timeout); | ||
runClearTimeout(timeout); | ||
} | ||
@@ -542,3 +626,3 @@ | ||
if (queue.length === 1 && !draining) { | ||
setTimeout(drainQueue, 0); | ||
runTimeout(drainQueue); | ||
} | ||
@@ -682,3 +766,3 @@ }; | ||
for (var key in style) { | ||
if (!style.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(style, key)) { | ||
continue; | ||
@@ -813,3 +897,3 @@ } | ||
for (var key in unreadPropStyle) { | ||
if (!unreadPropStyle.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(unreadPropStyle, key)) { | ||
continue; | ||
@@ -846,3 +930,3 @@ } | ||
// call cb? No, otherwise accidental parent rerender causes cb trigger | ||
this.animationID = _raf2['default'](function () { | ||
this.animationID = _raf2['default'](function (timestamp) { | ||
var destStyles = _this.props.styles(_this.state.lastIdealStyles); | ||
@@ -858,3 +942,3 @@ | ||
var currentTime = _performanceNow2['default'](); | ||
var currentTime = timestamp || _performanceNow2['default'](); | ||
var timeDelta = currentTime - _this.prevTime; | ||
@@ -891,3 +975,3 @@ _this.prevTime = currentTime; | ||
for (var key in destStyle) { | ||
if (!destStyle.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(destStyle, key)) { | ||
continue; | ||
@@ -1035,4 +1119,6 @@ } | ||
function rehydrateStyles(mergedPropsStyles, unreadPropStyles, plainStyles) { | ||
if (unreadPropStyles == null) { | ||
// $FlowFixMe | ||
// Copy the value to a `const` so that Flow understands that the const won't | ||
// change and will be non-nullable in the callback below. | ||
var cUnreadPropStyles = unreadPropStyles; | ||
if (cUnreadPropStyles == null) { | ||
return mergedPropsStyles.map(function (mergedPropsStyle, i) { | ||
@@ -1047,10 +1133,7 @@ return { | ||
return mergedPropsStyles.map(function (mergedPropsStyle, i) { | ||
// $FlowFixMe | ||
for (var j = 0; j < unreadPropStyles.length; j++) { | ||
// $FlowFixMe | ||
if (unreadPropStyles[j].key === mergedPropsStyle.key) { | ||
for (var j = 0; j < cUnreadPropStyles.length; j++) { | ||
if (cUnreadPropStyles[j].key === mergedPropsStyle.key) { | ||
return { | ||
// $FlowFixMe | ||
key: unreadPropStyles[j].key, | ||
data: unreadPropStyles[j].data, | ||
key: cUnreadPropStyles[j].key, | ||
data: cUnreadPropStyles[j].data, | ||
style: plainStyles[i] | ||
@@ -1060,3 +1143,2 @@ }; | ||
} | ||
// $FlowFixMe | ||
return { key: mergedPropsStyle.key, data: mergedPropsStyle.data, style: plainStyles[i] }; | ||
@@ -1135,3 +1217,2 @@ }); | ||
// $FlowFixMe | ||
var velocity = _mapToZero2['default'](newMergedPropsStyleCell.style); | ||
@@ -1200,3 +1281,2 @@ newCurrentVelocities[i] = velocity; | ||
} else { | ||
// $FlowFixMe | ||
oldMergedPropsStyles = defaultStyles.map(function (defaultStyleCell) { | ||
@@ -1224,6 +1304,6 @@ // TODO: key search code | ||
var _mergeAndSync = mergeAndSync( | ||
// $FlowFixMe | ||
willEnter, | ||
// $FlowFixMe | ||
willLeave, oldMergedPropsStyles, destStyles, oldCurrentStyles, oldCurrentVelocities, oldCurrentStyles, // oldLastIdealStyles really | ||
// Because this is an old-style React.createClass component, Flow doesn't | ||
// understand that the willEnter and willLeave props have default values | ||
// and will always be present. | ||
willEnter, willLeave, oldMergedPropsStyles, destStyles, oldCurrentStyles, oldCurrentVelocities, oldCurrentStyles, // oldLastIdealStyles really | ||
oldCurrentVelocities); | ||
@@ -1247,2 +1327,3 @@ | ||
unmounting: false, | ||
animationID: null, | ||
@@ -1261,7 +1342,3 @@ prevTime: 0, | ||
clearUnreadPropStyle: function clearUnreadPropStyle(unreadPropStyles) { | ||
var _mergeAndSync2 = mergeAndSync( | ||
// $FlowFixMe | ||
this.props.willEnter, | ||
// $FlowFixMe | ||
this.props.willLeave, this.state.mergedPropsStyles, unreadPropStyles, this.state.currentStyles, this.state.currentVelocities, this.state.lastIdealStyles, this.state.lastIdealVelocities); | ||
var _mergeAndSync2 = mergeAndSync(this.props.willEnter, this.props.willLeave, this.state.mergedPropsStyles, unreadPropStyles, this.state.currentStyles, this.state.currentVelocities, this.state.lastIdealStyles, this.state.lastIdealVelocities); | ||
@@ -1279,3 +1356,3 @@ var mergedPropsStyles = _mergeAndSync2[0]; | ||
for (var key in unreadPropStyle) { | ||
if (!unreadPropStyle.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(unreadPropStyle, key)) { | ||
continue; | ||
@@ -1322,5 +1399,8 @@ } | ||
if (this.unmounting) { | ||
return; | ||
} | ||
// TODO: when config is {a: 10} and dest is {a: 10} do we raf once and | ||
// call cb? No, otherwise accidental parent rerender causes cb trigger | ||
this.animationID = _raf2['default'](function () { | ||
this.animationID = _raf2['default'](function (timestamp) { | ||
var propStyles = _this.props.styles; | ||
@@ -1337,3 +1417,3 @@ var destStyles = typeof propStyles === 'function' ? propStyles(rehydrateStyles(_this.state.mergedPropsStyles, _this.unreadPropStyles, _this.state.lastIdealStyles)) : propStyles; | ||
var currentTime = _performanceNow2['default'](); | ||
var currentTime = timestamp || _performanceNow2['default'](); | ||
var timeDelta = currentTime - _this.prevTime; | ||
@@ -1357,7 +1437,3 @@ _this.prevTime = currentTime; | ||
var _mergeAndSync3 = mergeAndSync( | ||
// $FlowFixMe | ||
_this.props.willEnter, | ||
// $FlowFixMe | ||
_this.props.willLeave, _this.state.mergedPropsStyles, destStyles, _this.state.currentStyles, _this.state.currentVelocities, _this.state.lastIdealStyles, _this.state.lastIdealVelocities); | ||
var _mergeAndSync3 = mergeAndSync(_this.props.willEnter, _this.props.willLeave, _this.state.mergedPropsStyles, destStyles, _this.state.currentStyles, _this.state.currentVelocities, _this.state.lastIdealStyles, _this.state.lastIdealVelocities); | ||
@@ -1378,3 +1454,3 @@ var newMergedPropsStyles = _mergeAndSync3[0]; | ||
for (var key in newMergedPropsStyle) { | ||
if (!newMergedPropsStyle.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(newMergedPropsStyle, key)) { | ||
continue; | ||
@@ -1446,7 +1522,7 @@ } | ||
if (typeof props.styles === 'function') { | ||
// $FlowFixMe | ||
this.unreadPropStyles = props.styles(rehydrateStyles(this.state.mergedPropsStyles, this.unreadPropStyles, this.state.lastIdealStyles)); | ||
var styles = props.styles; | ||
if (typeof styles === 'function') { | ||
this.unreadPropStyles = styles(rehydrateStyles(this.state.mergedPropsStyles, this.unreadPropStyles, this.state.lastIdealStyles)); | ||
} else { | ||
this.unreadPropStyles = props.styles; | ||
this.unreadPropStyles = styles; | ||
} | ||
@@ -1461,2 +1537,3 @@ | ||
componentWillUnmount: function componentWillUnmount() { | ||
this.unmounting = true; | ||
if (this.animationID != null) { | ||
@@ -1537,3 +1614,3 @@ _raf2['default'].cancel(this.animationID); | ||
for (var i = 0; i < prev.length; i++) { | ||
if (!nextKeyIndex.hasOwnProperty(prev[i].key)) { | ||
if (!Object.prototype.hasOwnProperty.call(nextKeyIndex, prev[i].key)) { | ||
// this is called my TM's `mergeAndSync`, which calls willLeave. We don't | ||
@@ -1570,3 +1647,3 @@ // merge in keys that the user desires to kill | ||
var pivot = next[i].key; | ||
if (!prevKeyIndex.hasOwnProperty(pivot)) { | ||
if (!Object.prototype.hasOwnProperty.call(prevKeyIndex, pivot)) { | ||
continue; | ||
@@ -1587,3 +1664,3 @@ } | ||
var pivot = next[i].key; | ||
if (!prevKeyIndex.hasOwnProperty(pivot)) { | ||
if (!Object.prototype.hasOwnProperty.call(prevKeyIndex, pivot)) { | ||
continue; | ||
@@ -1590,0 +1667,0 @@ } |
@@ -12,3 +12,3 @@ | ||
for (var key in obj) { | ||
if (obj.hasOwnProperty(key)) { | ||
if (Object.prototype.hasOwnProperty.call(obj, key)) { | ||
ret[key] = 0; | ||
@@ -15,0 +15,0 @@ } |
@@ -45,3 +45,3 @@ | ||
for (var i = 0; i < prev.length; i++) { | ||
if (!nextKeyIndex.hasOwnProperty(prev[i].key)) { | ||
if (!Object.prototype.hasOwnProperty.call(nextKeyIndex, prev[i].key)) { | ||
// this is called my TM's `mergeAndSync`, which calls willLeave. We don't | ||
@@ -78,3 +78,3 @@ // merge in keys that the user desires to kill | ||
var pivot = next[i].key; | ||
if (!prevKeyIndex.hasOwnProperty(pivot)) { | ||
if (!Object.prototype.hasOwnProperty.call(prevKeyIndex, pivot)) { | ||
continue; | ||
@@ -95,3 +95,3 @@ } | ||
var pivot = next[i].key; | ||
if (!prevKeyIndex.hasOwnProperty(pivot)) { | ||
if (!Object.prototype.hasOwnProperty.call(prevKeyIndex, pivot)) { | ||
continue; | ||
@@ -98,0 +98,0 @@ } |
@@ -87,3 +87,3 @@ 'use strict'; | ||
for (var key in destStyle) { | ||
if (!destStyle.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(destStyle, key)) { | ||
continue; | ||
@@ -119,3 +119,3 @@ } | ||
// call cb? No, otherwise accidental parent rerender causes cb trigger | ||
this.animationID = _raf2['default'](function () { | ||
this.animationID = _raf2['default'](function (timestamp) { | ||
// check if we need to animate in the first place | ||
@@ -137,3 +137,3 @@ var propsStyle = _this.props.style; | ||
var currentTime = _performanceNow2['default'](); | ||
var currentTime = timestamp || _performanceNow2['default'](); | ||
var timeDelta = currentTime - _this.prevTime; | ||
@@ -163,3 +163,3 @@ _this.prevTime = currentTime; | ||
for (var key in propsStyle) { | ||
if (!propsStyle.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(propsStyle, key)) { | ||
continue; | ||
@@ -166,0 +166,0 @@ } |
@@ -12,3 +12,3 @@ | ||
for (var key in style) { | ||
if (!style.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(style, key)) { | ||
continue; | ||
@@ -15,0 +15,0 @@ } |
@@ -100,3 +100,3 @@ 'use strict'; | ||
for (var key in unreadPropStyle) { | ||
if (!unreadPropStyle.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(unreadPropStyle, key)) { | ||
continue; | ||
@@ -133,3 +133,3 @@ } | ||
// call cb? No, otherwise accidental parent rerender causes cb trigger | ||
this.animationID = _raf2['default'](function () { | ||
this.animationID = _raf2['default'](function (timestamp) { | ||
var destStyles = _this.props.styles(_this.state.lastIdealStyles); | ||
@@ -145,3 +145,3 @@ | ||
var currentTime = _performanceNow2['default'](); | ||
var currentTime = timestamp || _performanceNow2['default'](); | ||
var timeDelta = currentTime - _this.prevTime; | ||
@@ -178,3 +178,3 @@ _this.prevTime = currentTime; | ||
for (var key in destStyle) { | ||
if (!destStyle.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(destStyle, key)) { | ||
continue; | ||
@@ -181,0 +181,0 @@ } |
@@ -11,3 +11,3 @@ | ||
var reusedTuple = []; | ||
var reusedTuple = [0, 0]; | ||
@@ -14,0 +14,0 @@ function stepper(secondPerFrame, x, v, destX, k, b, precision) { |
@@ -13,3 +13,3 @@ | ||
for (var key in style) { | ||
if (!style.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(style, key)) { | ||
continue; | ||
@@ -16,0 +16,0 @@ } |
@@ -51,4 +51,6 @@ 'use strict'; | ||
function rehydrateStyles(mergedPropsStyles, unreadPropStyles, plainStyles) { | ||
if (unreadPropStyles == null) { | ||
// $FlowFixMe | ||
// Copy the value to a `const` so that Flow understands that the const won't | ||
// change and will be non-nullable in the callback below. | ||
var cUnreadPropStyles = unreadPropStyles; | ||
if (cUnreadPropStyles == null) { | ||
return mergedPropsStyles.map(function (mergedPropsStyle, i) { | ||
@@ -63,10 +65,7 @@ return { | ||
return mergedPropsStyles.map(function (mergedPropsStyle, i) { | ||
// $FlowFixMe | ||
for (var j = 0; j < unreadPropStyles.length; j++) { | ||
// $FlowFixMe | ||
if (unreadPropStyles[j].key === mergedPropsStyle.key) { | ||
for (var j = 0; j < cUnreadPropStyles.length; j++) { | ||
if (cUnreadPropStyles[j].key === mergedPropsStyle.key) { | ||
return { | ||
// $FlowFixMe | ||
key: unreadPropStyles[j].key, | ||
data: unreadPropStyles[j].data, | ||
key: cUnreadPropStyles[j].key, | ||
data: cUnreadPropStyles[j].data, | ||
style: plainStyles[i] | ||
@@ -76,3 +75,2 @@ }; | ||
} | ||
// $FlowFixMe | ||
return { key: mergedPropsStyle.key, data: mergedPropsStyle.data, style: plainStyles[i] }; | ||
@@ -151,3 +149,2 @@ }); | ||
// $FlowFixMe | ||
var velocity = _mapToZero2['default'](newMergedPropsStyleCell.style); | ||
@@ -216,3 +213,2 @@ newCurrentVelocities[i] = velocity; | ||
} else { | ||
// $FlowFixMe | ||
oldMergedPropsStyles = defaultStyles.map(function (defaultStyleCell) { | ||
@@ -240,6 +236,6 @@ // TODO: key search code | ||
var _mergeAndSync = mergeAndSync( | ||
// $FlowFixMe | ||
willEnter, | ||
// $FlowFixMe | ||
willLeave, oldMergedPropsStyles, destStyles, oldCurrentStyles, oldCurrentVelocities, oldCurrentStyles, // oldLastIdealStyles really | ||
// Because this is an old-style React.createClass component, Flow doesn't | ||
// understand that the willEnter and willLeave props have default values | ||
// and will always be present. | ||
willEnter, willLeave, oldMergedPropsStyles, destStyles, oldCurrentStyles, oldCurrentVelocities, oldCurrentStyles, // oldLastIdealStyles really | ||
oldCurrentVelocities); | ||
@@ -263,2 +259,3 @@ | ||
unmounting: false, | ||
animationID: null, | ||
@@ -277,7 +274,3 @@ prevTime: 0, | ||
clearUnreadPropStyle: function clearUnreadPropStyle(unreadPropStyles) { | ||
var _mergeAndSync2 = mergeAndSync( | ||
// $FlowFixMe | ||
this.props.willEnter, | ||
// $FlowFixMe | ||
this.props.willLeave, this.state.mergedPropsStyles, unreadPropStyles, this.state.currentStyles, this.state.currentVelocities, this.state.lastIdealStyles, this.state.lastIdealVelocities); | ||
var _mergeAndSync2 = mergeAndSync(this.props.willEnter, this.props.willLeave, this.state.mergedPropsStyles, unreadPropStyles, this.state.currentStyles, this.state.currentVelocities, this.state.lastIdealStyles, this.state.lastIdealVelocities); | ||
@@ -295,3 +288,3 @@ var mergedPropsStyles = _mergeAndSync2[0]; | ||
for (var key in unreadPropStyle) { | ||
if (!unreadPropStyle.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(unreadPropStyle, key)) { | ||
continue; | ||
@@ -338,5 +331,8 @@ } | ||
if (this.unmounting) { | ||
return; | ||
} | ||
// TODO: when config is {a: 10} and dest is {a: 10} do we raf once and | ||
// call cb? No, otherwise accidental parent rerender causes cb trigger | ||
this.animationID = _raf2['default'](function () { | ||
this.animationID = _raf2['default'](function (timestamp) { | ||
var propStyles = _this.props.styles; | ||
@@ -353,3 +349,3 @@ var destStyles = typeof propStyles === 'function' ? propStyles(rehydrateStyles(_this.state.mergedPropsStyles, _this.unreadPropStyles, _this.state.lastIdealStyles)) : propStyles; | ||
var currentTime = _performanceNow2['default'](); | ||
var currentTime = timestamp || _performanceNow2['default'](); | ||
var timeDelta = currentTime - _this.prevTime; | ||
@@ -373,7 +369,3 @@ _this.prevTime = currentTime; | ||
var _mergeAndSync3 = mergeAndSync( | ||
// $FlowFixMe | ||
_this.props.willEnter, | ||
// $FlowFixMe | ||
_this.props.willLeave, _this.state.mergedPropsStyles, destStyles, _this.state.currentStyles, _this.state.currentVelocities, _this.state.lastIdealStyles, _this.state.lastIdealVelocities); | ||
var _mergeAndSync3 = mergeAndSync(_this.props.willEnter, _this.props.willLeave, _this.state.mergedPropsStyles, destStyles, _this.state.currentStyles, _this.state.currentVelocities, _this.state.lastIdealStyles, _this.state.lastIdealVelocities); | ||
@@ -394,3 +386,3 @@ var newMergedPropsStyles = _mergeAndSync3[0]; | ||
for (var key in newMergedPropsStyle) { | ||
if (!newMergedPropsStyle.hasOwnProperty(key)) { | ||
if (!Object.prototype.hasOwnProperty.call(newMergedPropsStyle, key)) { | ||
continue; | ||
@@ -462,7 +454,7 @@ } | ||
if (typeof props.styles === 'function') { | ||
// $FlowFixMe | ||
this.unreadPropStyles = props.styles(rehydrateStyles(this.state.mergedPropsStyles, this.unreadPropStyles, this.state.lastIdealStyles)); | ||
var styles = props.styles; | ||
if (typeof styles === 'function') { | ||
this.unreadPropStyles = styles(rehydrateStyles(this.state.mergedPropsStyles, this.unreadPropStyles, this.state.lastIdealStyles)); | ||
} else { | ||
this.unreadPropStyles = props.styles; | ||
this.unreadPropStyles = styles; | ||
} | ||
@@ -477,2 +469,3 @@ | ||
componentWillUnmount: function componentWillUnmount() { | ||
this.unmounting = true; | ||
if (this.animationID != null) { | ||
@@ -479,0 +472,0 @@ _raf2['default'].cancel(this.animationID); |
// Babel 5.x doesn't support type parameters, so we make this alias here out of | ||
// Babel's sight. | ||
/* eslint-disable spaced-comment, no-undef */ | ||
/*:: | ||
import type React from 'react'; | ||
export type ReactElement = React.Element<*>; | ||
*/ | ||
// === basic reused types === | ||
// type of the second parameter of `spring(val, config)` all fields are optional | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,0 +15,0 @@ // the object returned by `spring(value, yourConfig)`. For internal usage only! |
{ | ||
"name": "react-motion", | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"description": "A spring that solves your animation problems.", | ||
@@ -13,10 +13,14 @@ "main": "lib/react-motion.js", | ||
"babel-core": "^5.6.18", | ||
"babel-eslint": "^4.1.3", | ||
"babel-eslint": "^6.1.2", | ||
"babel-loader": "^5.3.1", | ||
"codemirror": "^5.5.0", | ||
"css-loader": "^0.19.0", | ||
"eslint": "^1.6.0", | ||
"eslint-config-airbnb": "0.1.0", | ||
"eslint": "^3.5.0", | ||
"eslint-config-airbnb": "^11.1.0", | ||
"eslint-loader": "^1.1.0", | ||
"eslint-plugin-react": "^3.5.1", | ||
"eslint-plugin-import": "^1.15.0", | ||
"eslint-plugin-jsx-a11y": "^2.2.2", | ||
"eslint-plugin-react": "^6.3.0", | ||
"flow-bin": "^0.32.0", | ||
"flow-copy-source": "^1.1.0", | ||
"inject-loader": "^2.0.1", | ||
@@ -46,3 +50,4 @@ "isparta-loader": "^0.2.0", | ||
"lint": "eslint --ext .js,.jsx .", | ||
"prerelease": "rm -rf lib && babel src --out-dir lib && webpack --config webpack.prod.config.js", | ||
"flow_check": "flow check", | ||
"prerelease": "rm -rf lib && babel src --out-dir lib && flow-copy-source -v src lib && webpack --config webpack.prod.config.js", | ||
"test": "karma start ./karma.conf.js --single-run", | ||
@@ -49,0 +54,0 @@ "test:travis": "karma start ./karma.conf.js --single-run", |
@@ -8,3 +8,3 @@ # React-Motion | ||
```jsx | ||
```js | ||
import {Motion, spring} from 'react-motion'; | ||
@@ -23,7 +23,7 @@ // In your render... | ||
- Bower: **do not install with `bower install react-motion`, it won't work**. Use `bower install --save https://npmcdn.com/react-motion/bower.zip`. Or in `bower.json`: | ||
- Bower: **do not install with `bower install react-motion`, it won't work**. Use `bower install --save https://unpkg.com/react-motion/bower.zip`. Or in `bower.json`: | ||
```json | ||
{ | ||
"dependencies": { | ||
"react-motion": "https://npmcdn.com/react-motion/bower.zip" | ||
"react-motion": "https://unpkg.com/react-motion/bower.zip" | ||
} | ||
@@ -39,3 +39,3 @@ } | ||
```html | ||
<script src="https://npmcdn.com/react-motion/build/react-motion.js"></script> | ||
<script src="https://unpkg.com/react-motion/build/react-motion.js"></script> | ||
(Module exposed as `ReactMotion`) | ||
@@ -42,0 +42,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
273078
34
2498