forked from vergnet/application-amicale
Fixed refresh control not working + added back home list update toast
This commit is contained in:
parent
0cbf60e6cc
commit
bba237abe1
3 changed files with 26 additions and 29 deletions
|
@ -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,8 +57,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]);
|
||||
this.webDataManager.showUpdateToast(this.getUpdateToastTranslations()[0], this.getUpdateToastTranslations()[1]);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -111,7 +106,7 @@ export default class FetchedDataSectionList extends React.Component<Props, State
|
|||
getTabbedView(dataset: Array<Object>) {
|
||||
let tabbedView = [];
|
||||
for (let i = 0; i < dataset.length; i++) {
|
||||
tabbedView.push(
|
||||
tabbedView.push(
|
||||
<Tab heading={
|
||||
<TabHeading>
|
||||
<CustomMaterialIcon icon={dataset[i].icon}
|
||||
|
@ -120,19 +115,17 @@ export default class FetchedDataSectionList extends React.Component<Props, State
|
|||
/>
|
||||
<Text>{dataset[i].title}</Text>
|
||||
</TabHeading>}
|
||||
key={dataset[i].title}>
|
||||
<Content padder>
|
||||
{this.getSectionList(
|
||||
[
|
||||
{
|
||||
title: dataset[i].title,
|
||||
data: dataset[i].data,
|
||||
extraData: dataset[i].extraData,
|
||||
keyExtractor: dataset[i].keyExtractor
|
||||
}
|
||||
]
|
||||
)}
|
||||
</Content>
|
||||
key={dataset[i].title}>
|
||||
{this.getSectionList(
|
||||
[
|
||||
{
|
||||
title: dataset[i].title,
|
||||
data: dataset[i].data,
|
||||
extraData: dataset[i].extraData,
|
||||
keyExtractor: dataset[i].keyExtractor
|
||||
}
|
||||
]
|
||||
)}
|
||||
</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>
|
||||
);
|
||||
|
|
|
@ -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}/>
|
||||
|
|
|
@ -286,7 +286,9 @@ export default class ProxiwashScreen extends FetchedDataSectionList {
|
|||
return (
|
||||
<Card style={{
|
||||
flex: 0,
|
||||
height: 64
|
||||
height: 64,
|
||||
marginLeft: 10,
|
||||
marginRight: 10
|
||||
}}>
|
||||
|
||||
<CardItem
|
||||
|
|
Loading…
Reference in a new issue