forked fromShuangzuan/RCTRefreshControl
- Notifications
You must be signed in to change notification settings - Fork5
react-native-china/react-native-drop-refresh
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
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.
####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.
- Run
npm install react-native-drop-refresh --savein your project directory. - Run
react-native linkto link the lib up. - Add
import DropRefreshControl from 'react-native-drop-refresh';to your code.
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;
Available under the MIT license. See the LICENSE file for more informatiion.
About
♻️ A pull down to refresh control for react native.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Languages
- Objective-C72.2%
- JavaScript27.8%


