//这个视图是否在触摸开始时想成为响应器?
onStartShouldSetPanResponder:this._onStartShouldSetPanResponder,
//所以如果一个父视图要防止子视图在触摸开始时成为响应器,它应该有一个 onStartShouldSetResponderCapture 处理程序,返回 true。
onStartShouldSetPanResponderCapture:this._onStartShouldSetPanResponderCapture,
//当视图不是响应器时,该指令被在视图上移动的触摸调用:这个视图想“声明”触摸响应吗?
onMoveShouldSetPanResponder:this._onMoveShouldSetPanResponder,
//所以如果一个父视图要防止子视图在移动开始时成为响应器,它应该有一个 onMoveShouldSetPanResponderCapture 处理程序,返回 true。
onMoveShouldSetPanResponderCapture:this._onMoveShouldSetPanResponderCapture,
//当前有其他的东西成为响应器并且没有释放它。
onPanResponderReject: this._onPanResponderReject,
//视图现在正在响应触摸事件。这个时候要高亮标明并显示给用户正在发生的事情。
onPanResponderGrant: this._onPanResponderGrant,
//手势开始
onPanResponderStart: this._onPanResponderStart,
//手势结束
onPanResponderEnd: this._onPanResponderEnd,
//用户正移动他们的手指
onPanResponderMove: this._onPanResponderMove,
//在触摸最后被引发,即“touchUp”
onPanResponderRelease: this._onPanResponderRelease,
//其他的东西想成为响应器。这种视图应该释放应答吗?返回 true 就是允许释放
onPanResponderTerminationRequest:this._onPanResponderTerminationRequest,
//响应器已经从该视图抽离了。可能在调用onResponderTerminationRequest 之后被其他视图获取,也可能是被操作系统在没有请求的情况下获取了(发生在 iOS 的 control center/notification center)。
onPanResponderTerminate: this._onPanResponderTerminate,
// Returns whether this component should block native components from becoming the JS
// responder. Returns true by default. Is currently only supported on android.
onShouldBlockNativeResponder:this._onShouldBlockNativeResponder,
其他的不介绍了,官网用法都有,这里有一个问题在网上搜索了不少资料也没解决
onPanResponderEnd: this._onPanResponderEnd, // 结束 包括release的方法 onPanResponderTerminate: this._onPanResponderTerminate, // 判断当前 手势 如果被拦截了就执行这里 不会再进去release判断
如果没有响应的情况下,吧 下面这个拦截的方法加上然后再在里面执行同样的代码就能解决了
_onPanResponderEnd(e, gestureState) { //your code const {onAfterChange} = this.props; if (onAfterChange) { onAfterChange(this.state.process); // onAfterChange(gestureState.x0 - 120); } } _onPanResponderTerminate(e, gestureState) { //your code const {onAfterChange} = this.props; if (onAfterChange) { onAfterChange(this.state.process); // onAfterChange(gestureState.x0 - 120); } }