1. While using the ListView
list to realize the pull-down refresh, it is necessary to meet the long-term 按列表Item
access to the long-press function page. At
this time, the pull-down refresh may enter the long-click list.
2. At the beginning, I have been thinking about how to distinguish these two actions, but it has been unsuccessful.
First look at my implementation code to
register these four events
touchStart = () => {
const {
touchStartEvent } = this.props;
this.pressTime = setTimeout(() => {
touchStartEvent();
}, '500');
};
touchMove = () => {
clearTimeout(this.pressTime);
};
touchCancel = () => {
};
// 长按事件
handleTouchEnd = () => {
clearTimeout(this.pressTime);
};
I found that the pull-down refresh also triggers the long-press timer when sliding, so the way to solve it is to also go while moving 清除长按的定时器事件
.