Created
May 13, 2015 23:18
-
-
Save chirag04/d0da460e13eabacce6ee to your computer and use it in GitHub Desktop.
panResponder gist
This file contains 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
var WithLabel = React.createClass({ | |
responder: PanResponder.create({ | |
onStartShouldSetResponderCapture: (evt) => true, | |
onStartShouldSetPanResponder: (evt) => true, | |
onMoveShouldSetPanResponder: (evt) => true, | |
onPanResponderGrant: this.handlePress, | |
onPanResponderMove: this.handlePress, | |
onPanResponderRelease: this.handlePress, | |
onPanResponderTerminate: this.handlePress, | |
}), | |
handlePress: function() { | |
console.log('press'); | |
}, | |
render: function() { | |
return ( | |
<View style={styles.labelContainer}> | |
<View style={styles.label}> | |
<Text>{this.props.label}</Text> | |
</View> | |
<View {...this.responder.panHandlers} style={styles.labelContainer}> | |
{this.props.children} | |
</View> | |
</View> | |
); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment