React Native - onTouchStart vs PanResponder for multiple touches per second

Viewed 3991

I'm developing an app with React Native which has to respond to tap gestures as soon as possible because more than one tap event can be fired in a second. No need for double tap or move gestures, but need to take care of simultaneous taps. I've been testing with both onTouchStart and PanResponder | onPanResponderGrant and seen that:

  • onTouchStart is fired twice when two taps are simultaneous, while onPanResponderGrant is called just once.
  • onPanResponderMove is fired even when I have onMoveShouldSetPanResponder to false, and it's fired many times when two taps are simultaneous, or when there are several taps in a second.
  • When several taps are done in a second, onTouchStart works fine, but onPanResponderGrant is fired less times.

Based on above reasons, I think that I'd better use onTouchStart.

Now the question is: Should I use onTouchStart even when React Native docs suggest to use the PanResponder for multi-touch gestures?

PanResponder reconciles several touches into a single gesture. It makes single-touch gestures resilient to extra touches, and can be used to recognize simple multi-touch gestures.

Or am I missing something of PanResponder?

Edit:

Also, gestureState.numberActiveTouches is always 1, event when two taps are simultaneous. I thought that this could do the trick.

1 Answers
Related