forked from vergnet/application-amicale
Added wiketud link in drawer
This commit is contained in:
parent
893eca287e
commit
356d7c2092
1 changed files with 22 additions and 10 deletions
|
@ -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});
|
||||
|
@ -82,11 +91,14 @@ export default class SideBar extends React.Component {
|
|||
renderItem={({item}) =>
|
||||
<ListItem
|
||||
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}
|
||||
onPress={
|
||||
this.navigateToScreen(item.route)
|
||||
}
|
||||
onPress={() => {
|
||||
if (item.name !== 'Wiketud')
|
||||
this.navigateToScreen(item.route);
|
||||
else
|
||||
Linking.openURL(WIKETUD_LINK).catch((err) => console.error('Error opening link', err));
|
||||
}}
|
||||
>
|
||||
<Left>
|
||||
<Icon
|
||||
|
|
Loading…
Reference in a new issue