Browse Source

Improved home screen layout

Arnaud Vergnet 1 year 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,6 +95,7 @@
95 95
     },
96 96
     "home": {
97 97
       "title": "Campus",
98
+      "feedTitle": "Amicale's News",
98 99
       "feed": "Details",
99 100
       "dashboard": {
100 101
         "seeMore": "Click to see more",

+ 1
- 0
locales/fr.json View File

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

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

@@ -5,7 +5,7 @@ import {FlatList} from 'react-native';
5 5
 import i18n from "i18n-js";
6 6
 import DashboardItem from "../../components/Home/EventDashboardItem";
7 7
 import WebSectionList from "../../components/Screens/WebSectionList";
8
-import {withTheme} from 'react-native-paper';
8
+import {Headline, withTheme} from 'react-native-paper';
9 9
 import FeedItem from "../../components/Home/FeedItem";
10 10
 import SmallDashboardItem from "../../components/Home/SmallDashboardItem";
11 11
 import PreviewEventDashboardItem from "../../components/Home/PreviewEventDashboardItem";
@@ -228,7 +228,7 @@ class HomeScreen extends React.Component<Props, State> {
228 228
                 id: SECTIONS_ID[0]
229 229
             },
230 230
             {
231
-                title: '',
231
+                title: i18n.t("screens.home.feedTitle"),
232 232
                 data: this.currentNewFeed,
233 233
                 id: SECTIONS_ID[1]
234 234
             }
@@ -511,6 +511,21 @@ class HomeScreen extends React.Component<Props, State> {
511 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 530
      * Callback when pressing the login button on the banner.
516 531
      * This hides the banner and takes the user to the login page.
@@ -540,6 +555,7 @@ class HomeScreen extends React.Component<Props, State> {
540 555
                         itemHeight={FEED_ITEM_HEIGHT}
541 556
                         onScroll={this.onScroll}
542 557
                         showError={false}
558
+                        renderSectionHeader={this.renderSectionHeader}
543 559
                     />
544 560
                 </View>
545 561
                 <MascotPopup

Loading…
Cancel
Save