Added wiketud link in drawer

This commit is contained in:
keplyx 2019-06-27 10:45:16 +02:00
parent 893eca287e
commit 356d7c2092

View file

@ -1,5 +1,5 @@
import React from 'react'; 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 {Badge, Text, Container, Content, Icon, Left, ListItem, Right} from "native-base";
import i18n from "i18n-js"; import i18n from "i18n-js";
@ -7,6 +7,8 @@ const deviceHeight = Dimensions.get("window").height;
const drawerCover = require("../assets/drawer-cover.png"); 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 { export default class SideBar extends React.Component {
constructor(props) { constructor(props) {
@ -43,6 +45,13 @@ export default class SideBar extends React.Component {
bg: "#477EEA", bg: "#477EEA",
// types: "11" // types: "11"
}, },
{
name: "Wiketud",
route: "",
icon: "web",
bg: "#477EEA",
// types: "11"
},
{ {
name: i18n.t('screens.settings'), name: i18n.t('screens.settings'),
route: "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.navigate(route);
this.props.navigation.closeDrawer(); this.props.navigation.closeDrawer();
this.setState({active: route}); this.setState({active: route});
@ -82,11 +91,14 @@ export default class SideBar extends React.Component {
renderItem={({item}) => renderItem={({item}) =>
<ListItem <ListItem
button button
noBorder={item.route !== 'Proximo'} // Display a separator before settings noBorder={item.name !== 'Wiketud'} // Display a separator before settings
selected={this.state.active === item.route} selected={this.state.active === item.route}
onPress={ onPress={() => {
this.navigateToScreen(item.route) if (item.name !== 'Wiketud')
} this.navigateToScreen(item.route);
else
Linking.openURL(WIKETUD_LINK).catch((err) => console.error('Error opening link', err));
}}
> >
<Left> <Left>
<Icon <Icon