Socket
Socket
Sign inDemoInstall

nuke-refresh-control

Package Overview
Dependencies
Maintainers
2
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuke-refresh-control

下拉刷新组件


Version published
Maintainers
2
Created
Source

RefreshControl

  • category: Components
  • chinese: 含 h5 版本的下拉刷新组件
  • type: 基本

设计思路

RefreshControl 是一个能够实现下拉刷新的子组件,且父组件只能是 <Scrollview><ListView>

// 完整 demo 请参考 ScrollView 组件的 Demo

//初始 state
constructor() {
  super();
  this.state={
    isRefreshing: false,
    refreshText: '↓ 下拉刷新',
    data:[
        //...省略部分代码
    ]
  }
}

handleRefresh =()=>{
  this.setState({
    isRefreshing: true,
    refreshText: '加载中',
  });
  // mock ajax 此处替换为你的 ajax 请求
  setTimeout(() => {
    this.setState({
      isRefreshing: false,
      data: [
          // data 字段变更
      ],
      refreshText: '↓ 下拉刷新',
    });

  }, 1000);
}
render(){
  return(
    <ScrollView>
      <RefreshControl isRefreshing={this.state.isRefreshing} style={{width:750,height:100}} onRefresh={this.handleRefresh}>
          <Text>{this.state.refreshText}</Text>
      </RefreshControl>
      {/* 此处为你的内容区域 */}
    <ScrollView>
  )
}

API

参数说明类型默认值
isRefreshing是否展示false
onRefreshrefresh 事件Function
style样式,必须声明宽高否则可能无法展示object

其他

  • bug、建议联系 @翊晨
  • 钉钉交流群

Keywords

FAQs

Package last updated on 26 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc