Browse Source

Fix eslint error

Arnaud Vergnet 3 years ago
parent
commit
c62307af7c
1 changed files with 13 additions and 11 deletions
  1. 13
    11
      src/screens/Home/HomeScreen.js

+ 13
- 11
src/screens/Home/HomeScreen.js View File

@@ -94,6 +94,16 @@ class HomeScreen extends React.Component<PropsType, StateType> {
94 94
   static sortFeedTime = (a: FeedItemType, b: FeedItemType): number =>
95 95
     b.time - a.time;
96 96
 
97
+  static generateNewsFeed(rawFeed: RawNewsFeedType): Array<FeedItemType> {
98
+    const finalFeed = [];
99
+    Object.keys(rawFeed).forEach((key: string) => {
100
+      const category: Array<FeedItemType> | null = rawFeed[key];
101
+      if (category != null && category.length > 0) finalFeed.push(...category);
102
+    });
103
+    finalFeed.sort(HomeScreen.sortFeedTime);
104
+    return finalFeed;
105
+  }
106
+
97 107
   isLoggedIn: boolean | null;
98 108
 
99 109
   fabRef: {current: null | AnimatedFAB};
@@ -407,7 +417,9 @@ class HomeScreen extends React.Component<PropsType, StateType> {
407 417
     // fetchedData = DATA;
408 418
     if (fetchedData != null) {
409 419
       if (fetchedData.news_feed != null)
410
-        this.currentNewFeed = this.generateNewsFeed(fetchedData.news_feed);
420
+        this.currentNewFeed = HomeScreen.generateNewsFeed(
421
+          fetchedData.news_feed,
422
+        );
411 423
       if (fetchedData.dashboard != null)
412 424
         this.currentDashboard = fetchedData.dashboard;
413 425
     }
@@ -450,16 +462,6 @@ class HomeScreen extends React.Component<PropsType, StateType> {
450 462
     });
451 463
   };
452 464
 
453
-  generateNewsFeed(rawFeed: RawNewsFeedType): Array<FeedItemType> {
454
-    const finalFeed = [];
455
-    Object.keys(rawFeed).forEach((key: string) => {
456
-      const category: Array<FeedItemType> | null = rawFeed[key];
457
-      if (category != null && category.length > 0) finalFeed.push(...category);
458
-    });
459
-    finalFeed.sort(HomeScreen.sortFeedTime);
460
-    return finalFeed;
461
-  }
462
-
463 465
   render(): React.Node {
464 466
     const {props, state} = this;
465 467
     return (

Loading…
Cancel
Save