Skip to content

Commit

Permalink
Push updated build
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronCCWong committed Sep 25, 2023
1 parent 0ee7635 commit 3c7bb4e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
28 changes: 9 additions & 19 deletions lib/ReactCardFlip.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var react_1 = require("react");
var ReactCardFlip = function (props) {
var _a = props.cardStyles, back = _a.back, front = _a.front, cardZIndex = props.cardZIndex, containerStyle = props.containerStyle, containerClassName = props.containerClassName, flipDirection = props.flipDirection, flipSpeedFrontToBack = props.flipSpeedFrontToBack, flipSpeedBackToFront = props.flipSpeedBackToFront, infinite = props.infinite;
var _b = (0, react_1.useState)(props.isFlipped), isFlipped = _b[0], setFlipped = _b[1];
var _c = (0, react_1.useState)(0), rotation = _c[0], setRotation = _c[1];
var _a = __assign({ cardStyles: {
back: {},
front: {},
}, cardZIndex: 'auto', containerStyle: {}, flipDirection: 'horizontal', flipSpeedBackToFront: 0.6, flipSpeedFrontToBack: 0.6, infinite: false, isFlipped: false }, props), _b = _a.cardStyles, back = _b.back, front = _b.front, cardZIndex = _a.cardZIndex, containerStyle = _a.containerStyle, containerClassName = _a.containerClassName, flipDirection = _a.flipDirection, flipSpeedFrontToBack = _a.flipSpeedFrontToBack, flipSpeedBackToFront = _a.flipSpeedBackToFront, infinite = _a.infinite, isFlipped = _a.isFlipped;
var _c = (0, react_1.useState)(isFlipped), isFlippedState = _c[0], setFlipped = _c[1];
var _d = (0, react_1.useState)(0), rotation = _d[0], setRotation = _d[1];
(0, react_1.useEffect)(function () {
if (props.isFlipped !== isFlipped) {
setFlipped(props.isFlipped);
if (isFlipped !== isFlippedState) {
setFlipped(isFlipped);
setRotation(function (c) { return c + 180; });
}
}, [props.isFlipped]);
}, [isFlipped]);
var getContainerClassName = (0, react_1.useMemo)(function () {
var className = 'react-card-flip';
if (containerClassName) {
Expand Down Expand Up @@ -81,17 +84,4 @@ var ReactCardFlip = function (props) {
React.createElement("div", { className: "react-card-front", style: styles.front }, getComponent(0)),
React.createElement("div", { className: "react-card-back", style: styles.back }, getComponent(1)))));
};
ReactCardFlip.defaultProps = {
cardStyles: {
back: {},
front: {},
},
cardZIndex: 'auto',
containerStyle: {},
flipDirection: 'horizontal',
flipSpeedBackToFront: 0.6,
flipSpeedFrontToBack: 0.6,
infinite: false,
isFlipped: false,
};
exports.default = ReactCardFlip;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-card-flip",
"version": "1.2.1",
"version": "1.2.2",
"description": "ReactCardFlip",
"main": "./lib/ReactCardFlip.js",
"types": "./lib/ReactCardFlip.d.ts",
Expand Down

0 comments on commit 3c7bb4e

Please sign in to comment.