Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CardStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class CardStack extends Component {
this._nextCard('right', swipeDirection, gestureState.dy, this.props.duration);
}
else {
this.props.onSwipeCancel()
this._resetCard();
}
} else if (((Math.abs(gestureState.dy) > verticalThreshold) ||
Expand All @@ -108,10 +109,12 @@ class CardStack extends Component {
this._nextCard('bottom', gestureState.dx, swipeDirection, this.props.duration);
}
else {
this.props.onSwipeCancel()
this._resetCard();
}
}
else {
this.props.onSwipeCancel()
this._resetCard();
}
},
Expand Down Expand Up @@ -142,7 +145,7 @@ class CardStack extends Component {
}

_getIndex(index, cards){
return this.props.loop ?
return this.props.loop ?
this.mod(index, cards):
index;
}
Expand Down Expand Up @@ -475,6 +478,7 @@ CardStack.propTypes = {
renderNoMoreCards: PropTypes.oneOfType([PropTypes.func, PropTypes.element]),
onSwipeStart: PropTypes.func,
onSwipeEnd: PropTypes.func,
onSwipeCancel: PropTypes.func,
onSwiped: PropTypes.func,
onSwipedLeft: PropTypes.func,
onSwipedRight: PropTypes.func,
Expand Down Expand Up @@ -507,6 +511,7 @@ CardStack.defaultProps = {
renderNoMoreCards: () => { return (<Text>No More Cards</Text>) },
onSwipeStart: () => null,
onSwipeEnd: () => null,
onSwipeCancel: () => null,
onSwiped: () => { },
onSwipedLeft: () => { },
onSwipedRight: () => { },
Expand Down
5 changes: 3 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export interface CardStackProps {
horizontalThreshold?: number;
outputRotationRange?: [string, string, string]
onSwipeStart?: (index: number) => void;
onSwipeEnd?: (index: number) => void;
onSwipeEnd?: (index: number) => void;
onSwipeCancel?: () => void;
onSwiped?: (index: number) => void;
onSwipedLeft?: (index: number) => void;
onSwipedRight?: (index: number) => void;
Expand Down Expand Up @@ -48,4 +49,4 @@ export interface CardProps {

export class Card extends React.Component<CardProps> {
constructor(props: CardProps);
}
}