Remove update toast on home, added tab icons for proxiwash

This commit is contained in:
keplyx 2019-07-28 12:56:20 +02:00
parent 5bda2825c5
commit 43d73e9bd6
3 changed files with 20 additions and 4 deletions

View file

@ -5,6 +5,8 @@ import WebDataManager from "../utils/WebDataManager";
import {Container, Content, Tab, TabHeading, Tabs, Text} from "native-base";
import CustomHeader from "./CustomHeader";
import {RefreshControl, SectionList, View} from "react-native";
import i18n from "i18n-js";
import CustomMaterialIcon from "./CustomMaterialIcon";
type Props = {
navigation: Object,
@ -45,6 +47,10 @@ export default class FetchedDataSectionList extends React.Component<Props, State
return ["whoa", "nah"];
}
shouldShowUpdateToast() {
return true;
}
/**
* Refresh the FetchedData on first screen load
*/
@ -60,6 +66,7 @@ export default class FetchedDataSectionList extends React.Component<Props, State
refreshing: false,
firstLoading: false
});
if (this.shouldShowUpdateToast())
this.webDataManager.showUpdateToast(this.getUpdateToastTranslations()[0], this.getUpdateToastTranslations()[1]);
});
};
@ -120,7 +127,14 @@ export default class FetchedDataSectionList extends React.Component<Props, State
let tabbedView = [];
for (let i = 0; i < dataset.length; i++) {
tabbedView.push(
<Tab heading={<TabHeading><Text>{dataset[i].title}</Text></TabHeading>}>
<Tab heading={
<TabHeading>
<CustomMaterialIcon icon={dataset[i].icon}
color={'#fff'}
fontSize={20}
/>
<Text>{dataset[i].title}</Text>
</TabHeading>}>
<Content padder>
{this.getSectionList(
[

View file

@ -29,8 +29,8 @@ export default class HomeScreen extends FetchedDataSectionList {
return i18n.t("screens.home");
}
getUpdateToastTranslations () {
return [i18n.t("homeScreen.listUpdated"),i18n.t("homeScreen.listUpdateFail")];
shouldShowUpdateToast(): boolean {
return false;
}
getKeyExtractor(item : Object) {

View file

@ -193,11 +193,13 @@ export default class ProxiwashScreen extends FetchedDataSectionList {
return [
{
title: i18n.t('proxiwashScreen.dryers'),
icon: 'tumble-dryer',
data: fetchedData.dryers === undefined ? [] : fetchedData.dryers,
extraData: super.state
},
{
title: i18n.t('proxiwashScreen.washers'),
icon: 'washing-machine',
data: fetchedData.washers === undefined ? [] : fetchedData.washers,
extraData: super.state
},