Application Android et IOS pour l'amicale des élèves https://play.google.com/store/apps/details?id=fr.amicaleinsat.application
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PlanningDisplayScreen.js 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // @flow
  2. import * as React from 'react';
  3. import {Image, ScrollView, View} from 'react-native';
  4. import HTML from "react-native-render-html";
  5. import {Linking} from "expo";
  6. import PlanningEventManager from '../../utils/PlanningEventManager';
  7. import {Card, withTheme} from 'react-native-paper';
  8. import DateManager from "../../utils/DateManager";
  9. type Props = {
  10. navigation: Object,
  11. route: Object
  12. };
  13. function openWebLink(event, link) {
  14. Linking.openURL(link).catch((err) => console.error('Error opening link', err));
  15. }
  16. /**
  17. * Class defining an about screen. This screen shows the user information about the app and it's author.
  18. */
  19. class PlanningDisplayScreen extends React.Component<Props> {
  20. displayData = this.props.route.params['data'];
  21. colors: Object;
  22. constructor(props) {
  23. super(props);
  24. this.colors = props.theme.colors;
  25. }
  26. render() {
  27. // console.log("rendering planningDisplayScreen");
  28. return (
  29. <ScrollView style={{paddingLeft: 5, paddingRight: 5}}>
  30. <Card.Title
  31. title={this.displayData.title}
  32. subtitle={
  33. PlanningEventManager.getFormattedEventTime(this.displayData["date_begin"], this.displayData["date_end"])
  34. + ' | '
  35. + DateManager.getInstance().getTranslatedDate(PlanningEventManager.getDateOnlyString(this.displayData["date_begin"]))}
  36. />
  37. {this.displayData.logo !== null ?
  38. <View style={{width: '100%', height: 300}}>
  39. <Image style={{flex: 1, resizeMode: "contain"}}
  40. source={{uri: this.displayData.logo}}/>
  41. </View>
  42. : <View/>}
  43. {this.displayData.description !== null ?
  44. // Surround description with div to allow text styling if the description is not html
  45. <Card.Content>
  46. <HTML html={"<div>" + this.displayData.description + "</div>"}
  47. tagsStyles={{
  48. p: {color: this.colors.text,},
  49. div: {color: this.colors.text}
  50. }}
  51. onLinkPress={openWebLink}/>
  52. </Card.Content>
  53. : <View/>}
  54. </ScrollView>
  55. );
  56. }
  57. }
  58. export default withTheme(PlanningDisplayScreen);