|
|
@@ -3,7 +3,7 @@
|
|
|
* @邠心vbe on 2023/02/06
|
|
|
*/
|
|
|
import React, { Component } from 'react'
|
|
|
- import { Image, StyleSheet, Text, View } from 'react-native'
|
|
|
+ import { Image, RefreshControl, ScrollView, StyleSheet, Text, View } from 'react-native'
|
|
|
import Button from '../../components/Button';
|
|
|
import { ChargeStyle, EnterStationDialog, TypeImage } from './Charging';
|
|
|
import apiCharge from '../../api/apiCharge';
|
|
|
@@ -13,6 +13,7 @@
|
|
|
import PagerUtil from './PagerUtil';
|
|
|
import BadgeSelectItem from '../../components/BadgeSelectItem';
|
|
|
import TextView from '../../components/TextView';
|
|
|
+import { MyRefreshProps } from '../../components/ThemesConfig';
|
|
|
|
|
|
export default class TabReserve extends Component {
|
|
|
constructor(props) {
|
|
|
@@ -20,7 +21,7 @@ export default class TabReserve extends Component {
|
|
|
this.state = {
|
|
|
total: 0,
|
|
|
leftId: 0,
|
|
|
- refreshId: 0,
|
|
|
+ refreshing: false,
|
|
|
checkIndex: -1,
|
|
|
available: false,
|
|
|
showReserve: false,
|
|
|
@@ -41,10 +42,18 @@ export default class TabReserve extends Component {
|
|
|
onRefresh() {
|
|
|
console.log("Reserve刷新", this.props.route.name);
|
|
|
this.setState({
|
|
|
+ refreshing: false,
|
|
|
stationInfo: PagerUtil.getStationInfo()
|
|
|
}, () => this.init());
|
|
|
}
|
|
|
|
|
|
+ onPullRefresh() {
|
|
|
+ this.setState({
|
|
|
+ refreshing: true
|
|
|
+ })
|
|
|
+ PagerUtil.setBackRefreshing();
|
|
|
+ }
|
|
|
+
|
|
|
init() {
|
|
|
this.stopCountdown(true);
|
|
|
if (this.state.stationInfo.rateList && this.state.stationInfo.rateList.length > 0) {
|
|
|
@@ -248,21 +257,26 @@ export default class TabReserve extends Component {
|
|
|
|
|
|
render() {
|
|
|
return (
|
|
|
- <View
|
|
|
- style={{
|
|
|
- paddingLeft: 16,
|
|
|
- paddingRight: 16,
|
|
|
- ...this.props.style
|
|
|
- }}>
|
|
|
+ <ScrollView
|
|
|
+ style={ui.flex1}
|
|
|
+ keyboardShouldPersistTaps={'handled'}
|
|
|
+ contentContainerStyle={$padding(0, 16)}
|
|
|
+ refreshControl={
|
|
|
+ <RefreshControl
|
|
|
+ {...MyRefreshProps()}
|
|
|
+ refreshing={this.state.refreshing}
|
|
|
+ onRefresh={() => this.onPullRefresh()}
|
|
|
+ />
|
|
|
+ }>
|
|
|
{ this.state.showReserve
|
|
|
- ? (
|
|
|
- this.state.userReserve.reservePk
|
|
|
- ? this.countdownView()
|
|
|
- : this.reserveView()
|
|
|
- )
|
|
|
- : <View style={[{height: $vh(50)}, ui.flexvc]}>
|
|
|
- <TextView style={{color: textPrimary, fontSize: 14}}>{$t('charging.unallowReservation')}</TextView>
|
|
|
- </View>
|
|
|
+ ? (
|
|
|
+ this.state.userReserve.reservePk
|
|
|
+ ? this.countdownView()
|
|
|
+ : this.reserveView()
|
|
|
+ )
|
|
|
+ : <View style={[{height: $vh(50)}, ui.flexvc]}>
|
|
|
+ <TextView style={{color: textPrimary, fontSize: 14}}>{$t('charging.unallowReservation')}</TextView>
|
|
|
+ </View>
|
|
|
}
|
|
|
<CancelReserveDialog
|
|
|
visible={this.state.showCancelDialog}
|
|
|
@@ -284,7 +298,7 @@ export default class TabReserve extends Component {
|
|
|
});
|
|
|
}}
|
|
|
/>
|
|
|
- </View>
|
|
|
+ </ScrollView>
|
|
|
);
|
|
|
}
|
|
|
|