Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

♻️ A pull down to refresh control for react native.

NotificationsYou must be signed in to change notification settings

react-native-china/react-native-drop-refresh

 
 

Repository files navigation

A pull down to refresh control for react native.This is a fork version fromShuangzuan/RCTRefreshControl.

Better npm maintainess,issues are welcomed.

NPMNPM

####Update 2.2.0Support react-native 0.40.0, change CMD to ES6 syntax.

####Update 2.1.0Support react-native 0.20.0, solve module name collsion issue.

Screen Shot

Screen Shot

Installation

  1. Runnpm install react-native-drop-refresh --save in your project directory.
  2. Runreact-native link to link the lib up.
  3. Addimport DropRefreshControl from 'react-native-drop-refresh'; to your code.

Usage

importReact,{Component}from'react';importDropRefreshControlfrom'react-native-drop-refresh';import{AppRegistry,ListView,ScrollView,StyleSheet,Text,View}from'react-native';varSCROLLVIEW='ScrollView';varLISTVIEW='ListView';classRCTRefreshControlDemoextendsComponent{constructor(){vards=newListView.DataSource({rowHasChanged:(r1,r2)=>r1!==r2});this.state={dataSource:ds.cloneWithRows(['#484848','#2F9C0A','#05A5D1']),}}componentDidMount(){// ScrollViewDropRefreshControl.configure({node:this.refs[SCROLLVIEW],tintColor:'#05A5D1',activityIndicatorViewColor:'#05A5D1'},()=>{setTimeout(()=>{DropRefreshControl.endRefreshing(this.refs[SCROLLVIEW]);},2000);});// ListViewDropRefreshControl.configure({node:this.refs[LISTVIEW]},()=>{setTimeout(()=>{DropRefreshControl.endRefreshing(this.refs[LISTVIEW]);},2000);});}render(){return(<Viewstyle={styles.container}><ScrollViewref={SCROLLVIEW}style={styles.scrollView}><Viewstyle={{backgroundColor:'#05A5D1',height:200}}/><Viewstyle={{backgroundColor:'#FDF3E7',height:200}}/><Viewstyle={{backgroundColor:'#484848',height:200}}/></ScrollView><ListViewref={LISTVIEW}style={styles.listView}dataSource={this.state.dataSource}renderRow={(rowData)=>{varcolor=rowData;return(<Viewstyle={{backgroundColor:color,height:200}}/>);}}/></View>);}};varstyles=StyleSheet.create({container:{flex:1,flexDirection:'row'}});AppRegistry.registerComponent('DropRefreshControlDemo',()=>DropRefreshControlDemo);// use `export default DropRefreshControlDemo` instead to use this as an component;

License

Available under the MIT license. See the LICENSE file for more informatiion.

About

♻️ A pull down to refresh control for react native.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C72.2%
  • JavaScript27.8%

[8]ページ先頭

©2009-2025 Movatter.jp