[RN] React Native FlatList跳转到顶部/底部
React Native FlatList跳转到顶部/底部
核心代码如下:
<ScrollView showsVerticalScrollIndicator={false} contentContainerStyle={styles.container}
//下拉刷新 ,有 ScrollView 需要加载ScrollView,无则加到 FlatList
refreshControl={
<RefreshControl
refreshing={this.state.isRefreshing}
onRefresh={this._onRefresh.bind(this, )}
/>
}
>
<FlatList
ref={(flatList)=>this._flatList = flatList}
data={this.state.data}
style={styles.flatList}
keyExtractor={this._keyExtractor}
renderItem={this._renderItem.bind(this)}
ItemSeparatorComponent={this._itemDivide}
ListEmptyComponent={this._renderLoadEmpty.bind(this)}
//上拉加载
ListFooterComponent={this._renderFooter.bind(this)}
onEndReached={this._onEndReached.bind(this)}
onEndReachedThreshold={0.2}
/>
<ActionButton
size={}
buttonColor="#ccc"
onPress={() => {
this._flatList.scrollToOffset({animated: true, viewPosition: 0, index: 0}); //跳转到顶部
// this._flatList.scrollToEnd(); //跳转到底部
}}
renderIcon={() => (<View style={styles.actionButtonView}>
<Iconfont name="icon-shouqijiantouxiao" size={} style={styles.actionButtonIcon}/>
</View>)}
/>
</ScrollView>
其中漂浮按钮用 react-native-action-button 的 ActionButton
本博客地址: wukong1688
本文原文地址:https://www.cnblogs.com/wukong1688/p/10906004.html
转载请著名出处!谢谢~~
[RN] React Native FlatList跳转到顶部/底部的更多相关文章
- [RN] React Native FlatList 选中后 状态没有立即发生改变,而在下一次生效的问题
React Native FlatList 选中后 状态没有立即发生改变,而在下一次生效的问题 解决关键: 给 FlatList 添加 extraData={this.state} 非常关键,如果不设 ...
- [RN] React Native 滚动跳转到指定位置
React Native 滚动跳转到指定位置 一.结构 <ScrollView horizontal={true} ref={(view) => { this.myScrollView = ...
- [RN] React Native ScrollView自动滑动到顶部
react-native 自动滚到屏幕顶部,模仿微信朋友圈评论自动定位 <ScrollView showsVerticalScrollIndicator={false} style={[styl ...
- [RN] React Native 下实现底部标签(支持滑动切换)
上一篇文章 [RN] React Native 下实现底部标签(不支持滑动切换) 总结了不支持滑动切换的方法,此篇文章总结出 支持滑动 的方法 准备工作之类的,跟上文类似,大家可点击上文查看相关内容. ...
- [RN] React Native 实现图片预览
[RN] React Native 实现图片预览 效果预览: 代码如下: 'use strict'; import React, {Component} from 'react'; import {I ...
- [RN] React Native 常见基本问题归纳总结
[RN] React Native 常见基本问题归纳总结 本问题总结涉及到版本为: "react": "16.8.3","react-native& ...
- [RN] React Native 关闭所有黄色警告
[RN] React Native 关闭所有黄色警告 console.ignoredYellowBox = ['Warning: BackAndroid is deprecated. Please u ...
- [RN] React Native 幻灯片效果 Banner
[RN] React Native 幻灯片效果 Banner 1.定义Banner import React, {Component} from 'react'; import {Image, Scr ...
- [RN] React Native 常用命令行
[RN] React Native 常用命令行 1.查看当前版本 react-native --version 或 react-native -v 2.创建指定版本的React Native项目 1) ...
随机推荐
- SQL Server优化之SET STATISTICS开关(转载)
一.准备工作 缓存对于某个查询的性能影响十分之大,所以优化之前要清空缓存. 清除Buffer Pool里面的所有缓存 DBCC DROPCLEANBUFFERS 清除Buffer Pool里的所有缓存 ...
- centos lnmp一键安装
安装 系统需求: 需要2 GB硬盘剩余空间 128M以上内存,OpenVZ的建议192MB以上(小内存请勿使用64位系统) Linux下区分大小写,输入命令时请注意! 安装步骤: 1.使用putty或 ...
- [Linux] Ubuntu Server18 python3.7 虚拟环境
Ubuntu Server18 python3.7 环境 Ubuntu Server18 默认是python3.6, 目前开发主要用python3.7. 所以想搭建python3.7环境. 试过几手动 ...
- selenium firefox 内存 速度优化
selenium firefox 内存 速度优化 2 23 profile = webdriver.FirefoxProfile() 2 24 profile.set_preference(" ...
- JavaWeb第三天--JavaScript
JavaScript 1. JavaScript概述 1.1 JavaScript是什么?有什么作用? HTML:就是用来写网页的.(人的身体) CSS:就是用来美化页面的.(人的衣服) JavaSc ...
- 汽配生产的精益化管理如何实现?这家3000人的企业靠MES系统进行管理
精益达电子事业部电子车间于在完成车间改造后,生产能力得到大幅提升.但生产制造过程信息化仍处于空白,众多设备处于单机工作模式,车间现场计划排产.物料管理.质量管理等,还处于原始的凭经验.人工干预方式. ...
- Python 栈、队列的实现
在python中,列表既可以作为栈使用,又可以作为队列使用. 把列表作为栈使用 栈:后进先出 stack=[1,2,3] stack.append(4) #入栈,以列表尾部为栈顶 print(stac ...
- mybatis update 返回值
mybatis sql: <update id="test" parameterType="map"> update test_0731 set n ...
- CentOS6.7搭建部署DNS服务 (详解主配置文件)
-DNS服务器的基本原理 域名简介:使用tcp/udp协议,默认使用53端口号 默认情况下,客户端发起的查询请求都是用UDP/53查询的. 默认情况下,从从服务器到主服务器传输数据用的是TCP/53. ...
- 使用salt-stack指定IP添加系统用户为root的权限
指定多台要授权的用户,指定root权限 salt -L '192.168.3.212' cmd.run 'useradd fengniao -u 2000' salt -L '192.168.3.21 ...