From 356d7c2092f7fe20abec3d217a2a3bb8eae79fc8 Mon Sep 17 00:00:00 2001 From: keplyx Date: Thu, 27 Jun 2019 10:45:16 +0200 Subject: [PATCH] Added wiketud link in drawer --- components/SideMenu.js | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/components/SideMenu.js b/components/SideMenu.js index eecdfb6..a5958e5 100644 --- a/components/SideMenu.js +++ b/components/SideMenu.js @@ -1,5 +1,5 @@ import React from 'react'; -import {Platform, Dimensions, StyleSheet, Image, FlatList} from 'react-native'; +import {Platform, Dimensions, StyleSheet, Image, FlatList, Linking} from 'react-native'; import {Badge, Text, Container, Content, Icon, Left, ListItem, Right} from "native-base"; import i18n from "i18n-js"; @@ -7,6 +7,8 @@ const deviceHeight = Dimensions.get("window").height; const drawerCover = require("../assets/drawer-cover.png"); +const WIKETUD_LINK = "https://www.etud.insa-toulouse.fr/wiketud/index.php/Accueil"; + export default class SideBar extends React.Component { constructor(props) { @@ -43,6 +45,13 @@ export default class SideBar extends React.Component { bg: "#477EEA", // types: "11" }, + { + name: "Wiketud", + route: "", + icon: "web", + bg: "#477EEA", + // types: "11" + }, { name: i18n.t('screens.settings'), route: "Settings", @@ -60,7 +69,7 @@ export default class SideBar extends React.Component { ]; } - navigateToScreen = (route) => () => { + navigateToScreen(route) { this.props.navigation.navigate(route); this.props.navigation.closeDrawer(); this.setState({active: route}); @@ -71,9 +80,9 @@ export default class SideBar extends React.Component { - + { + if (item.name !== 'Wiketud') + this.navigateToScreen(item.route); + else + Linking.openURL(WIKETUD_LINK).catch((err) => console.error('Error opening link', err)); + }} > {item.name} {item.types && - +