Detect swipe left in React Native

后端 未结 4 1419
心在旅途
心在旅途 2020-12-18 19:50

How can I detect a left swipe on the entire screen in React Native?

Would it be necessary to use PanResponder or can it be done a little more easy?

相关标签:
4条回答
  • 2020-12-18 20:17

    If you are using a managed Expo project there is a documented gesture handler here: https://docs.expo.io/versions/latest/sdk/gesture-handler/

    The source code docs can be found here: https://docs.swmansion.com/react-native-gesture-handler/docs/

    For swiping I think you would need to use FlingGestureHandler: https://docs.swmansion.com/react-native-gesture-handler/docs/handler-fling

    0 讨论(0)
  • 2020-12-18 20:27

    There is an existing component react-native-swipe-gestures for handling swipe gestures in up, down, left and right direction, see https://github.com/glepur/react-native-swipe-gestures

    0 讨论(0)
  • 2020-12-18 20:35

    You can use react-native-swipe-gesture. You don't need to install any third party module using npm. Download the file into your project and follow the given steps

    0 讨论(0)
  • 2020-12-18 20:36

    You can use React Native Gesture Handler although it provides more gestures then swiping. Here's a swipe example.

    0 讨论(0)
提交回复
热议问题