Browse Source

Fix eslint errors

Arnaud Vergnet 3 years ago
parent
commit
6441865b09
2 changed files with 20 additions and 22 deletions
  1. 18
    18
      src/components/Home/FeedItem.js
  2. 2
    4
      src/components/Media/ImageGalleryButton.js

+ 18
- 18
src/components/Home/FeedItem.js View File

@@ -45,18 +45,18 @@ class FeedItem extends React.Component<PropsType> {
45 45
   };
46 46
 
47 47
   render(): React.Node {
48
-    const {props} = this;
49
-    const {item} = props;
50
-    const hasImage = item.image !== '' && item.image != null;
48
+    const {item, height, navigation} = this.props;
49
+    const image = item.image !== '' && item.image != null ? item.image : null;
51 50
     const pageSource: NewsSourceType = NewsSourcesConstants[item.page_id];
52 51
     const cardMargin = 10;
53
-    const cardHeight = props.height - 2 * cardMargin;
52
+    const cardHeight = height - 2 * cardMargin;
54 53
     const imageSize = 250;
55 54
     const titleHeight = 80;
56 55
     const actionsHeight = 60;
57
-    const textHeight = hasImage
58
-      ? cardHeight - titleHeight - actionsHeight - imageSize
59
-      : cardHeight - titleHeight - actionsHeight;
56
+    const textHeight =
57
+      image != null
58
+        ? cardHeight - titleHeight - actionsHeight - imageSize
59
+        : cardHeight - titleHeight - actionsHeight;
60 60
     return (
61 61
       <Card
62 62
         style={{
@@ -80,17 +80,17 @@ class FeedItem extends React.Component<PropsType> {
80 80
               )}
81 81
               style={{height: titleHeight}}
82 82
             />
83
-            {hasImage ? (
84
-              <View style={{marginLeft: 'auto', marginRight: 'auto'}}>
85
-                <ImageGalleryButton
86
-                  navigation={props.navigation}
87
-                  images={[{url: item.image}]}
88
-                  style={{
89
-                    width: imageSize,
90
-                    height: imageSize,
91
-                  }}
92
-                />
93
-              </View>
83
+            {image != null ? (
84
+              <ImageGalleryButton
85
+                navigation={navigation}
86
+                images={[{url: image}]}
87
+                style={{
88
+                  width: imageSize,
89
+                  height: imageSize,
90
+                  marginLeft: 'auto',
91
+                  marginRight: 'auto',
92
+                }}
93
+              />
94 94
             ) : null}
95 95
             <Card.Content>
96 96
               {item.message !== undefined ? (

+ 2
- 4
src/components/Media/ImageGalleryButton.js View File

@@ -1,16 +1,14 @@
1 1
 // @flow
2 2
 
3 3
 import * as React from 'react';
4
-import {TouchableRipple, withTheme} from 'react-native-paper';
4
+import {TouchableRipple} from 'react-native-paper';
5 5
 import {StackNavigationProp} from '@react-navigation/stack';
6 6
 import {Image} from 'react-native-animatable';
7 7
 import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet';
8
-import type {CustomThemeType} from '../../managers/ThemeManager';
9 8
 
10 9
 type PropsType = {
11 10
   navigation: StackNavigationProp,
12 11
   images: Array<{url: string}>,
13
-  theme: CustomThemeType,
14 12
   style: ViewStyleProp,
15 13
 };
16 14
 
@@ -37,4 +35,4 @@ class ImageGalleryButton extends React.Component<PropsType> {
37 35
   }
38 36
 }
39 37
 
40
-export default withTheme(ImageGalleryButton);
38
+export default ImageGalleryButton;

Loading…
Cancel
Save