Added mascot to profile screen

This commit is contained in:
Arnaud Vergnet 2020-07-15 18:12:55 +02:00
parent 8b201efabf
commit 99ff524d53

View file

@ -1,7 +1,7 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import {Animated, FlatList, Image, StyleSheet, View} from "react-native"; import {Animated, FlatList, StyleSheet, View} from "react-native";
import {Avatar, Button, Card, Divider, List, Paragraph, withTheme} from 'react-native-paper'; import {Avatar, Button, Card, Divider, List, Paragraph, withTheme} from 'react-native-paper';
import AuthenticatedScreen from "../../components/Amicale/AuthenticatedScreen"; import AuthenticatedScreen from "../../components/Amicale/AuthenticatedScreen";
import i18n from 'i18n-js'; import i18n from 'i18n-js';
@ -15,6 +15,7 @@ import CardList from "../../components/Lists/CardList/CardList";
import {StackNavigationProp} from "@react-navigation/stack"; import {StackNavigationProp} from "@react-navigation/stack";
import type {CustomTheme} from "../../managers/ThemeManager"; import type {CustomTheme} from "../../managers/ThemeManager";
import AvailableWebsites from "../../constants/AvailableWebsites"; import AvailableWebsites from "../../constants/AvailableWebsites";
import Mascot, {MASCOT_STYLE} from "../../components/Mascot/Mascot";
type Props = { type Props = {
navigation: StackNavigationProp, navigation: StackNavigationProp,
@ -84,7 +85,10 @@ class ProfileScreen extends React.Component<Props, State> {
title: i18n.t('screens.websites.amicale'), title: i18n.t('screens.websites.amicale'),
subtitle: i18n.t('screens.services.descriptions.amicaleWebsite'), subtitle: i18n.t('screens.services.descriptions.amicaleWebsite'),
image: ICON_AMICALE, image: ICON_AMICALE,
onPress: () => this.props.navigation.navigate("website", {host: AvailableWebsites.websites.AMICALE, title: i18n.t('screens.websites.amicale')}), onPress: () => this.props.navigation.navigate("website", {
host: AvailableWebsites.websites.AMICALE,
title: i18n.t('screens.websites.amicale')
}),
}, },
]; ];
} }
@ -179,12 +183,14 @@ class ProfileScreen extends React.Component<Props, State> {
<Card style={styles.card}> <Card style={styles.card}>
<Card.Title <Card.Title
title={i18n.t("screens.profile.welcomeTitle", {name: this.data.first_name})} title={i18n.t("screens.profile.welcomeTitle", {name: this.data.first_name})}
left={() => <Image left={() => <Mascot
style={{ emotion={MASCOT_STYLE.COOL}
width: 50, size={60}
height: 50, animated={true}
entryAnimation={{
animation: "bounceIn",
duration: 1000
}} }}
source={ICON_AMICALE}
/>} />}
titleStyle={{marginLeft: 10}} titleStyle={{marginLeft: 10}}
/> />
@ -290,7 +296,11 @@ class ProfileScreen extends React.Component<Props, State> {
<Button <Button
icon="account-edit" icon="account-edit"
mode="contained" mode="contained"
onPress={() => this.props.navigation.navigate("website", {host: AvailableWebsites.websites.AMICALE, path: this.data.link, title: i18n.t('screens.websites.amicale')})} onPress={() => this.props.navigation.navigate("website", {
host: AvailableWebsites.websites.AMICALE,
path: this.data.link,
title: i18n.t('screens.websites.amicale')
})}
style={styles.editButton}> style={styles.editButton}>
{i18n.t("screens.profile.editInformation")} {i18n.t("screens.profile.editInformation")}
</Button> </Button>