Fix eslint errors

This commit is contained in:
Arnaud Vergnet 2020-08-10 12:46:26 +02:00
parent 0356736d14
commit 6441865b09
2 changed files with 20 additions and 22 deletions

View file

@ -45,16 +45,16 @@ class FeedItem extends React.Component<PropsType> {
};
render(): React.Node {
const {props} = this;
const {item} = props;
const hasImage = item.image !== '' && item.image != null;
const {item, height, navigation} = this.props;
const image = item.image !== '' && item.image != null ? item.image : null;
const pageSource: NewsSourceType = NewsSourcesConstants[item.page_id];
const cardMargin = 10;
const cardHeight = props.height - 2 * cardMargin;
const cardHeight = height - 2 * cardMargin;
const imageSize = 250;
const titleHeight = 80;
const actionsHeight = 60;
const textHeight = hasImage
const textHeight =
image != null
? cardHeight - titleHeight - actionsHeight - imageSize
: cardHeight - titleHeight - actionsHeight;
return (
@ -80,17 +80,17 @@ class FeedItem extends React.Component<PropsType> {
)}
style={{height: titleHeight}}
/>
{hasImage ? (
<View style={{marginLeft: 'auto', marginRight: 'auto'}}>
{image != null ? (
<ImageGalleryButton
navigation={props.navigation}
images={[{url: item.image}]}
navigation={navigation}
images={[{url: image}]}
style={{
width: imageSize,
height: imageSize,
marginLeft: 'auto',
marginRight: 'auto',
}}
/>
</View>
) : null}
<Card.Content>
{item.message !== undefined ? (

View file

@ -1,16 +1,14 @@
// @flow
import * as React from 'react';
import {TouchableRipple, withTheme} from 'react-native-paper';
import {TouchableRipple} from 'react-native-paper';
import {StackNavigationProp} from '@react-navigation/stack';
import {Image} from 'react-native-animatable';
import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet';
import type {CustomThemeType} from '../../managers/ThemeManager';
type PropsType = {
navigation: StackNavigationProp,
images: Array<{url: string}>,
theme: CustomThemeType,
style: ViewStyleProp,
};
@ -37,4 +35,4 @@ class ImageGalleryButton extends React.Component<PropsType> {
}
}
export default withTheme(ImageGalleryButton);
export default ImageGalleryButton;