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跳转到顶部/底部的更多相关文章

  1. [RN] React Native FlatList 选中后 状态没有立即发生改变,而在下一次生效的问题

    React Native FlatList 选中后 状态没有立即发生改变,而在下一次生效的问题 解决关键: 给 FlatList 添加 extraData={this.state} 非常关键,如果不设 ...

  2. [RN] React Native 滚动跳转到指定位置

    React Native 滚动跳转到指定位置 一.结构 <ScrollView horizontal={true} ref={(view) => { this.myScrollView = ...

  3. [RN] React Native ScrollView自动滑动到顶部

    react-native 自动滚到屏幕顶部,模仿微信朋友圈评论自动定位 <ScrollView showsVerticalScrollIndicator={false} style={[styl ...

  4. [RN] React Native 下实现底部标签(支持滑动切换)

    上一篇文章 [RN] React Native 下实现底部标签(不支持滑动切换) 总结了不支持滑动切换的方法,此篇文章总结出 支持滑动 的方法 准备工作之类的,跟上文类似,大家可点击上文查看相关内容. ...

  5. [RN] React Native 实现图片预览

    [RN] React Native 实现图片预览 效果预览: 代码如下: 'use strict'; import React, {Component} from 'react'; import {I ...

  6. [RN] React Native 常见基本问题归纳总结

    [RN] React Native  常见基本问题归纳总结 本问题总结涉及到版本为: "react": "16.8.3","react-native& ...

  7. [RN] React Native 关闭所有黄色警告

    [RN] React Native 关闭所有黄色警告 console.ignoredYellowBox = ['Warning: BackAndroid is deprecated. Please u ...

  8. [RN] React Native 幻灯片效果 Banner

    [RN] React Native 幻灯片效果 Banner 1.定义Banner import React, {Component} from 'react'; import {Image, Scr ...

  9. [RN] React Native 常用命令行

    [RN] React Native 常用命令行 1.查看当前版本 react-native --version 或 react-native -v 2.创建指定版本的React Native项目 1) ...

随机推荐

  1. 【Linux】CentOS7 打开关闭防火墙及端口

    一.centos7版本对防火墙进行加强,不再使用原来的iptables,启用firewalld1.firewalld的基本使用启动: systemctl start firewalld查状态:syst ...

  2. 静下心来学jquery的用法

    http://blog.csdn.net/xiaojun1288/article/details/6803552

  3. React 父/子窗体参数传递

    1.父窗体 import Modal from './Modal' onModalRef = ref => { this.modal = ref } onCallback = msg => ...

  4. C#读写调整修改设置UVC摄像头画面-逆光对比

    有时,我们需要在C#代码中对摄像头的逆光对比进行读和写,并立即生效.如何实现呢? 建立基于SharpCamera的项目 首先,请根据之前的一篇博文 点击这里 中的说明,建立基于SharpCamera的 ...

  5. 【转载】C#通过IndexOf方法获取某一列在DataTable中的索引位置

    在C#中的Datatable数据变量的操作过程中,有时候需要知道某一个列名在DataTable中的索引位置信息,此时可以通过DataTable变量的Columns属性来获取到所有的列信息,然后通过Co ...

  6. 92.vue---新手从本地项目开发到服务器线上运行爬坑。

    因为我做的是后台,所以不用做SEO 参考 本项目的定位是后台集成方案,不太适合当基础模板来进行二次开发.因为本项目集成了很多你可能用不到的功能,会造成不少的代码冗余.如果你的项目不关注这方面的问题,也 ...

  7. 87.CSS Flex 弹性盒模型布局教程(共用的css在48篇文章gird)

    CSS Flex 弹性盒模型布局教程 Flex 是 Flexible Box 的缩写,意为"弹性布局",用来为盒状模型提供最大的灵活性. flex布局就是给任何一个容器添加 dis ...

  8. Java 重写 super关键字

    方法名.参数个数和参数类型都相同 举例 class A{ public void num() { System.out.println("A num"); } } class B ...

  9. 安装部署Spark 1.x Standalone模式集群

    Configuration    spark-env.sh        HADOOP_CONF_DIR=/opt/data02/hadoop-2.6.0-cdh5.4.0/etc/hadoop   ...

  10. The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone 。

    The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. 今天有Mys ...