react-touch-carousel
Advanced tools
Comparing version 0.10.0 to 0.10.1
@@ -351,5 +351,7 @@ "use strict"; | ||
_this.Component = (0, _web.animated)(props.component); | ||
_this.wrapSubComponents(props); | ||
_this.state = { | ||
cursor: props.defaultCursor, | ||
// hack: add MIN_VALUE or react-spring v9 fails autoplay | ||
cursor: props.defaultCursor + Number.MIN_VALUE, | ||
active: false, | ||
@@ -382,6 +384,2 @@ dragging: false, | ||
} | ||
if (prevProps.component !== this.props.component) { | ||
this.Component = (0, _web.animated)(this.props.component); | ||
} | ||
} | ||
@@ -394,2 +392,16 @@ }, { | ||
}, { | ||
key: "wrapSubComponents", | ||
value: function wrapSubComponents(props) { | ||
var _this2 = this; | ||
this.Component = (0, _web.animated)(props.component); | ||
this.Card = (0, _web.animated)(function (_ref) { | ||
var index = _ref.index, | ||
modIndex = _ref.modIndex, | ||
cursor = _ref.cursor, | ||
state = _ref.state; | ||
return _this2.props.renderCard(index, modIndex, cursor, state); | ||
}); | ||
} | ||
}, { | ||
key: "getCursor", | ||
@@ -431,5 +443,6 @@ value: function getCursor() { | ||
value: function render() { | ||
var _this2 = this; | ||
var _this3 = this; | ||
var Component = this.Component; | ||
var Component = this.Component, | ||
Card = this.Card; | ||
@@ -464,12 +477,12 @@ var _this$props7 = this.props, | ||
onRest: this.onSpringRest | ||
}, function (_ref) { | ||
var cursor = _ref.cursor; | ||
_this2.usedCursor = cursor.get(); | ||
}, function (_ref2) { | ||
var cursor = _ref2.cursor; | ||
_this3.usedCursor = cursor.get(); | ||
return /*#__PURE__*/_react["default"].createElement(Component, _extends({}, (0, _utils.omit)(rest, propsKeys), { | ||
cursor: cursor, | ||
carouselState: _this2.state, | ||
onTouchStart: _this2.onTouchStart, | ||
onTouchMove: _this2.onTouchMove, | ||
onTouchEnd: _this2.onTouchEndOrCancel, | ||
onTouchCancel: _this2.onTouchEndOrCancel | ||
carouselState: _this3.state, | ||
onTouchStart: _this3.onTouchStart, | ||
onTouchMove: _this3.onTouchMove, | ||
onTouchEnd: _this3.onTouchEndOrCancel, | ||
onTouchCancel: _this3.onTouchEndOrCancel | ||
}), (0, _utils.range)(0 - padCount, cardCount - 1 + padCount).map(function (index) { | ||
@@ -482,3 +495,9 @@ var modIndex = index % cardCount; | ||
return renderCard(index, modIndex, cursor, _this2.state); | ||
return /*#__PURE__*/_react["default"].createElement(Card, { | ||
key: index, | ||
index: index, | ||
modIndex: modIndex, | ||
cursor: cursor, | ||
state: _this3.state | ||
}); | ||
})); | ||
@@ -485,0 +504,0 @@ }); |
{ | ||
"name": "react-touch-carousel", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"description": "Micro carousel framework for React.JS", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
39227
680
0