Created
March 20, 2019 02:50
-
-
Save iskenxan/6960507be90561c17b8e27ffb92b262c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.mainPanResponder = PanResponder.create({ | |
onStartShouldSetPanResponder: () => true, | |
onMoveShouldSetPanResponder: () => true, | |
onPanResponderMove: Animated.event([ | |
null, { dx: this.mainPosition.x, dy: this.mainPosition.y } | |
]), | |
onPanResponderGrant: (event, gesture) => { | |
this.mainPosition.setOffset({ | |
x: this.mainPosition.x._value, | |
y: this.mainPosition.y._value | |
}); | |
this.mainPosition.setValue({ x: 0, y: 0 }); | |
}, | |
onPanResponderRelease: (e, gesture) => { | |
this.mainPosition.flattenOffset(); | |
if (gesture.dy < -150) { | |
const y = gesture.dy + this.panelY + this.scrollY; | |
this.addCard(y) | |
} | |
this.mainPosition.setValue({ x: 0, y: 0 }); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment