2020-02-04 14:42:19 +01:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import * as React from 'react';
|
2020-03-06 23:15:01 +01:00
|
|
|
import {Image, ScrollView, View} from 'react-native';
|
2020-02-04 14:42:19 +01:00
|
|
|
import ThemeManager from "../utils/ThemeManager";
|
|
|
|
import HTML from "react-native-render-html";
|
|
|
|
import {Linking} from "expo";
|
|
|
|
import PlanningEventManager from '../utils/PlanningEventManager';
|
2020-03-06 23:15:01 +01:00
|
|
|
import {Subheading, Title} from 'react-native-paper';
|
2020-02-04 14:42:19 +01:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
navigation: Object,
|
2020-03-06 09:12:56 +01:00
|
|
|
route: Object
|
2020-02-04 14:42:19 +01:00
|
|
|
};
|
|
|
|
|
2020-02-11 01:05:24 +01:00
|
|
|
function openWebLink(event, link) {
|
2020-02-04 14:42:19 +01:00
|
|
|
Linking.openURL(link).catch((err) => console.error('Error opening link', err));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class defining an about screen. This screen shows the user information about the app and it's author.
|
|
|
|
*/
|
|
|
|
export default class PlanningDisplayScreen extends React.Component<Props> {
|
2020-03-06 09:12:56 +01:00
|
|
|
|
|
|
|
displayData = this.props.route.params['data'];
|
|
|
|
|
2020-02-04 14:42:19 +01:00
|
|
|
render() {
|
2020-02-11 01:05:24 +01:00
|
|
|
// console.log("rendering planningDisplayScreen");
|
2020-02-04 14:42:19 +01:00
|
|
|
return (
|
2020-03-07 11:49:32 +01:00
|
|
|
<ScrollView style={{paddingLeft: 5, paddingRight: 5}}>
|
2020-03-06 23:15:01 +01:00
|
|
|
<Title>
|
|
|
|
{this.displayData.title}
|
|
|
|
</Title>
|
|
|
|
<Subheading style={{marginTop: 10,}}>
|
|
|
|
{PlanningEventManager.getFormattedTime(this.displayData)}
|
|
|
|
</Subheading>
|
|
|
|
{this.displayData.logo !== null ?
|
|
|
|
<View style={{width: '100%', height: 300, marginTop: 20, marginBottom: 20}}>
|
|
|
|
<Image style={{flex: 1, resizeMode: "contain"}}
|
|
|
|
source={{uri: this.displayData.logo}}/>
|
|
|
|
</View>
|
|
|
|
: <View/>}
|
2020-02-04 14:42:19 +01:00
|
|
|
|
2020-03-06 23:15:01 +01:00
|
|
|
{this.displayData.description !== null ?
|
|
|
|
// Surround description with div to allow text styling if the description is not html
|
|
|
|
<HTML html={"<div>" + this.displayData.description + "</div>"}
|
|
|
|
tagsStyles={{
|
|
|
|
p: {
|
|
|
|
color: ThemeManager.getCurrentThemeVariables().text,
|
|
|
|
},
|
|
|
|
div: {color: ThemeManager.getCurrentThemeVariables().text}
|
|
|
|
}}
|
|
|
|
onLinkPress={openWebLink}/>
|
|
|
|
: <View/>}
|
|
|
|
</ScrollView>
|
2020-02-04 14:42:19 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|