相关疑难解决方法(0)

检测触摸是否是Apple Pencil或手指在webview中(做出本机反应)

在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的内置限制).

有关:

webview ios react-native

21
推荐指数
2
解决办法
1468
查看次数

标签 统计

ios ×1

react-native ×1

webview ×1