diff --git a/screens/Amicale/ClubDisplayScreen.js b/screens/Amicale/ClubDisplayScreen.js index 65328a6..e15a821 100644 --- a/screens/Amicale/ClubDisplayScreen.js +++ b/screens/Amicale/ClubDisplayScreen.js @@ -4,7 +4,7 @@ import * as React from 'react'; import {ScrollView, View} from 'react-native'; import HTML from "react-native-render-html"; import {Linking} from "expo"; -import {Avatar, Card, Paragraph, withTheme} from 'react-native-paper'; +import {Avatar, Card, Chip, Paragraph, withTheme} from 'react-native-paper'; import ImageModal from 'react-native-image-modal'; type Props = { @@ -26,6 +26,7 @@ function openWebLink(event, link) { class ClubDisplayScreen extends React.Component { displayData = this.props.route.params['data']; + categories = this.props.route.params['categories']; colors: Object; @@ -42,6 +43,23 @@ class ClubDisplayScreen extends React.Component { this.props.navigation.setOptions({title: this.displayData.name}) } + getCategoryName(id: number) { + for (let i = 0; i < this.categories.length; i++) { + if (id === this.categories[i].id) + return this.categories[i].name; + } + return ""; + } + + getCategoriesRender(categories: Array) { + let final = []; + for (let i = 0; i < categories.length; i++) { + if (categories[i] !== null) + final.push({this.getCategoryName(categories[i])}); + } + return {final}; + } + getResponsiblesRender(resp: Array) { let final = []; for (let i = 0; i < resp.length; i++) { @@ -67,8 +85,14 @@ class ClubDisplayScreen extends React.Component { render() { return ( + {this.getCategoriesRender(this.displayData.category)} {this.displayData.logo !== null ? - + { * @param item The article pressed */ onListItemPress(item: Object) { - this.props.navigation.navigate("ClubDisplayScreen", {data: item}); + this.props.navigation.navigate("ClubDisplayScreen", {data: item, categories: this.categories}); } render() {