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
   static sortFeedTime = (a: FeedItemType, b: FeedItemType): number =>
94
   static sortFeedTime = (a: FeedItemType, b: FeedItemType): number =>
95
     b.time - a.time;
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
   isLoggedIn: boolean | null;
107
   isLoggedIn: boolean | null;
98
 
108
 
99
   fabRef: {current: null | AnimatedFAB};
109
   fabRef: {current: null | AnimatedFAB};
407
     // fetchedData = DATA;
417
     // fetchedData = DATA;
408
     if (fetchedData != null) {
418
     if (fetchedData != null) {
409
       if (fetchedData.news_feed != null)
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
       if (fetchedData.dashboard != null)
423
       if (fetchedData.dashboard != null)
412
         this.currentDashboard = fetchedData.dashboard;
424
         this.currentDashboard = fetchedData.dashboard;
413
     }
425
     }
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
   render(): React.Node {
465
   render(): React.Node {
464
     const {props, state} = this;
466
     const {props, state} = this;
465
     return (
467
     return (

Loading…
Cancel
Save