React Native Android Swipe Up

问题描述 投票:1回答:2

我做了一个运输应用程序,当人们想要设置位置时,需要一个可以反应原生的组件

如何像下面的图像示例一样刷卡?

before swipe

after swipe up

任何人都有这样的参考或教程?提前致谢

react-native react-native-android
2个回答
1
投票

您可以使用https://facebook.github.io/react-native/docs/gesture-responder-system或使用https://github.com/glepur/react-native-swipe-gestures轻松实现此目的。我实际上会使用模块react-native-swipe-gestures导致高效和快速。


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

© www.soinside.com 2019 - 2024. All rights reserved.