ant-design ListView drop-down refresh and list long press event conflict resolution method

1. While using the ListViewlist to realize the pull-down refresh, it is necessary to meet the long-term 按列表Itemaccess 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 清除长按的定时器事件.

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_45416217/article/details/114375621