|
@@ -59,6 +59,7 @@ import {
|
59
|
59
|
ProxiwashPreferenceKeys,
|
60
|
60
|
} from '../../utils/asyncStorage';
|
61
|
61
|
import { useProxiwashPreferences } from '../../context/preferencesContext';
|
|
62
|
+import { useSubsequentEffect } from '../../utils/customHooks';
|
62
|
63
|
|
63
|
64
|
const REFRESH_TIME = 1000 * 10; // Refresh every 10 seconds
|
64
|
65
|
const LIST_ITEM_HEIGHT = 64;
|
|
@@ -106,6 +107,7 @@ function ProxiwashScreen() {
|
106
|
107
|
ProxiwashPreferenceKeys.proxiwashNotifications,
|
107
|
108
|
preferences
|
108
|
109
|
);
|
|
110
|
+ const [refresh, setRefresh] = useState(false);
|
109
|
111
|
|
110
|
112
|
const getMachinesWatched = () => {
|
111
|
113
|
const data = getPreferenceObject(
|
|
@@ -130,6 +132,11 @@ function ProxiwashScreen() {
|
130
|
132
|
const machinesWatched: Array<ProxiwashMachineType> = getMachinesWatched();
|
131
|
133
|
const selectedWash: 'washinsa' | 'tripodeB' = getSelectedWash();
|
132
|
134
|
|
|
135
|
+ useSubsequentEffect(() => {
|
|
136
|
+ // Refresh the list when the selected wash changes
|
|
137
|
+ setRefresh(true);
|
|
138
|
+ }, [selectedWash]);
|
|
139
|
+
|
133
|
140
|
const modalStateStrings: { [key in MachineStates]: string } = {
|
134
|
141
|
[MachineStates.AVAILABLE]: i18n.t('screens.proxiwash.modal.ready'),
|
135
|
142
|
[MachineStates.RUNNING]: i18n.t('screens.proxiwash.modal.running'),
|
|
@@ -446,6 +453,7 @@ function ProxiwashScreen() {
|
446
|
453
|
default:
|
447
|
454
|
data = ProxiwashConstants.washinsa;
|
448
|
455
|
}
|
|
456
|
+
|
449
|
457
|
return (
|
450
|
458
|
<View style={GENERAL_STYLES.flex}>
|
451
|
459
|
<View style={styles.container}>
|
|
@@ -458,6 +466,8 @@ function ProxiwashScreen() {
|
458
|
466
|
refreshOnFocus={true}
|
459
|
467
|
extraData={machinesWatched.length}
|
460
|
468
|
renderListHeaderComponent={renderListHeaderComponent}
|
|
469
|
+ refresh={refresh}
|
|
470
|
+ onFinish={() => setRefresh(false)}
|
461
|
471
|
/>
|
462
|
472
|
</View>
|
463
|
473
|
<MascotPopup
|