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});
@ -71,9 +80,9 @@ export default class SideBar extends React.Component {
<Container> <Container>
<Content <Content
bounces={false} bounces={false}
style={{ flex: 1, top: -1 }} style={{flex: 1, top: -1}}
> >
<Image source={drawerCover} style={styles.drawerCover} /> <Image source={drawerCover} style={styles.drawerCover}/>
<FlatList <FlatList
data={this.dataSet} data={this.dataSet}
@ -82,25 +91,28 @@ 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
active active
name={item.icon} name={item.icon}
type={'MaterialCommunityIcons'} type={'MaterialCommunityIcons'}
style={{ color: "#777", fontSize: 26, width: 30 }} style={{color: "#777", fontSize: 26, width: 30}}
/> />
<Text style={styles.text}> <Text style={styles.text}>
{item.name} {item.name}
</Text> </Text>
</Left> </Left>
{item.types && {item.types &&
<Right style={{ flex: 1 }}> <Right style={{flex: 1}}>
<Badge <Badge
style={{ style={{
borderRadius: 3, borderRadius: 3,