Browse Source

Improved home screen layout

Arnaud Vergnet 3 years ago
parent
commit
560c336759
3 changed files with 20 additions and 2 deletions
  1. 1
    0
      locales/en.json
  2. 1
    0
      locales/fr.json
  3. 18
    2
      src/screens/Home/HomeScreen.js

+ 1
- 0
locales/en.json View File

95
     },
95
     },
96
     "home": {
96
     "home": {
97
       "title": "Campus",
97
       "title": "Campus",
98
+      "feedTitle": "Amicale's News",
98
       "feed": "Details",
99
       "feed": "Details",
99
       "dashboard": {
100
       "dashboard": {
100
         "seeMore": "Click to see more",
101
         "seeMore": "Click to see more",

+ 1
- 0
locales/fr.json View File

95
     },
95
     },
96
     "home": {
96
     "home": {
97
       "title": "Campus",
97
       "title": "Campus",
98
+      "feedTitle": "News de l'Amicale",
98
       "feed": "Détails",
99
       "feed": "Détails",
99
       "dashboard": {
100
       "dashboard": {
100
         "seeMore": "Clique pour plus d'infos",
101
         "seeMore": "Clique pour plus d'infos",

+ 18
- 2
src/screens/Home/HomeScreen.js View File

5
 import i18n from "i18n-js";
5
 import i18n from "i18n-js";
6
 import DashboardItem from "../../components/Home/EventDashboardItem";
6
 import DashboardItem from "../../components/Home/EventDashboardItem";
7
 import WebSectionList from "../../components/Screens/WebSectionList";
7
 import WebSectionList from "../../components/Screens/WebSectionList";
8
-import {withTheme} from 'react-native-paper';
8
+import {Headline, withTheme} from 'react-native-paper';
9
 import FeedItem from "../../components/Home/FeedItem";
9
 import FeedItem from "../../components/Home/FeedItem";
10
 import SmallDashboardItem from "../../components/Home/SmallDashboardItem";
10
 import SmallDashboardItem from "../../components/Home/SmallDashboardItem";
11
 import PreviewEventDashboardItem from "../../components/Home/PreviewEventDashboardItem";
11
 import PreviewEventDashboardItem from "../../components/Home/PreviewEventDashboardItem";
228
                 id: SECTIONS_ID[0]
228
                 id: SECTIONS_ID[0]
229
             },
229
             },
230
             {
230
             {
231
-                title: '',
231
+                title: i18n.t("screens.home.feedTitle"),
232
                 data: this.currentNewFeed,
232
                 data: this.currentNewFeed,
233
                 id: SECTIONS_ID[1]
233
                 id: SECTIONS_ID[1]
234
             }
234
             }
511
             this.fabRef.current.onScroll(event);
511
             this.fabRef.current.onScroll(event);
512
     };
512
     };
513
 
513
 
514
+    renderSectionHeader = (data: { [key: string]: any }) => {
515
+        if (data.section.title !== "")
516
+            return (
517
+                <Headline style={{
518
+                    textAlign: "center",
519
+                    marginTop: 50,
520
+                    marginBottom: 10,
521
+                }}>
522
+                    {data.section.title}
523
+                </Headline>
524
+            )
525
+        else
526
+            return null;
527
+    }
528
+
514
     /**
529
     /**
515
      * Callback when pressing the login button on the banner.
530
      * Callback when pressing the login button on the banner.
516
      * This hides the banner and takes the user to the login page.
531
      * This hides the banner and takes the user to the login page.
540
                         itemHeight={FEED_ITEM_HEIGHT}
555
                         itemHeight={FEED_ITEM_HEIGHT}
541
                         onScroll={this.onScroll}
556
                         onScroll={this.onScroll}
542
                         showError={false}
557
                         showError={false}
558
+                        renderSectionHeader={this.renderSectionHeader}
543
                     />
559
                     />
544
                 </View>
560
                 </View>
545
                 <MascotPopup
561
                 <MascotPopup

Loading…
Cancel
Save