React Native Pull To Refresh Component for ios platform support ScrollView,ListView
##How to use
#####Download from npm
npm install --save react-native-pullrefresh-scrollview
#####Use in Scrollview
import PullRefreshScrollView from 'react-native-pullrefresh-scrollview';
render() {
return (
<PullRefreshScrollView ref="PullRefresh" onRefresh={()=>this.onRefresh()}>
<View><Text>Scroll1</Text></View>
</PullRefreshScrollView>
);
}
#####Use in Listview
import PullRefreshScrollView from 'react-native-pullrefresh-scrollview';
render() {
return (
<ListView
renderScrollComponent={(props) => <PullRefreshScrollView onRefresh={(PullRefresh)=>this.onRefresh(PullRefresh)} {...props} />}
dataSource={this.state.dataSource}
renderRow={(rowData) => <Text>{rowData}</Text>}
/>
);
}
#####Only text #####Only image #####props
onRefresh: refreshedText: '' refreshingText: '' refreshText:'' indicatorArrowImg: { // default arrow.png style:{}, url:'' } indicatorImg: { // default style:{}, url:'' } refreshType:'normal' // normal image text
#####Regain the PullRefresh
onRefresh(PullRefresh){
PullRefresh.onRefreshEnd();
}
##Advice mail:[email protected]
React Native下拉刷新组件 ios 平台 支持ScrollView,ListView
##如何引入
#####从npm上下载组件
npm install --save react-native-pullrefresh-scrollview
#####在ScrollView中使用
import PullRefreshScrollView from 'react-native-pullrefresh-scrollview';
render() {
return (
<PullRefreshScrollView ref="PullRefresh" onRefresh={()=>this.onRefresh()}>
<View><Text>Scroll1</Text></View>
</PullRefreshScrollView>
);
}
#####在ListView中使用
import PullRefreshScrollView from 'react-native-pullrefresh-scrollview';
render() {
return (
<ListView
renderScrollComponent={(props) => <PullRefreshScrollView onRefresh={(PullRefresh)=>this.onRefresh(PullRefresh)} {...props} />}
dataSource={this.state.dataSource}
renderRow={(rowData) => <Text>{rowData}</Text>}
/>
);
}
onRefresh:当触发刷新时的回调 refreshedText: '释放立即刷新' refreshingText: '正在刷新数据中..' refreshText:'下拉可以刷新' indicatorArrowImg: { // 下拉箭头图片和样式 default arrow.png style:{}, url:'' } indicatorImg: { // loading图片和样式 default style:{}, url:'' } refreshType:'normal' // normal image text
#####收回下拉刷新
onRefresh(PullRefresh){
PullRefresh.onRefreshEnd();
}
##建议和反馈 此组件还在不断更新中,如有需求欢迎提出反馈[email protected]