Search code examples
react-nativegesturedragonpress

React Native onPressOut


I am using react-native. I want to trigger the function when the user releases the screen. However, onPressOut fires even if the user drags the finger. Is there any simple way that I can detect the timing when the user releases their finger?

 onPressIn={() => {
        console.warn('Pressed!');
      }}
      onPressOut={() => {
        console.warn('Released');
      }}

Solution

  • onPressOut will be called the moment you drag something even if the user still touching the screen.

    You should check onPanResponderRelease, it will trigger when the user releases the touch after dragging. Documentation here