Use square image for amicale logo across the app

This commit is contained in:
Arnaud Vergnet 2020-07-14 21:50:22 +02:00
parent 7ef93da811
commit ea19ca3ade
6 changed files with 37 additions and 32 deletions

View file

@ -1,8 +1,8 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import {Avatar, Card, Paragraph} from "react-native-paper"; import {Card, Paragraph} from "react-native-paper";
import {StyleSheet} from "react-native"; import {Image, StyleSheet} from "react-native";
import i18n from 'i18n-js'; import i18n from 'i18n-js';
const ICON_AMICALE = require('../../../../assets/amicale.png'); const ICON_AMICALE = require('../../../../assets/amicale.png');
@ -19,10 +19,13 @@ export default class VoteTitle extends React.Component<{}> {
<Card.Title <Card.Title
title={i18n.t('screens.vote.main.title')} title={i18n.t('screens.vote.main.title')}
subtitle={i18n.t('screens.vote.main.subtitle')} subtitle={i18n.t('screens.vote.main.subtitle')}
left={(props) => <Avatar.Image left={(props) => <Image
{...props} {...props}
style={{
width: props.size,
height: props.size,
}}
source={ICON_AMICALE} source={ICON_AMICALE}
style={styles.icon}
/>} />}
/> />
<Card.Content> <Card.Content>
@ -42,7 +45,4 @@ const styles = StyleSheet.create({
card: { card: {
margin: 10, margin: 10,
}, },
icon: {
backgroundColor: 'transparent'
},
}); });

View file

@ -1,8 +1,8 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import {Avatar, Button, Card, Text} from 'react-native-paper'; import {Button, Card, Text} from 'react-native-paper';
import {View} from "react-native"; import {Image, View} from "react-native";
import Autolink from "react-native-autolink"; import Autolink from "react-native-autolink";
import i18n from "i18n-js"; import i18n from "i18n-js";
import ImageModal from 'react-native-image-modal'; import ImageModal from 'react-native-image-modal';
@ -38,9 +38,13 @@ class FeedItem extends React.Component<Props> {
*/ */
getAvatar() { getAvatar() {
return ( return (
<Avatar.Image <Image
size={48} source={ICON_AMICALE} size={48}
style={{backgroundColor: 'transparent'}}/> source={ICON_AMICALE}
style={{
width: 48,
height: 48,
}}/>
); );
} }

View file

@ -36,17 +36,12 @@ export default class CardList extends React.Component<Props> {
keyExtractor = (item: cardItem) => item.title; keyExtractor = (item: cardItem) => item.title;
render() { render() {
let containerStyle; let containerStyle = {};
if (this.props.isHorizontal) { if (this.props.isHorizontal) {
containerStyle = { containerStyle = {
...this.props.contentContainerStyle,
height: 150, height: 150,
justifyContent: 'space-around', justifyContent: 'space-around',
}; };
} else {
containerStyle = {
...this.props.contentContainerStyle,
}
} }
return ( return (
<Animated.FlatList <Animated.FlatList
@ -60,4 +55,4 @@ export default class CardList extends React.Component<Props> {
/> />
); );
} }
} }

View file

@ -1,8 +1,8 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import {Animated} from "react-native"; import {Animated, Image} from "react-native";
import {Avatar, Card, Paragraph, withTheme} from 'react-native-paper'; import {Card, Paragraph, withTheme} from 'react-native-paper';
import AuthenticatedScreen from "../../../components/Amicale/AuthenticatedScreen"; import AuthenticatedScreen from "../../../components/Amicale/AuthenticatedScreen";
import {Collapsible} from "react-navigation-collapsible"; import {Collapsible} from "react-navigation-collapsible";
import {withCollapsible} from "../../../utils/withCollapsible"; import {withCollapsible} from "../../../utils/withCollapsible";
@ -87,10 +87,13 @@ class EquipmentListScreen extends React.Component<Props> {
return <Card style={{margin: 5}}> return <Card style={{margin: 5}}>
<Card.Title <Card.Title
title={i18n.t('screens.equipment.title')} title={i18n.t('screens.equipment.title')}
left={(props) => <Avatar.Image left={(props) => <Image
{...props} {...props}
style={{
width: props.size,
height: props.size,
}}
source={ICON_AMICALE} source={ICON_AMICALE}
style={{backgroundColor: 'transparent'}}
/>} />}
/> />
<Card.Content> <Card.Content>

View file

@ -1,7 +1,7 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import {Animated, FlatList, StyleSheet, View} from "react-native"; import {Animated, FlatList, Image, 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';
@ -179,10 +179,12 @@ 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={() => <Avatar.Image left={() => <Image
size={64} style={{
width: 50,
height: 50,
}}
source={ICON_AMICALE} source={ICON_AMICALE}
style={{backgroundColor: 'transparent',}}
/>} />}
titleStyle={{marginLeft: 10}} titleStyle={{marginLeft: 10}}
/> />

View file

@ -6,7 +6,7 @@ import CardList from "../../components/Lists/CardList/CardList";
import CustomTabBar from "../../components/Tabbar/CustomTabBar"; import CustomTabBar from "../../components/Tabbar/CustomTabBar";
import {withCollapsible} from "../../utils/withCollapsible"; import {withCollapsible} from "../../utils/withCollapsible";
import {Collapsible} from "react-navigation-collapsible"; import {Collapsible} from "react-navigation-collapsible";
import {Animated, View} from "react-native"; import {Animated, Image, View} from "react-native";
import {Avatar, Card, Divider, List, TouchableRipple, withTheme} from "react-native-paper"; import {Avatar, Card, Divider, List, TouchableRipple, withTheme} from "react-native-paper";
import type {CustomTheme} from "../../managers/ThemeManager"; import type {CustomTheme} from "../../managers/ThemeManager";
import i18n from 'i18n-js'; import i18n from 'i18n-js';
@ -227,12 +227,13 @@ class ServicesScreen extends React.Component<Props, State> {
*/ */
getListTitleImage(props, source: string | number) { getListTitleImage(props, source: string | number) {
if (typeof source === "number") if (typeof source === "number")
return <Avatar.Image return <Image
{...props}
size={48} size={48}
source={source} source={source}
style={{backgroundColor: 'transparent'}} style={{
/> width: 48,
height: 48,
}}/>
else else
return <Avatar.Icon return <Avatar.Icon
{...props} {...props}