Skip to content

Commit

Permalink
Merge pull request alexbrillant#4 from alexbrillant/master
Browse files Browse the repository at this point in the history
pull latest from AB
  • Loading branch information
webraptor authored Jun 7, 2017
2 parents 5ef7f85 + dd63dea commit eb5d7ca
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 35 deletions.
23 changes: 23 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"rules": {
"no-const-assign": "warn",
"no-this-before-super": "warn",
"no-undef": "warn",
"no-unreachable": "warn",
"no-unused-vars": "warn",
"constructor-super": "warn",
"valid-typeof": "warn"
}
}
4 changes: 2 additions & 2 deletions Exemples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"prop-types": "^15.5.10",
"react": "^16.0.0-alpha.6",
"react-native": "0.44.0",
"react-native-deck-swiper": "^1.1.8"
"react-native-deck-swiper": "^1.1.9"
},
"devDependencies": {
"babel-jest": "19.0.0",
Expand All @@ -21,4 +21,4 @@
"jest": {
"preset": "react-native"
}
}
}
64 changes: 32 additions & 32 deletions Swiper.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,20 @@ class Swiper extends React.Component {
});
};

validPanResponderRelease = (animatedValueX, animatedValueY) => {
validPanResponderRelease = () => {
const {
horizontalThreshold,
verticalThreshold,
disableBottomSwipe,
disableLeftSwipe,
disableRightSwipe,
disableTopSwipe } = this.props;
disableTopSwipe
} = this.props;

const isSwipingLeft = animatedValueX < -horizontalThreshold;
const isSwipingRight = animatedValueX > horizontalThreshold;
const isSwipingTop = animatedValueY < -verticalThreshold;
const isSwipingBottom = animatedValueY > verticalThreshold;
const isSwipingLeft = this._animatedValueX < -horizontalThreshold;
const isSwipingRight = this._animatedValueX > horizontalThreshold;
const isSwipingTop = this._animatedValueY < -verticalThreshold;
const isSwipingBottom = this._animatedValueY > verticalThreshold;

return (isSwipingLeft && !disableLeftSwipe) ||
(isSwipingRight && !disableRightSwipe) ||
Expand All @@ -131,11 +132,10 @@ class Swiper extends React.Component {
const { horizontalThreshold, verticalThreshold } = this.props;
const animatedValueX = Math.abs(this._animatedValueX);
const animatedValueY = Math.abs(this._animatedValueY);

const isSwiping =
animatedValueX > horizontalThreshold ||
const isSwiping = animatedValueX > horizontalThreshold ||
animatedValueY > verticalThreshold;
if (isSwiping && this.validPanResponderRelease(animatedValueX,animatedValueY)) {

if (isSwiping && this.validPanResponderRelease()) {
const onSwipeDirectionCallback = this.getOnSwipeDirectionCallback(
this._animatedValueX,
this._animatedValueY
Expand Down Expand Up @@ -294,27 +294,27 @@ class Swiper extends React.Component {
};

calculateSecondCardZoomStyle = () => [
styles.card,
this.cardStyle,
{
zIndex: 1,
transform: [{ scale: this.state.scale }]
},
this.customCardStyle
];
styles.card,
this.cardStyle,
{
zIndex: 1,
transform: [{ scale: this.state.scale }]
},
this.customCardStyle
];

calculateSwipeBackCardStyle = () => [
styles.card,
this.cardStyle,
{
zIndex: 4,
transform: [
{ translateX: this.state.previousCardX },
{ translateY: this.state.previousCardY }
]
},
this.customCardStyle
];
styles.card,
this.cardStyle,
{
zIndex: 4,
transform: [
{ translateX: this.state.previousCardX },
{ translateY: this.state.previousCardY }
]
},
this.customCardStyle
];

interpolateOpacity = () => {
const animatedValueX = Math.abs(this._animatedValueX);
Expand All @@ -337,9 +337,9 @@ class Swiper extends React.Component {
};

interpolateRotation = () => this.state.pan.x.interpolate({
inputRange: this.props.inputRotationRange,
outputRange: this.props.outputRotationRange
});
inputRange: this.props.inputRotationRange,
outputRange: this.props.outputRotationRange
});

render() {
return (
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-deck-swiper",
"version": "1.1.8",
"version": "1.1.9",
"description": "Awesome tinder like card swiper for react-native. Highly Customizable!",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit eb5d7ca

Please sign in to comment.