|
@@ -11,15 +11,18 @@ const ICON_AMICALE = require("../../../assets/amicale.png");
|
11
|
11
|
type Props = {
|
12
|
12
|
navigation: DrawerNavigationProp,
|
13
|
13
|
theme: CustomTheme,
|
|
14
|
+ isLoggedIn: boolean,
|
14
|
15
|
}
|
15
|
16
|
|
16
|
17
|
class ActionsDashBoardItem extends React.Component<Props> {
|
17
|
18
|
|
18
|
19
|
shouldComponentUpdate(nextProps: Props): boolean {
|
19
|
20
|
return (nextProps.theme.dark !== this.props.theme.dark)
|
|
21
|
+ || (nextProps.isLoggedIn !== this.props.isLoggedIn);
|
20
|
22
|
}
|
21
|
23
|
|
22
|
24
|
render() {
|
|
25
|
+ const isLoggedIn = this.props.isLoggedIn;
|
23
|
26
|
return (
|
24
|
27
|
<Card style={{
|
25
|
28
|
...styles.card,
|
|
@@ -27,14 +30,18 @@ class ActionsDashBoardItem extends React.Component<Props> {
|
27
|
30
|
}}>
|
28
|
31
|
<List.Item
|
29
|
32
|
title={"AMICALE"}
|
30
|
|
- description={"VOTRE COMPTE"}
|
|
33
|
+ description={isLoggedIn ? "VOTRE ESPACE" : "SE CONNECTER"}
|
31
|
34
|
left={props => <Avatar.Image
|
32
|
35
|
{...props}
|
33
|
36
|
size={40}
|
34
|
37
|
source={ICON_AMICALE}
|
35
|
38
|
style={styles.avatar}/>}
|
36
|
|
- right={props => <List.Icon {...props} icon="chevron-right"/>}
|
37
|
|
- onPress={() => this.props.navigation.navigate("amicale-home")}
|
|
39
|
+ right={props => <List.Icon {...props} icon={isLoggedIn
|
|
40
|
+ ? "chevron-right"
|
|
41
|
+ : "login"}/>}
|
|
42
|
+ onPress={isLoggedIn
|
|
43
|
+ ? () => this.props.navigation.navigate("services")
|
|
44
|
+ : () => this.props.navigation.navigate("login")}
|
38
|
45
|
style={styles.list}
|
39
|
46
|
/>
|
40
|
47
|
</Card>
|
|
@@ -55,8 +62,8 @@ const styles = StyleSheet.create({
|
55
|
62
|
},
|
56
|
63
|
list: {
|
57
|
64
|
// height: 50,
|
58
|
|
- paddingTop:0,
|
59
|
|
- paddingBottom:0,
|
|
65
|
+ paddingTop: 0,
|
|
66
|
+ paddingBottom: 0,
|
60
|
67
|
}
|
61
|
68
|
});
|
62
|
69
|
|