Browse Source

Fixed amicale category image

Arnaud Vergnet 3 years ago
parent
commit
3275b73708
1 changed files with 18 additions and 4 deletions
  1. 18
    4
      src/screens/Services/ServicesScreen.js

+ 18
- 4
src/screens/Services/ServicesScreen.js View File

@@ -24,11 +24,13 @@ type Props = {
24 24
 export type listItem = {
25 25
     title: string,
26 26
     description: string,
27
-    image: string,
27
+    image: string | number,
28 28
     shouldLogin: boolean,
29 29
     content: cardList,
30 30
 }
31 31
 
32
+const AMICALE_LOGO = require("../../../assets/amicale.png");
33
+
32 34
 const CLUBS_IMAGE = "https://etud.insa-toulouse.fr/~amicale_app/images/Clubs.png";
33 35
 const PROFILE_IMAGE = "https://etud.insa-toulouse.fr/~amicale_app/images/ProfilAmicaliste.png";
34 36
 const VOTE_IMAGE = "https://etud.insa-toulouse.fr/~amicale_app/images/Vote.png";
@@ -151,7 +153,7 @@ class ServicesScreen extends React.Component<Props> {
151 153
             {
152 154
                 title: i18n.t("servicesScreen.amicale"),
153 155
                 description: "LOGIN",
154
-                image: AMICALE_IMAGE,
156
+                image: AMICALE_LOGO,
155 157
                 shouldLogin: true,
156 158
                 content: this.amicaleDataset
157 159
             },
@@ -188,17 +190,29 @@ class ServicesScreen extends React.Component<Props> {
188 190
     /**
189 191
      * Gets the list title image for the list.
190 192
      *
193
+     * If the source is a string, we are using an icon.
194
+     * If the source is a number, we are using an internal image.
195
+     *
191 196
      * @param props Props to pass to the component
192
-     * @param source The source image to display
197
+     * @param source The source image to display. Can be a string for icons or a number for local images
193 198
      * @returns {*}
194 199
      */
195
-    getListTitleImage(props, source: string) {
200
+    getListTitleImage(props, source: string | number) {
201
+        if (typeof source === "number")
196 202
             return <Avatar.Image
197 203
                 {...props}
198 204
                 size={48}
199 205
                 source={source}
200 206
                 style={{backgroundColor: 'transparent'}}
201 207
             />
208
+        else
209
+            return <Avatar.Icon
210
+                {...props}
211
+                size={48}
212
+                icon={source}
213
+                color={this.props.theme.colors.primary}
214
+                style={{backgroundColor: 'transparent'}}
215
+            />
202 216
     }
203 217
 
204 218
     /**

Loading…
Cancel
Save