1

As the title of the question says, I want to activate the PanGestureHandler after a long press delay let's say a second (1000 ms) so I tried some workarounds mentioned here: https://github.com/software-mansion/react-native-gesture-handler/discussions/434 but didn't work, the LongPressGestureHandler doesn't work as expected, the pan gesture fires immediately (as in the normal case).

Following is the code I tried:

const Component = () => {
  const longPressRef = useRef();

  return (
    <LongPressGestureHandler minDurationMs={800} ref={longPressRef}>
          <Animated.View style={StyleSheet.absoluteFill}>
            <PanGestureHandler
              waitFor={longPressRef}
              minDist={0}
              {...gestureHandler}
            >
              <Animated.View style={StyleSheet.absoluteFill}>
                ...
              </Animated.View>
            </PanGestureHandler>
          </Animated.View>
        </LongPressGestureHandler>
  );
}

Package.json:

"react-native-gesture-handler": "~2.1.0",
"react-native-reanimated": "~2.3.1",
"react-native-redash": "^16.2.3",

What could be a possible solution for this?

dev1ce
  • 1,419
  • 1
  • 19
  • 39
  • This question looks similar, though using the new RNGH v2 Gesture classes: [How do I implement a drag after a long press using React Native Gesture Handler v2?](https://stackoverflow.com/questions/70715041/how-do-i-implement-a-drag-after-a-long-press-using-react-native-gesture-handler) – pdpino Mar 16 '22 at 18:20

0 Answers0