react-native-1app
Version:
35 lines (29 loc) • 716 B
JavaScript
import React, { Component } from 'react';
import {
StyleSheet,
View,RefreshControl,
ActivityIndicator,
} from 'react-native';
export default class ApiRefreshControl extends Component {
constructor(props) {
super(props);
this.state = { create:true ,refreshing :false};
}
componentDidMount() {
setTimeout( () =>{
this.setState({refreshing: this.props.refreshing});
}, 10);
}
shouldComponentUpdate(nextProps, nextState) {
if(nextProps!= this.props){
nextState.refreshing = nextProps.refreshing;
}
return true;
}
render() {
return (
<RefreshControl {...this.props} refreshing={this.state.refreshing?true:false} />
);
}
}
;