software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
6.13k stars 982 forks source link

[Web] Remove `TouchEventManager` #3101

Closed m-bert closed 2 months ago

m-bert commented 2 months ago

Description

While working on stylus support I've noticed that events from stylus are being sent twice. This is because pen also sends TouchEvents. Our code has the following check:

if (event.changedTouches[i].touchType === 'stylus') {
  continue;
}

The problem with this approach is that touchType is only supported on mobile Safari.

Given that TouchEvents that we send to handlers are constructed manually from data taken from PointerTracker (see this function) I think it is better to remove TouchEventManager than trying to find some weird ways to block it from sending stylus events.

Test plan

Verified that our examples work as they should