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

View file

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

View file

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