Fix feed item screen page source

This commit is contained in:
Arnaud Vergnet 2020-08-09 20:44:25 +02:00
parent 6ec87821e8
commit 14e5b01341

View file

@ -12,16 +12,14 @@ import CustomTabBar from '../../components/Tabbar/CustomTabBar';
import type {FeedItemType} from './HomeScreen'; import type {FeedItemType} from './HomeScreen';
import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView'; import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
import ImageGalleryButton from '../../components/Media/ImageGalleryButton'; import ImageGalleryButton from '../../components/Media/ImageGalleryButton';
import NewsSourcesConstants from '../../constants/NewsSourcesConstants';
import type {NewsSourceType} from '../../constants/NewsSourcesConstants';
type PropsType = { type PropsType = {
navigation: StackNavigationProp, navigation: StackNavigationProp,
route: {params: {data: FeedItemType, date: string}}, route: {params: {data: FeedItemType, date: string}},
}; };
const ICON_AMICALE = require('../../../assets/amicale.png');
const NAME_AMICALE = 'Amicale INSA Toulouse';
/** /**
* Class defining a feed item page. * Class defining a feed item page.
*/ */
@ -72,15 +70,17 @@ class FeedItemScreen extends React.Component<PropsType> {
const {navigation} = this.props; const {navigation} = this.props;
const hasImage = const hasImage =
this.displayData.image !== '' && this.displayData.image != null; this.displayData.image !== '' && this.displayData.image != null;
const pageSource: NewsSourceType =
NewsSourcesConstants[this.displayData.page_id];
return ( return (
<CollapsibleScrollView style={{margin: 5}} hasTab> <CollapsibleScrollView style={{margin: 5}} hasTab>
<Card.Title <Card.Title
title={NAME_AMICALE} title={pageSource.name}
subtitle={this.date} subtitle={this.date}
left={(): React.Node => ( left={(): React.Node => (
<Avatar.Image <Avatar.Image
size={48} size={48}
source={ICON_AMICALE} source={pageSource.icon}
style={{backgroundColor: 'transparent'}} style={{backgroundColor: 'transparent'}}
/> />
)} )}