强大的RN滑动组件 – react-native-swipeable
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
安装
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
...全文
相关推荐
React Native 源码分析(一)——启动流程
本系列文章,是分析Android 的 React Native 的源码,主要包括以下文章,和以往的源码系列一样,分析主流程的代码,不会细致到每一行(但是比Gradle源码分析,要细致很多),会涉及到java、C++、js等源码。 RN版本是0.64.0 1、React Native 源码分析(一)—— 启动流程 2、React Native 源码分析(二)—— 通信机制 3、React Native 源码分析(三)—— UI渲染流程 4、React Native 源码分析(四)—— 任务调度 5、React
大模型+数字仓储解决方案.pptx
大模型+数字仓储解决方案.pptx
中小企业在引进外部技术进行产业化时,标准的技术转移操作流程是什么?.docx
科易网基于行业知识库+行业大数据+科技资源要素+AI模型,以AI,赋能技术转移、成果转化、技术经理人培训、知识产权管理、区域产业分析与布局、地方科技招商、创新创业大赛等场景,推出科技创新领域的AI工具、场景化服务和数智化解决方案,推动科技创新与产业创新智能化发展。
MES车间级工业4.0智能制造管理系统.pptx
MES车间级工业4.0智能制造管理系统.pptx
5G 工业互联网规划方案.pptx
5G 工业互联网规划方案.pptx


其他技术讨论专区
