React Native - Detect Double Tap
var Index = React.createClass({
getInitialState: function () {
return {
lastPress: 0
}
},
onPress: function () {
var delta = new Date().getTime() - this.state.lastPress;
if(delta < 200) {
// double tap happend
}
this.setState({
lastPress: new Date().getTime()
})
},
render: function() {
return (
<TouchableHighlight onPress={this.onPress}></TouchableHighlight>
)
}
});