// @flow import * as React from 'react'; import {Image, ScrollView, View} from 'react-native'; import HTML from "react-native-render-html"; import {Linking} from "expo"; import {getDateOnlyString, getFormattedEventTime} from '../../utils/Planning'; import {Card, withTheme} from 'react-native-paper'; import DateManager from "../../managers/DateManager"; type Props = { navigation: Object, route: Object }; function openWebLink(event, link) { Linking.openURL(link).catch((err) => console.error('Error opening link', err)); } /** * Class defining a planning event information page. */ class PlanningDisplayScreen extends React.Component { displayData = this.props.route.params['data']; colors: Object; constructor(props) { super(props); this.colors = props.theme.colors; } render() { // console.log("rendering planningDisplayScreen"); let subtitle = getFormattedEventTime( this.displayData["date_begin"], this.displayData["date_end"]); let dateString = getDateOnlyString(this.displayData["date_begin"]); if (dateString !== null) subtitle += ' | ' + DateManager.getInstance().getTranslatedDate(dateString); return ( {this.displayData.logo !== null ? : } {this.displayData.description !== null ? // Surround description with div to allow text styling if the description is not html " + this.displayData.description + ""} tagsStyles={{ p: {color: this.colors.text,}, div: {color: this.colors.text} }} onLinkPress={openWebLink}/> : } ); } } export default withTheme(PlanningDisplayScreen);