class ErrorHandle extends Component {
static propTypes = {
infoText: PropTypes.string,
onPress: PropTypes.func,
buttonText: PropTypes.string
};
static defaultProps = {
infoText: '网络出错啦, 请点击按钮重新加载',
buttonText: '重新获取'
};
render() {
return (
<View style={styles.container}>
<Text style={styles.infoText}>
{ this.props.infoText }
</Text>
<TouchableOpacity onPress={this.props.onPress}>
<View style={styles.button}>
<Text style={styles.buttonText}>
{ this.props.buttonText }
</Text>
</View>
</TouchableOpacity>
</View>
)
}
}
相关分类