2020-03-07 11:49:32 +01:00
|
|
|
import * as React from 'react';
|
|
|
|
import {Avatar, Button, Card, withTheme} from 'react-native-paper';
|
|
|
|
import {TouchableOpacity, View} from "react-native";
|
|
|
|
import Autolink from "react-native-autolink";
|
|
|
|
import i18n from "i18n-js";
|
|
|
|
|
2020-04-02 15:33:12 +02:00
|
|
|
|
2020-04-02 10:07:20 +02:00
|
|
|
const ICON_AMICALE = require('../../assets/amicale.png');
|
2020-03-07 11:49:32 +01:00
|
|
|
|
2020-03-29 14:46:44 +02:00
|
|
|
/**
|
|
|
|
* Gets the amicale INSAT logo
|
|
|
|
*
|
|
|
|
* @return {*}
|
|
|
|
*/
|
2020-03-08 14:43:02 +01:00
|
|
|
function getAvatar() {
|
|
|
|
return (
|
|
|
|
<Avatar.Image size={48} source={ICON_AMICALE}
|
|
|
|
style={{backgroundColor: 'transparent'}}/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-03-29 14:46:44 +02:00
|
|
|
/**
|
|
|
|
* Component used to display a feed item
|
|
|
|
*
|
|
|
|
* @param props Props to pass to the component
|
|
|
|
* @return {*}
|
|
|
|
*/
|
2020-03-07 11:49:32 +01:00
|
|
|
function FeedItem(props) {
|
|
|
|
const {colors} = props.theme;
|
|
|
|
return (
|
2020-03-08 11:27:05 +01:00
|
|
|
<Card style={{margin: 10}}>
|
2020-03-07 11:49:32 +01:00
|
|
|
<Card.Title
|
|
|
|
title={props.title}
|
|
|
|
subtitle={props.subtitle}
|
2020-03-08 14:43:02 +01:00
|
|
|
left={getAvatar}
|
2020-03-07 11:49:32 +01:00
|
|
|
/>
|
|
|
|
{props.full_picture !== '' && props.full_picture !== undefined ?
|
|
|
|
<TouchableOpacity onPress={props.onImagePress}>
|
|
|
|
<Card.Cover source={{uri: props.full_picture}}/>
|
|
|
|
</TouchableOpacity> : <View/>}
|
|
|
|
<Card.Content>
|
|
|
|
{props.message !== undefined ?
|
|
|
|
<Autolink
|
|
|
|
text={props.message}
|
|
|
|
hashtag="facebook"
|
|
|
|
style={{color: colors.text}}
|
|
|
|
/> : <View/>
|
|
|
|
}
|
|
|
|
</Card.Content>
|
|
|
|
<Card.Actions>
|
|
|
|
<Button
|
|
|
|
color={'#57aeff'}
|
|
|
|
onPress={props.onOutLinkPress}
|
2020-03-29 14:46:44 +02:00
|
|
|
icon={'facebook'}>
|
|
|
|
{i18n.t('homeScreen.dashboard.seeMore')}
|
|
|
|
</Button>
|
2020-03-07 11:49:32 +01:00
|
|
|
</Card.Actions>
|
|
|
|
</Card>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default withTheme(FeedItem);
|