From 9207d02c2acd4a9faadb5610dc5eac6431f6e8ca Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Wed, 22 Apr 2020 12:20:55 +0200 Subject: [PATCH] Improved dashboard amicale item --- src/components/Home/ActionsDashboardItem.js | 17 ++++++++++++----- src/screens/Home/HomeScreen.js | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/Home/ActionsDashboardItem.js b/src/components/Home/ActionsDashboardItem.js index 95d9f8c..c8b9a17 100644 --- a/src/components/Home/ActionsDashboardItem.js +++ b/src/components/Home/ActionsDashboardItem.js @@ -11,15 +11,18 @@ const ICON_AMICALE = require("../../../assets/amicale.png"); type Props = { navigation: DrawerNavigationProp, theme: CustomTheme, + isLoggedIn: boolean, } class ActionsDashBoardItem extends React.Component { shouldComponentUpdate(nextProps: Props): boolean { return (nextProps.theme.dark !== this.props.theme.dark) + || (nextProps.isLoggedIn !== this.props.isLoggedIn); } render() { + const isLoggedIn = this.props.isLoggedIn; return ( { }}> } - right={props => } - onPress={() => this.props.navigation.navigate("amicale-home")} + right={props => } + onPress={isLoggedIn + ? () => this.props.navigation.navigate("services") + : () => this.props.navigation.navigate("login")} style={styles.list} /> @@ -55,8 +62,8 @@ const styles = StyleSheet.create({ }, list: { // height: 50, - paddingTop:0, - paddingBottom:0, + paddingTop: 0, + paddingBottom: 0, } }); diff --git a/src/screens/Home/HomeScreen.js b/src/screens/Home/HomeScreen.js index 812bbdd..b87fede 100644 --- a/src/screens/Home/HomeScreen.js +++ b/src/screens/Home/HomeScreen.js @@ -312,7 +312,7 @@ class HomeScreen extends React.Component { } getDashboardActions() { - return ; + return ; } /**