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 * as React from 'react';
|
||||||
import WebDataManager from "../utils/WebDataManager";
|
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 CustomHeader from "./CustomHeader";
|
||||||
import {RefreshControl, SectionList, View, TouchableHighlight} from "react-native";
|
import {RefreshControl, SectionList, View} from "react-native";
|
||||||
import CustomMaterialIcon from "./CustomMaterialIcon";
|
import CustomMaterialIcon from "./CustomMaterialIcon";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
@ -42,10 +42,6 @@ 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
|
||||||
*/
|
*/
|
||||||
|
@ -61,7 +57,6 @@ 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]);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -121,7 +116,6 @@ export default class FetchedDataSectionList extends React.Component<Props, State
|
||||||
<Text>{dataset[i].title}</Text>
|
<Text>{dataset[i].title}</Text>
|
||||||
</TabHeading>}
|
</TabHeading>}
|
||||||
key={dataset[i].title}>
|
key={dataset[i].title}>
|
||||||
<Content padder>
|
|
||||||
{this.getSectionList(
|
{this.getSectionList(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
@ -132,7 +126,6 @@ export default class FetchedDataSectionList extends React.Component<Props, State
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
)}
|
)}
|
||||||
</Content>
|
|
||||||
</Tab>);
|
</Tab>);
|
||||||
}
|
}
|
||||||
return tabbedView;
|
return tabbedView;
|
||||||
|
@ -149,9 +142,7 @@ export default class FetchedDataSectionList extends React.Component<Props, State
|
||||||
{this.getTabbedView(dataset)}
|
{this.getTabbedView(dataset)}
|
||||||
</Tabs>
|
</Tabs>
|
||||||
:
|
:
|
||||||
<Content padder>
|
this.getSectionList(dataset)
|
||||||
{this.getSectionList(dataset)}
|
|
||||||
</Content>
|
|
||||||
}
|
}
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
|
|
|
@ -34,8 +34,8 @@ export default class HomeScreen extends FetchedDataSectionList {
|
||||||
return i18n.t("screens.home");
|
return i18n.t("screens.home");
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldShowUpdateToast(): boolean {
|
getUpdateToastTranslations() {
|
||||||
return false;
|
return [i18n.t("homeScreen.listUpdated"), i18n.t("homeScreen.listUpdateFail")];
|
||||||
}
|
}
|
||||||
|
|
||||||
getKeyExtractor(item: Object) {
|
getKeyExtractor(item: Object) {
|
||||||
|
@ -68,7 +68,11 @@ export default class HomeScreen extends FetchedDataSectionList {
|
||||||
|
|
||||||
getRenderItem(item: Object, section: Object, data: Object) {
|
getRenderItem(item: Object, section: Object, data: Object) {
|
||||||
return (
|
return (
|
||||||
<Card style={{flex: 0}}>
|
<Card style={{
|
||||||
|
flex: 0,
|
||||||
|
marginLeft: 10,
|
||||||
|
marginRight: 10
|
||||||
|
}}>
|
||||||
<CardItem>
|
<CardItem>
|
||||||
<Left>
|
<Left>
|
||||||
<Thumbnail source={ICON_AMICALE}/>
|
<Thumbnail source={ICON_AMICALE}/>
|
||||||
|
|
|
@ -286,7 +286,9 @@ export default class ProxiwashScreen extends FetchedDataSectionList {
|
||||||
return (
|
return (
|
||||||
<Card style={{
|
<Card style={{
|
||||||
flex: 0,
|
flex: 0,
|
||||||
height: 64
|
height: 64,
|
||||||
|
marginLeft: 10,
|
||||||
|
marginRight: 10
|
||||||
}}>
|
}}>
|
||||||
|
|
||||||
<CardItem
|
<CardItem
|
||||||
|
|
Loading…
Reference in a new issue