您可以使用https://facebook.github.io/react-native/docs/gesture-responder-system或使用https://github.com/glepur/react-native-swipe-gestures轻松实现此目的。我实际上会使用模块react-native-swipe-gestures
导致高效和快速。
我想你正在寻找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