Fixed refresh control not working + added back home list update toast

This commit is contained in:
keplyx 2019-07-31 14:34:38 +02:00
parent 0cbf60e6cc
commit bba237abe1
3 changed files with 26 additions and 29 deletions

View file

@ -2,9 +2,9 @@
import * as React from 'react';
import WebDataManager from "../utils/WebDataManager";
import {Container, Content, Tab, TabHeading, Tabs, Text} from "native-base";
import {Container, Tab, TabHeading, Tabs, Text} from "native-base";
import CustomHeader from "./CustomHeader";
import {RefreshControl, SectionList, View, TouchableHighlight} from "react-native";
import {RefreshControl, SectionList, View} from "react-native";
import CustomMaterialIcon from "./CustomMaterialIcon";
type Props = {
@ -42,10 +42,6 @@ export default class FetchedDataSectionList extends React.Component<Props, State
return ["whoa", "nah"];
}
shouldShowUpdateToast() {
return true;
}
/**
* Refresh the FetchedData on first screen load
*/
@ -61,7 +57,6 @@ 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]);
});
};
@ -121,7 +116,6 @@ export default class FetchedDataSectionList extends React.Component<Props, State
<Text>{dataset[i].title}</Text>
</TabHeading>}
key={dataset[i].title}>
<Content padder>
{this.getSectionList(
[
{
@ -132,7 +126,6 @@ export default class FetchedDataSectionList extends React.Component<Props, State
}
]
)}
</Content>
</Tab>);
}
return tabbedView;
@ -149,9 +142,7 @@ export default class FetchedDataSectionList extends React.Component<Props, State
{this.getTabbedView(dataset)}
</Tabs>
:
<Content padder>
{this.getSectionList(dataset)}
</Content>
this.getSectionList(dataset)
}
</Container>
);

View file

@ -34,8 +34,8 @@ export default class HomeScreen extends FetchedDataSectionList {
return i18n.t("screens.home");
}
shouldShowUpdateToast(): boolean {
return false;
getUpdateToastTranslations() {
return [i18n.t("homeScreen.listUpdated"), i18n.t("homeScreen.listUpdateFail")];
}
getKeyExtractor(item: Object) {
@ -68,7 +68,11 @@ export default class HomeScreen extends FetchedDataSectionList {
getRenderItem(item: Object, section: Object, data: Object) {
return (
<Card style={{flex: 0}}>
<Card style={{
flex: 0,
marginLeft: 10,
marginRight: 10
}}>
<CardItem>
<Left>
<Thumbnail source={ICON_AMICALE}/>

View file

@ -286,7 +286,9 @@ export default class ProxiwashScreen extends FetchedDataSectionList {
return (
<Card style={{
flex: 0,
height: 64
height: 64,
marginLeft: 10,
marginRight: 10
}}>
<CardItem