在safari mobile中,触摸可以分为Apple Pencil vs other(手指/鼠标),使用:
event.touches[0].touchType === 'stylus' //pencil
event.touches[0].touchType !== 'stylus' //other
Run Code Online (Sandbox Code Playgroud)
但是,在本机webview(Apple Pencil和使用手指)中收到的所有事件都会收到:
touchType === 'direct' //inside webview, both pencil and other
Run Code Online (Sandbox Code Playgroud)
如何在Webview中检测Apple Pencil的触摸?
显然event.touches[0] > 0是另一种可能性,但这也0适用于webview中的两种类型.
(不确定这是反应原生的问题还是webviews的内置限制).
有关: