Improved dashboard amicale item
This commit is contained in:
parent
b31269586b
commit
9207d02c2a
2 changed files with 13 additions and 6 deletions
|
@ -11,15 +11,18 @@ const ICON_AMICALE = require("../../../assets/amicale.png");
|
||||||
type Props = {
|
type Props = {
|
||||||
navigation: DrawerNavigationProp,
|
navigation: DrawerNavigationProp,
|
||||||
theme: CustomTheme,
|
theme: CustomTheme,
|
||||||
|
isLoggedIn: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
class ActionsDashBoardItem extends React.Component<Props> {
|
class ActionsDashBoardItem extends React.Component<Props> {
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps: Props): boolean {
|
shouldComponentUpdate(nextProps: Props): boolean {
|
||||||
return (nextProps.theme.dark !== this.props.theme.dark)
|
return (nextProps.theme.dark !== this.props.theme.dark)
|
||||||
|
|| (nextProps.isLoggedIn !== this.props.isLoggedIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const isLoggedIn = this.props.isLoggedIn;
|
||||||
return (
|
return (
|
||||||
<Card style={{
|
<Card style={{
|
||||||
...styles.card,
|
...styles.card,
|
||||||
|
@ -27,14 +30,18 @@ class ActionsDashBoardItem extends React.Component<Props> {
|
||||||
}}>
|
}}>
|
||||||
<List.Item
|
<List.Item
|
||||||
title={"AMICALE"}
|
title={"AMICALE"}
|
||||||
description={"VOTRE COMPTE"}
|
description={isLoggedIn ? "VOTRE ESPACE" : "SE CONNECTER"}
|
||||||
left={props => <Avatar.Image
|
left={props => <Avatar.Image
|
||||||
{...props}
|
{...props}
|
||||||
size={40}
|
size={40}
|
||||||
source={ICON_AMICALE}
|
source={ICON_AMICALE}
|
||||||
style={styles.avatar}/>}
|
style={styles.avatar}/>}
|
||||||
right={props => <List.Icon {...props} icon="chevron-right"/>}
|
right={props => <List.Icon {...props} icon={isLoggedIn
|
||||||
onPress={() => this.props.navigation.navigate("amicale-home")}
|
? "chevron-right"
|
||||||
|
: "login"}/>}
|
||||||
|
onPress={isLoggedIn
|
||||||
|
? () => this.props.navigation.navigate("services")
|
||||||
|
: () => this.props.navigation.navigate("login")}
|
||||||
style={styles.list}
|
style={styles.list}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
|
@ -55,8 +62,8 @@ const styles = StyleSheet.create({
|
||||||
},
|
},
|
||||||
list: {
|
list: {
|
||||||
// height: 50,
|
// height: 50,
|
||||||
paddingTop:0,
|
paddingTop: 0,
|
||||||
paddingBottom:0,
|
paddingBottom: 0,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@ class HomeScreen extends React.Component<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
getDashboardActions() {
|
getDashboardActions() {
|
||||||
return <ActionsDashBoardItem {...this.props}/>;
|
return <ActionsDashBoardItem {...this.props} isLoggedIn={this.isLoggedIn}/>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue