// @flow 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, Chip, Paragraph, withTheme} from 'react-native-paper'; import ImageModal from 'react-native-image-modal'; import i18n from "i18n-js"; import AuthenticatedScreen from "../../../components/Amicale/AuthenticatedScreen"; type Props = { navigation: Object, route: Object }; type State = { imageModalVisible: boolean, }; function openWebLink(event, link) { Linking.openURL(link).catch((err) => console.error('Error opening link', err)); } const FakeClub = { "category": [ 3, 6, ], "description": "

Les 100 Tours de l’INSA reviennent en force pour une cinquième édition les 5 et 6 juin prochain !


Prépare-toi pour le plus gros évènement de l’année sur le campus de notre belle école qui nous réunit tous autour d’activités folles pour fêter la fin de l’année dans la bonne humeur !

L’éco-festival tournera autour d’une grande course par équipe qui nous vaut ce doux nom de 100 tours. Ce sera le moment de défier tes potes pour tenter de remporter de nombreux lots, et surtout l’admiration de tous. Mais cela ne s’arrête pas là, puisque tu pourras aussi participer à des activités à sensation, divers ateliers, et de quoi chiller avec tes potes en écoutant de la bonne musique. Tu pourras ensuite enchaîner sur LA soirée de l’année, rythmée par des artistes sur-motivés !


Tu es bien entendu le bienvenu si l’envie te prend de rejoindre l’équipe et de nous aider à organiser cet évènement du turfu !


La team 100 Tours


Contact : 100tours@amicale-insat.fr

Facebook : Les 100 Tours de l’INSA

Instagram : 100tours.insatoulouse

", "id": 110, "logo": "https://www.amicale-insat.fr/storage/clubLogos/2cca8885dd3bdf902124f038b548962b.jpeg", "name": "100 Tours", "responsibles": [ "Juliette Duval", "Emilie Cuminal", "Maxime Doré", ], }; /** * Class defining a planning event information page. * If called with data and categories navigation parameters, will use those to display the data. * If called with clubId parameter, will fetch the information on the server */ class ClubDisplayScreen extends React.Component { displayData: Object; categories: Object | null; clubId: number; shouldFetchData: boolean; colors: Object; state = { imageModalVisible: false, }; constructor(props) { super(props); this.colors = props.theme.colors; if (this.props.route.params.data !== undefined && this.props.route.params.categories !== undefined) { this.displayData = this.props.route.params.data; this.categories = this.props.route.params.categories; this.clubId = this.props.route.params.data.id; this.shouldFetchData = false; } else { this.displayData = {}; this.categories = null; this.clubId = this.props.route.params.clubId; this.shouldFetchData = true; console.log(this.clubId); } } componentDidMount(): * { this.props.navigation.setOptions({title: this.displayData.name}) } getCategoryName(id: number) { if (this.categories !== null) { for (let i = 0; i < this.categories.length; i++) { if (id === this.categories[i].id) return this.categories[i].name; } } return ""; } getCategoriesRender(categories: Array) { if (this.categories === null) return null; let final = []; for (let i = 0; i < categories.length; i++) { let cat = categories[i]; if (cat !== null) { final.push( {this.getCategoryName(cat)} ); } } return {final}; } getManagersRender(resp: Array) { let final = []; for (let i = 0; i < resp.length; i++) { final.push({resp[i]}) } const hasManagers = resp.length > 0; return ( } /> {final} ); } getScreen = (data: Object) => { data = FakeClub; return ( {this.getCategoriesRender(data.category)} {data.logo !== null ? : } {data.description !== null ? // Surround description with div to allow text styling if the description is not html " + data.description + ""} tagsStyles={{ p: {color: this.colors.text,}, div: {color: this.colors.text} }} onLinkPress={openWebLink}/> : } {this.getManagersRender(data.responsibles)} ); }; render() { if (this.shouldFetchData) return ; else return this.getScreen(this.displayData); } } export default withTheme(ClubDisplayScreen);