[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) ...
随机推荐
- Python进阶----pymysql模块的使用,单表查询
Python进阶----pymysql模块的使用,单表查询 一丶使用pymysql 1.下载pymysql包: pip3 install pymysql 2.编写代码 ...
- centos7.5内核编译安装
1.安装依赖 yum -y install gcc bc gcc-c++ ncurses ncurses-devel cmake elfutils-libelf-devel openssl-devel ...
- 08-Vuex
Vuex 一.简介 ① 是什么:是一个状态管理工具,存放项目组件中的公共数据 二.使用语法 ① 语法 -1. 创建 Vuex 实例 const store = new Vuex.Store({ sta ...
- NGINX PHP 报错整理合集
NGINX PHP "No input file specified" 修改php.ini conf cgi.fix_pathinfo=1; 修改nginx.conf,中的fast ...
- MySQL Table--独立表空间
数据库表空间 独立表空间 在MySQL 5.6 中引入独立表空间的概念,启用独立表空间后,每个表将生成独立的文件来进行存储. 创建表时可以指定表存放的文件路径 ##首选需要确保innodb_file_ ...
- linux内核--wait_event_interruptible_timeout()函数分析(转)
原文:https://blog.csdn.net/wuyongpeng0912/article/details/45723657 网上有关于此函数的分析,但大都是同一篇文章转载来转载去,没有进一步的分 ...
- python工程化最佳实践
1.pipenv 真实环境 vs virtualenv vs pipenv 2.自定义用户模型 继承BaseUserManager和AbstractBaseUser,在settings中指定AUTH_ ...
- ARM架构体系
架构 处理器家族 ARMv1 ARM1 ARMv2 ARM2.ARM3 ARMv3 ARM6, ARM7 ARMv4 StrongARM.ARM7TDMI.ARM9TDMI ARMv5 ARM7EJ. ...
- Mac下Mysql配置
安装 http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.6/mysql-5.6.41-macos10.13-x86_ ...
- flask通过nginx代理后base_url拿不到正确的url_scheme2016-04-14 12:31
http://www.axiaoxin.com/article/210/ Nginx配置了https请求后,用户发起https请求时首先和Nginx建立连接,完成SSL握手,而后Nginx作为代理是以 ...