Coder Social home page Coder Social logo

msdgwzhy6 / react-native-smartrefreshlayout Goto Github PK

View Code? Open in Web Editor NEW

This project forked from react-native-studio/react-native-smartrefreshlayout

1.0 2.0 0.0 144 KB

基于android SmartRefreshLayout https://github.com/scwang90/SmartRefreshLayout 开发的插件,可提供类似ios的弹性刷新、加载

License: Apache License 2.0

JavaScript 17.67% Java 82.33%

react-native-smartrefreshlayout's Introduction

react-native-SmartRefreshLayoutnpm version

基于android SmartRefreshLayout https://github.com/scwang90/SmartRefreshLayout 开发的插件,可提供类似ios的弹性刷新、加载

第一步

工程目录下运行 npm install --save react-native-smartrefreshlayout 或者 yarn add react-native-smartrefreshlayout(已经安装了yarn)

第二步

运行 react-native link react-native-smartrefreshlayout

第三部使用

在工程中导入:

import {SmartRefreshControl,ClassicsHeader,StoreHouseHeader} from 'react-native-smartrefreshlayout';

//使用方法和RN官方的RefreshControl类似,
<ScrollView 
  refreshControl={<SmartRefreshControl
     ref={this.refreshControl=ref}
     HeaderComponent={<ClassicsHeader/>}
     onRefresh={()=>{
       setTimeout(()=>{
       this.refreshControl && this.refreshControl.finishRefresh();
       },1000)
     }}
  />}
>
</ScrollView>

组件

SmartRefreshControl

属性表格

属性名 类型 描述
onRefresh func 刷新触发
enableRefresh bool 是否启用刷新
HeaderComponent Component refreshcontrol的header

注意:HeaderComponet现在只能是插件提供的Header,后续我们将改进与提供任何Component

方法表格

方法名 参数 描述
finishRefresh {delayed:number,success:bool} 完成刷新

ClassicsHeader

属性表格

属性名 类型 描述
primaryColor string 主题色
accentColor string 强调色

StoreHouseHeader

属性表格

属性名 类型 描述
text string 文字(目前只支持英文)
textColor string 文字颜色
lineWidth number 线宽

示例

图片名称

图片名称

react-native-smartrefreshlayout's People

Contributors

2534290808 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.