反应本机Android向上滑动

时间:2019-02-26 04:44:48

标签: react-native react-native-android

Iam制作了一个运输应用程序,并且需要一个可以响应本地用户需求的组件,可以在人们想要设置位置时向上滑动

如何像下面的图像示例一样向上滑动?

before swipe

after swipe up

有人有这样的参考文献或教程吗?预先感谢

2 个答案:

答案 0 :(得分:1)

您可以使用https://facebook.github.io/react-native/docs/gesture-responder-system进行此操作 或使用https://github.com/glepur/react-native-swipe-gestures的简单方法。 我实际上会使用模块react-native-swipe-gestures来提高效率和速度。

答案 1 :(得分:1)

我认为您正在寻找this library

安装:

npm install react-native-swipe-up-down --save

基本用法

import SwipeUpDown from 'react-native-swipe-up-down';


<SwipeUpDown        
    itemMini={<ItemMini />} // Pass props component when collapsed
    itemFull={<ItemFull />} // Pass props component when show full
    onShowMini={() => console.log('mini')}
    onShowFull={() => console.log('full')}
    onMoveDown={() => console.log('down')}
    onMoveUp={() => console.log('up')}
    disablePressToShow={false} // Press item mini to show full
    style={{ backgroundColor: 'green' }} // style for swipe
/>

输出: this