我们知道app中都有下拉加载,在react native中也有类似的控件,本文主要介绍了react native中的refreshcontorl下拉刷新使用,希望能帮助到大家。
一、属性方法
(1) onRefresh function 在视图开始刷新的时候调用
(2) refreshing bool 视图是否在刷新时显示指示器,也表明当前是否在刷新中
(3) colors [ColorPropType] android平台适用 进行设置加载进去指示器的颜色,至少设置一种,最多可以设置4种
(4) enabled bool android平台适用 用来设置下拉刷新功能是否可用
(5) progressBackgroundColor ColorPropType 设置加载进度指示器的背景颜色
(6) size RefreshLayoutConsts.SIZE.DEFAULT android平台适用 加载进度指示器的尺寸大小
(7) tintColor ColorPropType iOS平台适用 设置加载进度指示器的颜色
(8)title string iOS平台适用 设置加载进度指示器下面的标题文本信息
二、使用方法
<ScrollView
refreshControl={
<RefreshControl
refreshing={this.state.isRefreshing}
onRefresh={this._onRefresh}
tintColor="#ff0000"
title="Loading..."
titleColor="#00ff00"
colors={['#ff0000', '#00ff00', '#0000ff']}
progressBackgroundColor="#ffff00"
/>
}
/>
_onRefresh() {
this.setState({
isRefreshing:true
});
var self = this;
setTimeout(()=>{
//加载数据
},2000)
}这样就出现加载效果了。
相关推荐:
以上就是React Native中RefreshContorl下拉刷新教程的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号