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.

FeedItemScreen.js 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // @flow
  2. import * as React from 'react';
  3. import {ScrollView, View} from 'react-native';
  4. import {Avatar, Card, Text, withTheme} from 'react-native-paper';
  5. import ImageModal from 'react-native-image-modal';
  6. import Autolink from "react-native-autolink";
  7. import MaterialHeaderButtons, {Item} from "../components/Custom/HeaderButton";
  8. import {Linking} from "expo";
  9. import CustomTabBar from "../components/Tabbar/CustomTabBar";
  10. type Props = {
  11. navigation: Object,
  12. route: Object
  13. };
  14. const ICON_AMICALE = require('../../assets/amicale.png');
  15. const NAME_AMICALE = 'Amicale INSA Toulouse';
  16. /**
  17. * Class defining a planning event information page.
  18. */
  19. class FeedItemScreen extends React.Component<Props> {
  20. displayData: Object;
  21. date: string;
  22. colors: Object;
  23. constructor(props) {
  24. super(props);
  25. this.colors = props.theme.colors;
  26. this.displayData = this.props.route.params.data;
  27. this.date = this.props.route.params.date;
  28. }
  29. componentDidMount() {
  30. this.props.navigation.setOptions({
  31. headerRight: this.getHeaderButton,
  32. });
  33. }
  34. onOutLinkPress = () => {
  35. Linking.openURL(this.displayData.permalink_url);
  36. };
  37. getHeaderButton = () => {
  38. return <MaterialHeaderButtons>
  39. <Item title="main" iconName={'facebook'} onPress={this.onOutLinkPress}/>
  40. </MaterialHeaderButtons>;
  41. };
  42. getAvatar() {
  43. return (
  44. <Avatar.Image size={48} source={ICON_AMICALE}
  45. style={{backgroundColor: 'transparent'}}/>
  46. );
  47. }
  48. getContent() {
  49. const hasImage = this.displayData.full_picture !== '' && this.displayData.full_picture !== undefined;
  50. return (
  51. <ScrollView style={{margin: 5,}}>
  52. <Card.Title
  53. title={NAME_AMICALE}
  54. subtitle={this.date}
  55. left={this.getAvatar}
  56. />
  57. {hasImage ?
  58. <View style={{marginLeft: 'auto', marginRight: 'auto'}}>
  59. <ImageModal
  60. resizeMode="contain"
  61. imageBackgroundColor={"#000"}
  62. style={{
  63. width: 250,
  64. height: 250,
  65. }}
  66. source={{
  67. uri: this.displayData.full_picture,
  68. }}
  69. /></View> : null}
  70. <Card.Content style={{paddingBottom: CustomTabBar.TAB_BAR_HEIGHT + 20}}>
  71. {this.displayData.message !== undefined ?
  72. <Autolink
  73. text={this.displayData.message}
  74. hashtag="facebook"
  75. component={Text}
  76. /> : null
  77. }
  78. </Card.Content>
  79. </ScrollView>
  80. );
  81. }
  82. render() {
  83. return this.getContent();
  84. }
  85. }
  86. export default withTheme(FeedItemScreen);