Allow laundromat swwitch from header

This commit is contained in:
Arnaud Vergnet 2021-05-12 23:56:44 +02:00
parent 360023aea6
commit 02135d64ff
4 changed files with 25 additions and 7 deletions

View file

@ -41,6 +41,7 @@
"washer": "Washer",
"washers": "Washers",
"updated": "Updated ",
"switch": "Switch laundromat",
"min": "min",
"informationTab": "Information",
"paymentTab": "Payment",

View file

@ -41,6 +41,7 @@
"washer": "Lave-Linge",
"washers": "Lave-Linges",
"updated": "Mise à jour ",
"switch": "Changer de laverie",
"min": "min",
"informationTab": "Informations",
"paymentTab": "Paiement",

View file

@ -1,8 +1,11 @@
import React from 'react';
import { StyleSheet } from 'react-native';
import { Card, Text } from 'react-native-paper';
import { Avatar, Button, Card, Text } from 'react-native-paper';
import TimeAgo from 'react-native-timeago';
import i18n from 'i18n-js';
import { useNavigation } from '@react-navigation/core';
import { MainRoutes } from '../../../navigation/MainNavigator';
import ProxiwashConstants from '../../../constants/ProxiwashConstants';
let moment = require('moment'); //load moment module to set local language
require('moment/locale/fr'); // import moment local language file during the application build
@ -14,14 +17,22 @@ type Props = {
};
const styles = StyleSheet.create({
card: { marginHorizontal: 5 },
card: {
marginHorizontal: 5,
},
actions: {
justifyContent: 'center',
},
});
function ProximoListHeader(props: Props) {
const navigation = useNavigation();
const { date, selectedWash } = props;
let title = i18n.t('screens.proxiwash.washinsa.title');
let icon = ProxiwashConstants.washinsa.icon;
if (selectedWash === 'tripodeB') {
title = i18n.t('screens.proxiwash.tripodeB.title');
icon = ProxiwashConstants.tripodeB.icon;
}
return (
<Card style={styles.card}>
@ -35,7 +46,17 @@ function ProximoListHeader(props: Props) {
</Text>
) : null
}
left={(iconProps) => <Avatar.Icon icon={icon} size={iconProps.size} />}
/>
<Card.Actions style={styles.actions}>
<Button
mode={'contained'}
onPress={() => navigation.navigate(MainRoutes.Settings)}
icon={'swap-horizontal'}
>
{i18n.t('screens.proxiwash.switch')}
</Button>
</Card.Actions>
</Card>
);
}

View file

@ -130,11 +130,6 @@ function ProxiwashScreen() {
navigation.setOptions({
headerRight: () => (
<MaterialHeaderButtons>
<Item
title={'switch'}
iconName={'swap-horizontal'}
onPress={() => navigation.navigate('settings')}
/>
<Item
title={'information'}
iconName={'information'}