React Native Swipeable
一个强大的React Native滑动组件. 支持iOS 和 Android。
安装
npm i --save react-native-swipeable
使用方法
使用Swipeable组件封装你的ListView/TableView 条目。
import Swipeable from 'react-native-swipeable';
const leftContent = <Text>Pull to activate</Text>;
const rightButtons = [
<TouchableHighlight><Text>Button 1</Text></TouchableHighlight>,
<TouchableHighlight><Text>Button 2</Text></TouchableHighlight>
];
function MyListItem() {
return (
<Swipeable leftContent={leftContent} rightButtons={rightButtons}>
<Text>My swipeable content</Text>
</Swipeable>
);
}
Props
prop
type
default
description
children
renderable
null
可滑动内容
leftContent
renderable
null
( 可选 ) 拉伸过程中可见的左侧内容
rightContent
renderable
null
( 可选 ) 拉伸过程中可见的右侧内容
leftButtons
renderable[]
null
( 可选 ) 按钮数组,第一个是最隐秘的;忽视ifleftContentpresent
rightButtons
renderable[]
null
( 可选 ) 按钮数组,第一个是最隐秘的;忽视 ifrightContentpresent
leftActionActivationDistance
integer
125
( 可选 ) 激活左侧动作的最小刷卡距离
onLeftActionRelease
function
null
( 可选 ) 用户滑动超过leftActionActivationDistance时发布
rightActionActivationDistance
integer
125
( 可选 ) 激活右侧动作的最小刷卡距离
onRightActionRelease
function
null
( 可选 ) 用户滑动超过 rightActionActivationDistance时发布
示例
运行示例需要:
npm run build
cd example
npm install
react-native run-ios # or run-android