Javascript 在 React Native 中检测向左滑动

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45854450/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 03:14:25  来源:igfitidea点击:

Detect swipe left in React Native

javascriptnode.jsreactjsreact-native

提问by Jamgreen

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

如何在 React Native 中检测整个屏幕上的向左滑动?

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

是否有必要使用 PanResponder 或者可以更容易地完成吗?

回答by Bhavan Patel

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

现有组件react-native-swipe-gestures用于处理向上、向下、向左和向右方向的滑动手势,请参阅https://github.com/glepur/react-native-swipe-gestures

回答by Nikhil Gogineni

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

您可以使用react-native-swipe-gesture。你不需要使用 npm 安装任何第三方模块。将文件下载到您的项目中并按照给定的步骤操作

回答by Tarik Chakur

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

您可以使用React Native Gesture Handler,尽管它提供了比滑动更多的手势。这是一个滑动示例