Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

touchcancel事件不触发scrollEnd事件 #1145

Closed
chenyulun opened this issue Jan 21, 2021 · 1 comment
Closed

touchcancel事件不触发scrollEnd事件 #1145

chenyulun opened this issue Jan 21, 2021 · 1 comment

Comments

@chenyulun
Copy link

Version

2.1.1

Reproduction link

https://github.com/chenyulun/better-scroll/blob/dev/packages/shared-utils/src/dom.ts

Steps to reproduce

Android 设备滚动的时候,有机会不触发hooks.on('end',hander)事件
WechatIMG61

What is expected?

希望touchcancel触发end流程

What is actually happening?

Android 设备滚动的时候,,有机会触发touchstart->touchmove->touchcancel;
这种情况下绑定‘end’事件不触发;


其实项目中监听了touchcancel的事件执行end钩子函数,但是eventTypeMap里面没有配置touchcancel事件为触摸事件;

export const eventTypeMap: {
  [key: string]: number
  touchstart: number
  touchmove: number
  touchend: number
  mousedown: number
  mousemove: number
  mouseup: number
} = {
  touchstart: 1,
  touchmove: 1,
  touchend: 1,

  mousedown: 2,
  mousemove: 2,
  mouseup: 2,
}

添加touchcancel: 1事件即可

@theniceangel
Copy link
Collaborator

fixed at v2.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants