Answer the question
In order to leave comments, you need to log in
Why doesn't the onStartShouldSetPanResponder event fire?
Hello! Faced the following problem in my react-native application:
this._panResponder = PanResponder.create({
// Ask to be the responder:
onStartShouldSetPanResponder: () => {
console.log('onStartShouldSetPanResponder');
if (this.state.draggingComponent) {
this._handleDrop();
}
return true
},
onMoveShouldSetPanResponder: (evt, gestureState) => {
console.log('onMoveShouldSetPanResponder');
return true;
},
onPanResponderGrant: () => {
console.log('onPanResponderGrant');
// return true;
},
onPanResponderMove: (...args) => {
console.log('onPanResponderMove');
return Animated.event([null, {
dx: this.state.location.x, // x,y are Animated.Value
dy: this.state.location.y,
}]).apply(this, args);
},
onPanResponderRelease: (evt, gestureState) => {
console.log('onPanResponderRelease')
if (!this.state.draggingComponent) return false;
//Ensures we exit all of the active drop zones
this._handleDrop();
},
onResponderReject: () => {
console.log('reject');
}
});
onStartShouldSetPanResponder
fires only if it's outside the child element. If you click on it, then this event will not work, but all the others seem onPanResponderMove
to onPanResponderRelease
work great. What can be wrong?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question