Compare commits

..

7 commits

28 changed files with 258 additions and 237 deletions

4
App.js
View file

@ -165,7 +165,9 @@ export default class App extends React.Component<null, StateType> {
*/ */
loadAssetsAsync = async () => { loadAssetsAsync = async () => {
await AsyncStorageManager.getInstance().loadPreferences(); await AsyncStorageManager.getInstance().loadPreferences();
await ConnectionManager.getInstance().recoverLogin(); await ConnectionManager.getInstance()
.recoverLogin()
.catch(() => {});
}; };
/** /**

View file

@ -13,6 +13,10 @@ import {FlatList, StyleSheet} from 'react-native';
import i18n from 'i18n-js'; import i18n from 'i18n-js';
import type {VoteTeamType} from '../../../screens/Amicale/VoteScreen'; import type {VoteTeamType} from '../../../screens/Amicale/VoteScreen';
import type {CustomThemeType} from '../../../managers/ThemeManager'; import type {CustomThemeType} from '../../../managers/ThemeManager';
import type {
CardTitleIconPropsType,
ListIconPropsType,
} from '../../../constants/PaperStyles';
type PropsType = { type PropsType = {
teams: Array<VoteTeamType>, teams: Array<VoteTeamType>,
@ -78,10 +82,10 @@ class VoteResults extends React.Component<PropsType> {
<List.Item <List.Item
title={item.name} title={item.name}
description={`${item.votes} ${i18n.t('screens.vote.results.votes')}`} description={`${item.votes} ${i18n.t('screens.vote.results.votes')}`}
left={({size}: {size: number}): React.Node => left={(iconProps: ListIconPropsType): React.Node =>
isWinner ? ( isWinner ? (
<List.Icon <List.Icon
size={size} style={iconProps.style}
icon={isDraw ? 'trophy-outline' : 'trophy'} icon={isDraw ? 'trophy-outline' : 'trophy'}
color={props.theme.colors.primary} color={props.theme.colors.primary}
/> />
@ -111,8 +115,8 @@ class VoteResults extends React.Component<PropsType> {
subtitle={`${i18n.t('screens.vote.results.subtitle')} ${ subtitle={`${i18n.t('screens.vote.results.subtitle')} ${
props.dateEnd props.dateEnd
}`} }`}
left={({size}: {size: number}): React.Node => ( left={(iconProps: CardTitleIconPropsType): React.Node => (
<Avatar.Icon size={size} icon="podium-gold" /> <Avatar.Icon size={iconProps.size} icon="podium-gold" />
)} )}
/> />
<Card.Content> <Card.Content>

View file

@ -8,6 +8,7 @@ import ConnectionManager from '../../../managers/ConnectionManager';
import LoadingConfirmDialog from '../../Dialogs/LoadingConfirmDialog'; import LoadingConfirmDialog from '../../Dialogs/LoadingConfirmDialog';
import ErrorDialog from '../../Dialogs/ErrorDialog'; import ErrorDialog from '../../Dialogs/ErrorDialog';
import type {VoteTeamType} from '../../../screens/Amicale/VoteScreen'; import type {VoteTeamType} from '../../../screens/Amicale/VoteScreen';
import type {CardTitleIconPropsType} from '../../../constants/PaperStyles';
type PropsType = { type PropsType = {
teams: Array<VoteTeamType>, teams: Array<VoteTeamType>,
@ -99,8 +100,8 @@ export default class VoteSelect extends React.PureComponent<
<Card.Title <Card.Title
title={i18n.t('screens.vote.select.title')} title={i18n.t('screens.vote.select.title')}
subtitle={i18n.t('screens.vote.select.subtitle')} subtitle={i18n.t('screens.vote.select.subtitle')}
left={({size}: {size: number}): React.Node => ( left={(iconProps: CardTitleIconPropsType): React.Node => (
<Avatar.Icon size={size} icon="alert-decagram" /> <Avatar.Icon size={iconProps.size} icon="alert-decagram" />
)} )}
/> />
<Card.Content> <Card.Content>

View file

@ -4,6 +4,7 @@ import * as React from 'react';
import {Avatar, Card, Paragraph} from 'react-native-paper'; import {Avatar, Card, Paragraph} from 'react-native-paper';
import {StyleSheet} from 'react-native'; import {StyleSheet} from 'react-native';
import i18n from 'i18n-js'; import i18n from 'i18n-js';
import type {CardTitleIconPropsType} from '../../../constants/PaperStyles';
type PropsType = { type PropsType = {
startDate: string, startDate: string,
@ -30,8 +31,8 @@ export default class VoteTease extends React.Component<PropsType> {
<Card.Title <Card.Title
title={i18n.t('screens.vote.tease.title')} title={i18n.t('screens.vote.tease.title')}
subtitle={i18n.t('screens.vote.tease.subtitle')} subtitle={i18n.t('screens.vote.tease.subtitle')}
left={({size}: {size: number}): React.Node => ( left={(iconProps: CardTitleIconPropsType): React.Node => (
<Avatar.Icon size={size} icon="vote" /> <Avatar.Icon size={iconProps.size} icon="vote" />
)} )}
/> />
<Card.Content> <Card.Content>

View file

@ -1,15 +1,11 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import { import {Avatar, Card, Paragraph, withTheme} from 'react-native-paper';
ActivityIndicator,
Card,
Paragraph,
withTheme,
} from 'react-native-paper';
import {StyleSheet} from 'react-native'; import {StyleSheet} from 'react-native';
import i18n from 'i18n-js'; import i18n from 'i18n-js';
import type {CustomThemeType} from '../../../managers/ThemeManager'; import type {CustomThemeType} from '../../../managers/ThemeManager';
import type {CardTitleIconPropsType} from '../../../constants/PaperStyles';
type PropsType = { type PropsType = {
startDate: string | null, startDate: string | null,
@ -45,8 +41,8 @@ class VoteWait extends React.Component<PropsType> {
: i18n.t('screens.vote.wait.titleEnded') : i18n.t('screens.vote.wait.titleEnded')
} }
subtitle={i18n.t('screens.vote.wait.subtitle')} subtitle={i18n.t('screens.vote.wait.subtitle')}
left={({size}: {size: number}): React.Node => ( left={(iconProps: CardTitleIconPropsType): React.Node => (
<ActivityIndicator size={size} /> <Avatar.Icon size={iconProps.size} icon="progress-check" />
)} )}
/> />
<Card.Content> <Card.Content>

View file

@ -6,6 +6,7 @@ import {List, withTheme} from 'react-native-paper';
import Collapsible from 'react-native-collapsible'; import Collapsible from 'react-native-collapsible';
import * as Animatable from 'react-native-animatable'; import * as Animatable from 'react-native-animatable';
import type {CustomThemeType} from '../../managers/ThemeManager'; import type {CustomThemeType} from '../../managers/ThemeManager';
import type {ListIconPropsType} from '../../constants/PaperStyles';
type PropsType = { type PropsType = {
theme: CustomThemeType, theme: CustomThemeType,
@ -91,14 +92,13 @@ class AnimatedAccordion extends React.Component<PropsType, StateType> {
subtitle={props.subtitle} subtitle={props.subtitle}
titleStyle={state.expanded ? {color: colors.primary} : null} titleStyle={state.expanded ? {color: colors.primary} : null}
onPress={this.toggleAccordion} onPress={this.toggleAccordion}
right={({size}: {size: number}): React.Node => ( right={(iconProps: ListIconPropsType): React.Node => (
<AnimatedListIcon <AnimatedListIcon
ref={this.chevronRef} ref={this.chevronRef}
size={size} style={iconProps.style}
icon={this.chevronIcon} icon={this.chevronIcon}
color={state.expanded ? colors.primary : null} color={state.expanded ? colors.primary : iconProps.color}
useNativeDriver useNativeDriver
style={{rotate: '0deg'}}
/> />
)} )}
left={props.left} left={props.left}

View file

@ -6,6 +6,7 @@ import {View} from 'react-native';
import i18n from 'i18n-js'; import i18n from 'i18n-js';
import {StackNavigationProp} from '@react-navigation/stack'; import {StackNavigationProp} from '@react-navigation/stack';
import type {CustomThemeType} from '../../managers/ThemeManager'; import type {CustomThemeType} from '../../managers/ThemeManager';
import type {ListIconPropsType} from '../../constants/PaperStyles';
type PropsType = { type PropsType = {
navigation: StackNavigationProp, navigation: StackNavigationProp,
@ -19,19 +20,27 @@ class ActionsDashBoardItem extends React.Component<PropsType> {
} }
render(): React.Node { render(): React.Node {
const {props} = this; const {navigation} = this.props;
return ( return (
<View> <View>
<List.Item <List.Item
title={i18n.t('screens.feedback.homeButtonTitle')} title={i18n.t('screens.feedback.homeButtonTitle')}
description={i18n.t('screens.feedback.homeButtonSubtitle')} description={i18n.t('screens.feedback.homeButtonSubtitle')}
left={({size}: {size: number}): React.Node => ( left={(props: ListIconPropsType): React.Node => (
<List.Icon size={size} icon="comment-quote" /> <List.Icon
color={props.color}
style={props.style}
icon="comment-quote"
/>
)} )}
right={({size}: {size: number}): React.Node => ( right={(props: ListIconPropsType): React.Node => (
<List.Icon size={size} icon="chevron-right" /> <List.Icon
color={props.color}
style={props.style}
icon="chevron-right"
/>
)} )}
onPress={(): void => props.navigation.navigate('feedback')} onPress={(): void => navigation.navigate('feedback')}
style={{ style={{
paddingTop: 0, paddingTop: 0,
paddingBottom: 0, paddingBottom: 0,

View file

@ -11,6 +11,7 @@ import {
import {StyleSheet, View} from 'react-native'; import {StyleSheet, View} from 'react-native';
import i18n from 'i18n-js'; import i18n from 'i18n-js';
import type {CustomThemeType} from '../../managers/ThemeManager'; import type {CustomThemeType} from '../../managers/ThemeManager';
import type {CardTitleIconPropsType} from '../../constants/PaperStyles';
type PropsType = { type PropsType = {
eventNumber: number, eventNumber: number,
@ -76,11 +77,11 @@ class EventDashBoardItem extends React.Component<PropsType> {
titleStyle={{color: textColor}} titleStyle={{color: textColor}}
subtitle={subtitle} subtitle={subtitle}
subtitleStyle={{color: textColor}} subtitleStyle={{color: textColor}}
left={(): React.Node => ( left={(iconProps: CardTitleIconPropsType): React.Node => (
<Avatar.Icon <Avatar.Icon
icon="calendar-range" icon="calendar-range"
color={iconColor} color={iconColor}
size={60} size={iconProps.size}
style={styles.avatar} style={styles.avatar}
/> />
)} )}

View file

@ -7,6 +7,7 @@ import i18n from 'i18n-js';
import AnimatedAccordion from '../../Animations/AnimatedAccordion'; import AnimatedAccordion from '../../Animations/AnimatedAccordion';
import {isItemInCategoryFilter} from '../../../utils/Search'; import {isItemInCategoryFilter} from '../../../utils/Search';
import type {ClubCategoryType} from '../../../screens/Amicale/Clubs/ClubListScreen'; import type {ClubCategoryType} from '../../../screens/Amicale/Clubs/ClubListScreen';
import type {ListIconPropsType} from '../../../constants/PaperStyles';
type PropsType = { type PropsType = {
categories: Array<ClubCategoryType>, categories: Array<ClubCategoryType>,
@ -74,8 +75,8 @@ class ClubListHeader extends React.Component<PropsType> {
<Card style={styles.card}> <Card style={styles.card}>
<AnimatedAccordion <AnimatedAccordion
title={i18n.t('screens.clubs.categories')} title={i18n.t('screens.clubs.categories')}
left={({size}: {size: number}): React.Node => ( left={(props: ListIconPropsType): React.Node => (
<List.Icon size={size} icon="star" /> <List.Icon color={props.color} style={props.style} icon="star" />
)} )}
opened> opened>
<Text style={styles.text}> <Text style={styles.text}>

View file

@ -5,6 +5,7 @@ import {Image} from 'react-native';
import {List, withTheme} from 'react-native-paper'; import {List, withTheme} from 'react-native-paper';
import type {CustomThemeType} from '../../../managers/ThemeManager'; import type {CustomThemeType} from '../../../managers/ThemeManager';
import type {ServiceItemType} from '../../../managers/ServicesManager'; import type {ServiceItemType} from '../../../managers/ServicesManager';
import type {ListIconPropsType} from '../../../constants/PaperStyles';
type PropsType = { type PropsType = {
item: ServiceItemType, item: ServiceItemType,
@ -21,36 +22,36 @@ class DashboardEditItem extends React.Component<PropsType> {
} }
render(): React.Node { render(): React.Node {
const {props} = this; const {item, onPress, height, isActive, theme} = this.props;
return ( return (
<List.Item <List.Item
title={props.item.title} title={item.title}
description={props.item.subtitle} description={item.subtitle}
onPress={props.isActive ? null : props.onPress} onPress={isActive ? null : onPress}
left={(): React.Node => ( left={(): React.Node => (
<Image <Image
source={{uri: props.item.image}} source={{uri: item.image}}
style={{ style={{
width: 40, width: 40,
height: 40, height: 40,
}} }}
/> />
)} )}
right={({size}: {size: number}): React.Node => right={(props: ListIconPropsType): React.Node =>
props.isActive ? ( isActive ? (
<List.Icon <List.Icon
size={size} style={props.style}
icon="check" icon="check"
color={props.theme.colors.success} color={theme.colors.success}
/> />
) : null ) : null
} }
style={{ style={{
height: props.height, height,
justifyContent: 'center', justifyContent: 'center',
paddingLeft: 30, paddingLeft: 30,
backgroundColor: props.isActive backgroundColor: isActive
? props.theme.colors.proxiwashFinishedColor ? theme.colors.proxiwashFinishedColor
: 'transparent', : 'transparent',
}} }}
/> />

View file

@ -11,6 +11,7 @@ import type {
PlanexGroupCategoryType, PlanexGroupCategoryType,
} from '../../../screens/Planex/GroupSelectionScreen'; } from '../../../screens/Planex/GroupSelectionScreen';
import type {CustomThemeType} from '../../../managers/ThemeManager'; import type {CustomThemeType} from '../../../managers/ThemeManager';
import type {ListIconPropsType} from '../../../constants/PaperStyles';
type PropsType = { type PropsType = {
item: PlanexGroupCategoryType, item: PlanexGroupCategoryType,
@ -87,10 +88,10 @@ class GroupListAccordion extends React.Component<PropsType> {
height: props.height, height: props.height,
justifyContent: 'center', justifyContent: 'center',
}} }}
left={({size}: {size: number}): React.Node => left={(iconProps: ListIconPropsType): React.Node =>
item.id === 0 ? ( item.id === 0 ? (
<List.Icon <List.Icon
size={size} style={iconProps.style}
icon="star" icon="star"
color={props.theme.colors.tetrisScore} color={props.theme.colors.tetrisScore}
/> />

View file

@ -1,10 +1,12 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import {IconButton, List, withTheme} from 'react-native-paper'; import {List, TouchableRipple, withTheme} from 'react-native-paper';
import * as Animatable from 'react-native-animatable'; import * as Animatable from 'react-native-animatable';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
import type {CustomThemeType} from '../../../managers/ThemeManager'; import type {CustomThemeType} from '../../../managers/ThemeManager';
import type {PlanexGroupType} from '../../../screens/Planex/GroupSelectionScreen'; import type {PlanexGroupType} from '../../../screens/Planex/GroupSelectionScreen';
import type {ListIconPropsType} from '../../../constants/PaperStyles';
type PropsType = { type PropsType = {
theme: CustomThemeType, theme: CustomThemeType,
@ -20,7 +22,7 @@ const REPLACE_REGEX = /_/g;
class GroupListItem extends React.Component<PropsType> { class GroupListItem extends React.Component<PropsType> {
isFav: boolean; isFav: boolean;
starRef = {current: null | IconButton}; starRef: null | Animatable.View;
constructor(props: PropsType) { constructor(props: PropsType) {
super(props); super(props);
@ -37,6 +39,16 @@ class GroupListItem extends React.Component<PropsType> {
return shouldUpdate; return shouldUpdate;
} }
onStarPress = () => {
const {props} = this;
const ref = this.starRef;
if (ref != null) {
if (this.isFav) ref.rubberBand();
else ref.swing();
}
props.onStarPress();
};
isGroupInFavorites(favorites: Array<PlanexGroupType>): boolean { isGroupInFavorites(favorites: Array<PlanexGroupType>): boolean {
const {item} = this.props; const {item} = this.props;
for (let i = 0; i < favorites.length; i += 1) { for (let i = 0; i < favorites.length; i += 1) {
@ -45,15 +57,6 @@ class GroupListItem extends React.Component<PropsType> {
return false; return false;
} }
onStarPress = () => {
const {props} = this;
if (this.starRef.current != null) {
if (this.isFav) this.starRef.current.rubberBand();
else this.starRef.current.swing();
}
props.onStarPress();
};
render(): React.Node { render(): React.Node {
const {props} = this; const {props} = this;
const {colors} = props.theme; const {colors} = props.theme;
@ -61,17 +64,34 @@ class GroupListItem extends React.Component<PropsType> {
<List.Item <List.Item
title={props.item.name.replace(REPLACE_REGEX, ' ')} title={props.item.name.replace(REPLACE_REGEX, ' ')}
onPress={props.onPress} onPress={props.onPress}
left={({size}: {size: number}): React.Node => ( left={(iconProps: ListIconPropsType): React.Node => (
<List.Icon size={size} icon="chevron-right" /> <List.Icon
color={iconProps.color}
style={iconProps.style}
icon="chevron-right"
/>
)} )}
right={({size, color}: {size: number, color: string}): React.Node => ( right={(iconProps: ListIconPropsType): React.Node => (
<Animatable.View ref={this.starRef} useNativeDriver> <Animatable.View
<IconButton ref={(ref: Animatable.View) => {
size={size} this.starRef = ref;
icon="star" }}
useNativeDriver>
<TouchableRipple
onPress={this.onStarPress} onPress={this.onStarPress}
color={this.isFav ? colors.tetrisScore : color} style={{
/> marginRight: 10,
marginLeft: 'auto',
marginTop: 'auto',
marginBottom: 'auto',
}}>
<MaterialCommunityIcons
size={30}
style={{padding: 10}}
name="star"
color={this.isFav ? colors.tetrisScore : iconProps.color}
/>
</TouchableRipple>
</Animatable.View> </Animatable.View>
)} )}
style={{ style={{

View file

@ -174,7 +174,7 @@ export default class CustomIntroSlider extends React.Component<
{state.currentSlide === index ? ( {state.currentSlide === index ? (
<View style={{height: '100%', flex: 1}}> <View style={{height: '100%', flex: 1}}>
<View style={{flex: 1}}>{item.view()}</View> <View style={{flex: 1}}>{item.view()}</View>
<Animatable.View animation="fadeIn"> <Animatable.View useNativeDriver animation="fadeIn">
{index !== 0 && index !== this.introSlides.length - 1 ? ( {index !== 0 && index !== this.introSlides.length - 1 ? (
<Mascot <Mascot
style={{ style={{
@ -218,15 +218,18 @@ export default class CustomIntroSlider extends React.Component<
borderColor: 'rgba(0,0,0,0.60)', borderColor: 'rgba(0,0,0,0.60)',
borderWidth: 4, borderWidth: 4,
borderRadius: 10, borderRadius: 10,
elevation: 0,
}}> }}>
<Card.Content> <Card.Content>
<Animatable.Text <Animatable.Text
useNativeDriver
animation="fadeIn" animation="fadeIn"
delay={100} delay={100}
style={styles.title}> style={styles.title}>
{item.title} {item.title}
</Animatable.Text> </Animatable.Text>
<Animatable.Text <Animatable.Text
useNativeDriver
animation="fadeIn" animation="fadeIn"
delay={200} delay={200}
style={styles.text}> style={styles.text}>
@ -320,7 +323,10 @@ export default class CustomIntroSlider extends React.Component<
static getIconView(icon: MaterialCommunityIconsGlyphs): React.Node { static getIconView(icon: MaterialCommunityIconsGlyphs): React.Node {
return ( return (
<View style={{flex: 1}}> <View style={{flex: 1}}>
<Animatable.View style={styles.center} animation="fadeIn"> <Animatable.View
useNativeDriver
style={styles.center}
animation="fadeIn">
<MaterialCommunityIcons name={icon} color="#fff" size={200} /> <MaterialCommunityIcons name={icon} color="#fff" size={200} />
</Animatable.View> </Animatable.View>
</View> </View>
@ -355,6 +361,7 @@ export default class CustomIntroSlider extends React.Component<
getRenderNextButton = (): React.Node => { getRenderNextButton = (): React.Node => {
return ( return (
<Animatable.View <Animatable.View
useNativeDriver
animation="fadeIn" animation="fadeIn"
style={{ style={{
borderRadius: 25, borderRadius: 25,
@ -369,6 +376,7 @@ export default class CustomIntroSlider extends React.Component<
getRenderDoneButton = (): React.Node => { getRenderDoneButton = (): React.Node => {
return ( return (
<Animatable.View <Animatable.View
useNativeDriver
animation="bounceIn" animation="bounceIn"
style={{ style={{
borderRadius: 25, borderRadius: 25,

View file

@ -0,0 +1,12 @@
// @flow
import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet';
export type ListIconPropsType = {
color: string,
style: ViewStyleProp,
};
export type CardTitleIconPropsType = {
size: number,
};

View file

@ -8,6 +8,10 @@ import {StackNavigationProp} from '@react-navigation/stack';
import packageJson from '../../../package.json'; import packageJson from '../../../package.json';
import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList'; import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList';
import APP_LOGO from '../../../assets/android.icon.png'; import APP_LOGO from '../../../assets/android.icon.png';
import type {
CardTitleIconPropsType,
ListIconPropsType,
} from '../../constants/PaperStyles';
type ListItemType = { type ListItemType = {
onPressCallback: () => void, onPressCallback: () => void,
@ -217,9 +221,9 @@ class AboutScreen extends React.Component<PropsType> {
<Card.Title <Card.Title
title="Campus" title="Campus"
subtitle={packageJson.version} subtitle={packageJson.version}
left={({size}: {size: number}): React.Node => ( left={(iconProps: CardTitleIconPropsType): React.Node => (
<Avatar.Image <Avatar.Image
size={size} size={iconProps.size}
source={APP_LOGO} source={APP_LOGO}
style={{backgroundColor: 'transparent'}} style={{backgroundColor: 'transparent'}}
/> />
@ -246,8 +250,8 @@ class AboutScreen extends React.Component<PropsType> {
<Card style={{marginBottom: 10}}> <Card style={{marginBottom: 10}}>
<Card.Title <Card.Title
title={i18n.t('screens.about.team')} title={i18n.t('screens.about.team')}
left={({size, color}: {size: number, color: string}): React.Node => ( left={(iconProps: CardTitleIconPropsType): React.Node => (
<Avatar.Icon size={size} color={color} icon="account-multiple" /> <Avatar.Icon size={iconProps.size} icon="account-multiple" />
)} )}
/> />
<Card.Content> <Card.Content>
@ -296,14 +300,10 @@ class AboutScreen extends React.Component<PropsType> {
* @param props * @param props
* @return {*} * @return {*}
*/ */
static getChevronIcon({ static getChevronIcon(props: ListIconPropsType): React.Node {
size, return (
color, <List.Icon color={props.color} style={props.style} icon="chevron-right" />
}: { );
size: number,
color: string,
}): React.Node {
return <List.Icon size={size} color={color} icon="chevron-right" />;
} }
/** /**
@ -313,11 +313,10 @@ class AboutScreen extends React.Component<PropsType> {
* @param props * @param props
* @return {*} * @return {*}
*/ */
static getItemIcon( static getItemIcon(item: ListItemType, props: ListIconPropsType): React.Node {
item: ListItemType, return (
{size, color}: {size: number, color: string}, <List.Icon color={props.color} style={props.style} icon={item.icon} />
): React.Node { );
return <List.Icon size={size} color={color} icon={item.icon} />;
} }
/** /**
@ -326,7 +325,7 @@ class AboutScreen extends React.Component<PropsType> {
* @returns {*} * @returns {*}
*/ */
getCardItem = ({item}: {item: ListItemType}): React.Node => { getCardItem = ({item}: {item: ListItemType}): React.Node => {
const getItemIcon = (props: {size: number, color: string}): React.Node => const getItemIcon = (props: ListIconPropsType): React.Node =>
AboutScreen.getItemIcon(item, props); AboutScreen.getItemIcon(item, props);
if (item.showChevron) { if (item.showChevron) {
return ( return (

View file

@ -2,11 +2,15 @@
import * as React from 'react'; import * as React from 'react';
import {FlatList, Image, Linking, View} from 'react-native'; import {FlatList, Image, Linking, View} from 'react-native';
import {Card, List, Text, withTheme} from 'react-native-paper'; import {Card, List, Text, withTheme, Avatar} from 'react-native-paper';
import i18n from 'i18n-js'; import i18n from 'i18n-js';
import type {MaterialCommunityIconsGlyphs} from 'react-native-vector-icons/MaterialCommunityIcons'; import type {MaterialCommunityIconsGlyphs} from 'react-native-vector-icons/MaterialCommunityIcons';
import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList'; import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList';
import AMICALE_LOGO from '../../../assets/amicale.png'; import AMICALE_LOGO from '../../../assets/amicale.png';
import type {
CardTitleIconPropsType,
ListIconPropsType,
} from '../../constants/PaperStyles';
type DatasetItemType = { type DatasetItemType = {
name: string, name: string,
@ -74,14 +78,12 @@ class AmicaleContactScreen extends React.Component<null> {
keyExtractor = (item: DatasetItemType): string => item.email; keyExtractor = (item: DatasetItemType): string => item.email;
getChevronIcon = ({ getChevronIcon = (iconProps: ListIconPropsType): React.Node => (
size, <List.Icon
color, color={iconProps.color}
}: { style={iconProps.style}
size: number, icon="chevron-right"
color: string, />
}): React.Node => (
<List.Icon size={size} color={color} icon="chevron-right" />
); );
getRenderItem = ({item}: {item: DatasetItemType}): React.Node => { getRenderItem = ({item}: {item: DatasetItemType}): React.Node => {
@ -92,8 +94,12 @@ class AmicaleContactScreen extends React.Component<null> {
<List.Item <List.Item
title={item.name} title={item.name}
description={item.email} description={item.email}
left={({size, color}: {size: number, color: string}): React.Node => ( left={(iconProps: ListIconPropsType): React.Node => (
<List.Icon size={size} color={color} icon={item.icon} /> <List.Icon
color={iconProps.color}
style={iconProps.style}
icon={item.icon}
/>
)} )}
right={this.getChevronIcon} right={this.getChevronIcon}
onPress={onPress} onPress={onPress}
@ -123,14 +129,8 @@ class AmicaleContactScreen extends React.Component<null> {
<Card.Title <Card.Title
title={i18n.t('screens.amicaleAbout.title')} title={i18n.t('screens.amicaleAbout.title')}
subtitle={i18n.t('screens.amicaleAbout.subtitle')} subtitle={i18n.t('screens.amicaleAbout.subtitle')}
left={({ left={(iconProps: CardTitleIconPropsType): React.Node => (
size, <Avatar.Icon size={iconProps.size} icon="information" />
color,
}: {
size: number,
color: string,
}): React.Node => (
<List.Icon size={size} color={color} icon="information" />
)} )}
/> />
<Card.Content> <Card.Content>

View file

@ -2,11 +2,12 @@
import * as React from 'react'; import * as React from 'react';
import {Image, View} from 'react-native'; import {Image, View} from 'react-native';
import {Card, List, Text, withTheme} from 'react-native-paper'; import {Card, Avatar, Text, withTheme} from 'react-native-paper';
import i18n from 'i18n-js'; import i18n from 'i18n-js';
import Autolink from 'react-native-autolink'; import Autolink from 'react-native-autolink';
import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView'; import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView';
import AMICALE_ICON from '../../../../assets/amicale.png'; import AMICALE_ICON from '../../../../assets/amicale.png';
import type {CardTitleIconPropsType} from '../../../constants/PaperStyles';
const CONTACT_LINK = 'clubs@amicale-insat.fr'; const CONTACT_LINK = 'clubs@amicale-insat.fr';
@ -35,8 +36,8 @@ class ClubAboutScreen extends React.Component<null> {
<Card.Title <Card.Title
title={i18n.t('screens.clubs.about.title')} title={i18n.t('screens.clubs.about.title')}
subtitle={i18n.t('screens.clubs.about.subtitle')} subtitle={i18n.t('screens.clubs.about.subtitle')}
left={({size}: {size: number}): React.Node => ( left={(iconProps: CardTitleIconPropsType): React.Node => (
<List.Icon size={size} icon="information" /> <Avatar.Icon size={iconProps.size} icon="information" />
)} )}
/> />
<Card.Content> <Card.Content>

View file

@ -21,6 +21,7 @@ import type {CustomThemeType} from '../../../managers/ThemeManager';
import {ERROR_TYPE} from '../../../utils/WebData'; import {ERROR_TYPE} from '../../../utils/WebData';
import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView'; import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView';
import type {ApiGenericDataType} from '../../../utils/WebData'; import type {ApiGenericDataType} from '../../../utils/WebData';
import type {CardTitleIconPropsType} from '../../../constants/PaperStyles';
type PropsType = { type PropsType = {
navigation: StackNavigationProp, navigation: StackNavigationProp,
@ -133,9 +134,9 @@ class ClubDisplayScreen extends React.Component<PropsType> {
? i18n.t('screens.clubs.managersSubtitle') ? i18n.t('screens.clubs.managersSubtitle')
: i18n.t('screens.clubs.managersUnavailable') : i18n.t('screens.clubs.managersUnavailable')
} }
left={({size}: {size: number}): React.Node => ( left={(iconProps: CardTitleIconPropsType): React.Node => (
<Avatar.Icon <Avatar.Icon
size={size} size={iconProps.size}
style={{backgroundColor: 'transparent'}} style={{backgroundColor: 'transparent'}}
color={ color={
hasManagers hasManagers

View file

@ -39,9 +39,7 @@ export type RentedDeviceType = {
const LIST_ITEM_HEIGHT = 64; const LIST_ITEM_HEIGHT = 64;
class EquipmentListScreen extends React.Component<PropsType, StateType> { class EquipmentListScreen extends React.Component<PropsType, StateType> {
data: Array<DeviceType>; userRents: null | Array<RentedDeviceType>;
userRents: Array<RentedDeviceType>;
authRef: {current: null | AuthenticatedScreen}; authRef: {current: null | AuthenticatedScreen};
@ -79,11 +77,13 @@ class EquipmentListScreen extends React.Component<PropsType, StateType> {
getUserDeviceRentDates(item: DeviceType): [number, number] | null { getUserDeviceRentDates(item: DeviceType): [number, number] | null {
let dates = null; let dates = null;
this.userRents.forEach((device: RentedDeviceType) => { if (this.userRents != null) {
if (item.id === device.device_id) { this.userRents.forEach((device: RentedDeviceType) => {
dates = [device.begin, device.end]; if (item.id === device.device_id) {
} dates = [device.begin, device.end];
}); }
});
}
return dates; return dates;
} }
@ -123,20 +123,14 @@ class EquipmentListScreen extends React.Component<PropsType, StateType> {
* @returns {*} * @returns {*}
*/ */
getScreen = (data: Array<ApiGenericDataType | null>): React.Node => { getScreen = (data: Array<ApiGenericDataType | null>): React.Node => {
if (data[0] != null) { const [allDevices, userRents] = data;
const fetchedData = data[0]; if (userRents != null) this.userRents = userRents.locations;
if (fetchedData != null) this.data = fetchedData.devices;
}
if (data[1] != null) {
const fetchedData = data[1];
if (fetchedData != null) this.userRents = fetchedData.locations;
}
return ( return (
<CollapsibleFlatList <CollapsibleFlatList
keyExtractor={this.keyExtractor} keyExtractor={this.keyExtractor}
renderItem={this.getRenderItem} renderItem={this.getRenderItem}
ListHeaderComponent={this.getListHeader()} ListHeaderComponent={this.getListHeader()}
data={this.data} data={allDevices != null ? allDevices.devices : null}
/> />
); );
}; };

View file

@ -280,7 +280,7 @@ class EquipmentRentScreen extends React.Component<PropsType, StateType> {
end: getRelativeDateString(end), end: getRelativeDateString(end),
}); });
else else
i18n.t('screens.equipment.bookingDay', { subHeadingText = i18n.t('screens.equipment.bookingDay', {
date: getRelativeDateString(start), date: getRelativeDateString(start),
}); });
if (item != null) { if (item != null) {
@ -408,6 +408,7 @@ class EquipmentRentScreen extends React.Component<PropsType, StateType> {
/> />
<Animatable.View <Animatable.View
ref={this.bookRef} ref={this.bookRef}
useNativeDriver
style={{ style={{
position: 'absolute', position: 'absolute',
bottom: 0, bottom: 0,

View file

@ -25,6 +25,10 @@ import Mascot, {MASCOT_STYLE} from '../../components/Mascot/Mascot';
import ServicesManager, {SERVICES_KEY} from '../../managers/ServicesManager'; import ServicesManager, {SERVICES_KEY} from '../../managers/ServicesManager';
import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList'; import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList';
import type {ServiceItemType} from '../../managers/ServicesManager'; import type {ServiceItemType} from '../../managers/ServicesManager';
import type {
CardTitleIconPropsType,
ListIconPropsType,
} from '../../constants/PaperStyles';
type PropsType = { type PropsType = {
navigation: StackNavigationProp, navigation: StackNavigationProp,
@ -229,11 +233,11 @@ class ProfileScreen extends React.Component<PropsType, StateType> {
<List.Item <List.Item
title={title} title={title}
description={subtitle} description={subtitle}
left={({size}: {size: number}): React.Node => ( left={(props: ListIconPropsType): React.Node => (
<List.Icon <List.Icon
size={size} style={props.style}
icon={icon} icon={icon}
color={field != null ? null : theme.colors.textDisabled} color={field != null ? props.color : theme.colors.textDisabled}
/> />
)} )}
/> />
@ -252,9 +256,9 @@ class ProfileScreen extends React.Component<PropsType, StateType> {
<Card.Title <Card.Title
title={`${this.data.first_name} ${this.data.last_name}`} title={`${this.data.first_name} ${this.data.last_name}`}
subtitle={this.data.email} subtitle={this.data.email}
left={({size}: {size: number}): React.Node => ( left={(iconProps: CardTitleIconPropsType): React.Node => (
<Avatar.Icon <Avatar.Icon
size={size} size={iconProps.size}
icon="account" icon="account"
color={theme.colors.primary} color={theme.colors.primary}
style={styles.icon} style={styles.icon}
@ -305,9 +309,9 @@ class ProfileScreen extends React.Component<PropsType, StateType> {
<Card.Title <Card.Title
title={i18n.t('screens.profile.clubs')} title={i18n.t('screens.profile.clubs')}
subtitle={i18n.t('screens.profile.clubsSubtitle')} subtitle={i18n.t('screens.profile.clubsSubtitle')}
left={({size}: {size: number}): React.Node => ( left={(iconProps: CardTitleIconPropsType): React.Node => (
<Avatar.Icon <Avatar.Icon
size={size} size={iconProps.size}
icon="account-group" icon="account-group"
color={theme.colors.primary} color={theme.colors.primary}
style={styles.icon} style={styles.icon}
@ -334,9 +338,9 @@ class ProfileScreen extends React.Component<PropsType, StateType> {
<Card.Title <Card.Title
title={i18n.t('screens.profile.membership')} title={i18n.t('screens.profile.membership')}
subtitle={i18n.t('screens.profile.membershipSubtitle')} subtitle={i18n.t('screens.profile.membershipSubtitle')}
left={({size}: {size: number}): React.Node => ( left={(iconProps: CardTitleIconPropsType): React.Node => (
<Avatar.Icon <Avatar.Icon
size={size} size={iconProps.size}
icon="credit-card" icon="credit-card"
color={theme.colors.primary} color={theme.colors.primary}
style={styles.icon} style={styles.icon}
@ -366,9 +370,9 @@ class ProfileScreen extends React.Component<PropsType, StateType> {
? i18n.t('screens.profile.membershipPayed') ? i18n.t('screens.profile.membershipPayed')
: i18n.t('screens.profile.membershipNotPayed') : i18n.t('screens.profile.membershipNotPayed')
} }
left={({size}: {size: number}): React.Node => ( left={(props: ListIconPropsType): React.Node => (
<List.Icon <List.Icon
size={size} style={props.style}
color={state ? theme.colors.success : theme.colors.danger} color={state ? theme.colors.success : theme.colors.danger}
icon={state ? 'check' : 'close'} icon={state ? 'check' : 'close'}
/> />
@ -389,13 +393,17 @@ class ProfileScreen extends React.Component<PropsType, StateType> {
this.openClubDetailsScreen(item.id); this.openClubDetailsScreen(item.id);
}; };
let description = i18n.t('screens.profile.isMember'); let description = i18n.t('screens.profile.isMember');
let icon = ({size, color}: {size: number, color: string}): React.Node => ( let icon = (props: ListIconPropsType): React.Node => (
<List.Icon size={size} color={color} icon="chevron-right" /> <List.Icon color={props.color} style={props.style} icon="chevron-right" />
); );
if (item.is_manager) { if (item.is_manager) {
description = i18n.t('screens.profile.isManager'); description = i18n.t('screens.profile.isManager');
icon = ({size}: {size: number}): React.Node => ( icon = (props: ListIconPropsType): React.Node => (
<List.Icon size={size} icon="star" color={theme.colors.primary} /> <List.Icon
style={props.style}
icon="star"
color={theme.colors.primary}
/>
); );
} }
return ( return (

View file

@ -84,6 +84,7 @@ class GameStartScreen extends React.Component<PropsType> {
const animDuration = 2 * (2000 - size * 30); const animDuration = 2 * (2000 - size * 30);
return ( return (
<Animatable.View <Animatable.View
useNativeDriver
animation="fadeInDownBig" animation="fadeInDownBig"
delay={animDelay} delay={animDelay}
duration={animDuration} duration={animDuration}

View file

@ -6,6 +6,7 @@ import i18n from 'i18n-js';
import {Linking} from 'react-native'; import {Linking} from 'react-native';
import type {CustomThemeType} from '../../managers/ThemeManager'; import type {CustomThemeType} from '../../managers/ThemeManager';
import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView'; import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
import type {CardTitleIconPropsType} from '../../constants/PaperStyles';
type PropsType = { type PropsType = {
theme: CustomThemeType, theme: CustomThemeType,
@ -91,14 +92,8 @@ class FeedbackScreen extends React.Component<PropsType> {
<Card.Title <Card.Title
title={i18n.t('screens.feedback.bugs')} title={i18n.t('screens.feedback.bugs')}
subtitle={i18n.t('screens.feedback.bugsSubtitle')} subtitle={i18n.t('screens.feedback.bugsSubtitle')}
left={({ left={(iconProps: CardTitleIconPropsType): React.Node => (
size, <Avatar.Icon size={iconProps.size} icon="bug" />
color,
}: {
size: number,
color: number,
}): React.Node => (
<Avatar.Icon size={size} color={color} icon="bug" />
)} )}
/> />
<Card.Content> <Card.Content>
@ -114,14 +109,8 @@ class FeedbackScreen extends React.Component<PropsType> {
<Card.Title <Card.Title
title={i18n.t('screens.feedback.title')} title={i18n.t('screens.feedback.title')}
subtitle={i18n.t('screens.feedback.feedbackSubtitle')} subtitle={i18n.t('screens.feedback.feedbackSubtitle')}
left={({ left={(iconProps: CardTitleIconPropsType): React.Node => (
size, <Avatar.Icon size={iconProps.size} icon="comment" />
color,
}: {
size: number,
color: number,
}): React.Node => (
<Avatar.Icon size={size} color={color} icon="comment" />
)} )}
/> />
<Card.Content> <Card.Content>

View file

@ -11,6 +11,7 @@ import ThemeManager from '../../../managers/ThemeManager';
import AsyncStorageManager from '../../../managers/AsyncStorageManager'; import AsyncStorageManager from '../../../managers/AsyncStorageManager';
import CustomSlider from '../../../components/Overrides/CustomSlider'; import CustomSlider from '../../../components/Overrides/CustomSlider';
import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView'; import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView';
import type {ListIconPropsType} from '../../../constants/PaperStyles';
type PropsType = { type PropsType = {
navigation: StackNavigationProp, navigation: StackNavigationProp,
@ -171,8 +172,8 @@ class SettingsScreen extends React.Component<PropsType, StateType> {
<List.Item <List.Item
title={title} title={title}
description={subtitle} description={subtitle}
left={({size, color}: {size: number, color: number}): React.Node => ( left={(props: ListIconPropsType): React.Node => (
<List.Icon size={size} color={color} icon={icon} /> <List.Icon color={props.color} style={props.style} icon={icon} />
)} )}
right={(): React.Node => ( right={(): React.Node => (
<Switch value={state} onValueChange={onPressCallback} /> <Switch value={state} onValueChange={onPressCallback} />
@ -196,11 +197,15 @@ class SettingsScreen extends React.Component<PropsType, StateType> {
onPress={() => { onPress={() => {
navigation.navigate(route); navigation.navigate(route);
}} }}
left={({size, color}: {size: number, color: number}): React.Node => ( left={(props: ListIconPropsType): React.Node => (
<List.Icon size={size} color={color} icon={icon} /> <List.Icon color={props.color} style={props.style} icon={icon} />
)} )}
right={({size, color}: {size: number, color: number}): React.Node => ( right={(props: ListIconPropsType): React.Node => (
<List.Icon size={size} color={color} icon="chevron-right" /> <List.Icon
color={props.color}
style={props.style}
icon="chevron-right"
/>
)} )}
onLongPress={onLongPress} onLongPress={onLongPress}
/> />
@ -249,14 +254,12 @@ class SettingsScreen extends React.Component<PropsType, StateType> {
<List.Item <List.Item
title={i18n.t('screens.settings.startScreen')} title={i18n.t('screens.settings.startScreen')}
description={i18n.t('screens.settings.startScreenSub')} description={i18n.t('screens.settings.startScreenSub')}
left={({ left={(props: ListIconPropsType): React.Node => (
size, <List.Icon
color, color={props.color}
}: { style={props.style}
size: number, icon="power"
color: number, />
}): React.Node => (
<List.Icon size={size} color={color} icon="power" />
)} )}
/> />
{this.getStartScreenPicker()} {this.getStartScreenPicker()}
@ -274,14 +277,12 @@ class SettingsScreen extends React.Component<PropsType, StateType> {
<List.Item <List.Item
title={i18n.t('screens.settings.proxiwashNotifReminder')} title={i18n.t('screens.settings.proxiwashNotifReminder')}
description={i18n.t('screens.settings.proxiwashNotifReminderSub')} description={i18n.t('screens.settings.proxiwashNotifReminderSub')}
left={({ left={(props: ListIconPropsType): React.Node => (
size, <List.Icon
color, color={props.color}
}: { style={props.style}
size: number, icon="washing-machine"
color: number, />
}): React.Node => (
<List.Icon size={size} color={color} icon="washing-machine" />
)} )}
/> />
<View style={{marginLeft: 30}}> <View style={{marginLeft: 30}}>

View file

@ -3,9 +3,10 @@
import * as React from 'react'; import * as React from 'react';
import {Image, View} from 'react-native'; import {Image, View} from 'react-native';
import i18n from 'i18n-js'; import i18n from 'i18n-js';
import {Card, List, Paragraph, Text, Title} from 'react-native-paper'; import {Card, Avatar, Paragraph, Text, Title} from 'react-native-paper';
import CustomTabBar from '../../components/Tabbar/CustomTabBar'; import CustomTabBar from '../../components/Tabbar/CustomTabBar';
import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView'; import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
import type {CardTitleIconPropsType} from '../../constants/PaperStyles';
const LOGO = 'https://etud.insa-toulouse.fr/~amicale_app/images/Proxiwash.png'; const LOGO = 'https://etud.insa-toulouse.fr/~amicale_app/images/Proxiwash.png';
@ -35,14 +36,8 @@ export default class ProxiwashAboutScreen extends React.Component<null> {
<Card style={{margin: 5}}> <Card style={{margin: 5}}>
<Card.Title <Card.Title
title={i18n.t('screens.proxiwash.dryer')} title={i18n.t('screens.proxiwash.dryer')}
left={({ left={(iconProps: CardTitleIconPropsType): React.Node => (
size, <Avatar.Icon size={iconProps.size} icon="tumble-dryer" />
color,
}: {
size: number,
color: string,
}): React.Node => (
<List.Icon size={size} color={color} icon="tumble-dryer" />
)} )}
/> />
<Card.Content> <Card.Content>
@ -56,14 +51,8 @@ export default class ProxiwashAboutScreen extends React.Component<null> {
<Card style={{margin: 5}}> <Card style={{margin: 5}}>
<Card.Title <Card.Title
title={i18n.t('screens.proxiwash.washer')} title={i18n.t('screens.proxiwash.washer')}
left={({ left={(iconProps: CardTitleIconPropsType): React.Node => (
size, <Avatar.Icon size={iconProps.size} icon="washing-machine" />
color,
}: {
size: number,
color: string,
}): React.Node => (
<List.Icon size={size} color={color} icon="washing-machine" />
)} )}
/> />
<Card.Content> <Card.Content>
@ -77,14 +66,8 @@ export default class ProxiwashAboutScreen extends React.Component<null> {
<Card style={{margin: 5}}> <Card style={{margin: 5}}>
<Card.Title <Card.Title
title={i18n.t('screens.proxiwash.tariffs')} title={i18n.t('screens.proxiwash.tariffs')}
left={({ left={(iconProps: CardTitleIconPropsType): React.Node => (
size, <Avatar.Icon size={iconProps.size} icon="circle-multiple" />
color,
}: {
size: number,
color: string,
}): React.Node => (
<List.Icon size={size} color={color} icon="circle-multiple" />
)} )}
/> />
<Card.Content> <Card.Content>
@ -96,14 +79,8 @@ export default class ProxiwashAboutScreen extends React.Component<null> {
style={{margin: 5, marginBottom: CustomTabBar.TAB_BAR_HEIGHT + 20}}> style={{margin: 5, marginBottom: CustomTabBar.TAB_BAR_HEIGHT + 20}}>
<Card.Title <Card.Title
title={i18n.t('screens.proxiwash.paymentMethods')} title={i18n.t('screens.proxiwash.paymentMethods')}
left={({ left={(iconProps: CardTitleIconPropsType): React.Node => (
size, <Avatar.Icon size={iconProps.size} icon="cash" />
color,
}: {
size: number,
color: string,
}): React.Node => (
<List.Icon size={size} color={color} icon="cash" />
)} )}
/> />
<Card.Content> <Card.Content>

View file

@ -3,9 +3,10 @@
import * as React from 'react'; import * as React from 'react';
import {Image, View} from 'react-native'; import {Image, View} from 'react-native';
import i18n from 'i18n-js'; import i18n from 'i18n-js';
import {Card, List, Paragraph, Text} from 'react-native-paper'; import {Card, Avatar, Paragraph, Text} from 'react-native-paper';
import CustomTabBar from '../../../components/Tabbar/CustomTabBar'; import CustomTabBar from '../../../components/Tabbar/CustomTabBar';
import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView'; import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView';
import type {CardTitleIconPropsType} from '../../../constants/PaperStyles';
const LOGO = 'https://etud.insa-toulouse.fr/~amicale_app/images/Proximo.png'; const LOGO = 'https://etud.insa-toulouse.fr/~amicale_app/images/Proximo.png';
@ -35,14 +36,8 @@ export default class ProximoAboutScreen extends React.Component<null> {
<Card style={{margin: 5}}> <Card style={{margin: 5}}>
<Card.Title <Card.Title
title={i18n.t('screens.proximo.openingHours')} title={i18n.t('screens.proximo.openingHours')}
left={({ left={(iconProps: CardTitleIconPropsType): React.Node => (
size, <Avatar.Icon size={iconProps.size} icon="clock-outline" />
color,
}: {
size: number,
color: string,
}): React.Node => (
<List.Icon size={size} color={color} icon="clock-outline" />
)} )}
/> />
<Card.Content> <Card.Content>
@ -53,14 +48,8 @@ export default class ProximoAboutScreen extends React.Component<null> {
style={{margin: 5, marginBottom: CustomTabBar.TAB_BAR_HEIGHT + 20}}> style={{margin: 5, marginBottom: CustomTabBar.TAB_BAR_HEIGHT + 20}}>
<Card.Title <Card.Title
title={i18n.t('screens.proximo.paymentMethods')} title={i18n.t('screens.proximo.paymentMethods')}
left={({ left={(iconProps: CardTitleIconPropsType): React.Node => (
size, <Avatar.Icon size={iconProps.size} icon="cash" />
color,
}: {
size: number,
color: string,
}): React.Node => (
<List.Icon size={size} color={color} icon="cash" />
)} )}
/> />
<Card.Content> <Card.Content>

View file

@ -10,6 +10,7 @@ import MaterialHeaderButtons, {
} from '../../../components/Overrides/CustomHeaderButton'; } from '../../../components/Overrides/CustomHeaderButton';
import type {CustomThemeType} from '../../../managers/ThemeManager'; import type {CustomThemeType} from '../../../managers/ThemeManager';
import type {SectionListDataType} from '../../../components/Screens/WebSectionList'; import type {SectionListDataType} from '../../../components/Screens/WebSectionList';
import type {ListIconPropsType} from '../../../constants/PaperStyles';
const DATA_URL = 'https://etud.insa-toulouse.fr/~proximo/data/stock-v2.json'; const DATA_URL = 'https://etud.insa-toulouse.fr/~proximo/data/stock-v2.json';
const LIST_ITEM_HEIGHT = 84; const LIST_ITEM_HEIGHT = 84;
@ -199,15 +200,19 @@ class ProximoMainScreen extends React.Component<PropsType> {
title={item.type.name} title={item.type.name}
description={subtitle} description={subtitle}
onPress={onPress} onPress={onPress}
left={({size}: {size: number}): React.Node => ( left={(props: ListIconPropsType): React.Node => (
<List.Icon <List.Icon
size={size} style={props.style}
icon={item.type.icon} icon={item.type.icon}
color={theme.colors.primary} color={theme.colors.primary}
/> />
)} )}
right={({size, color}: {size: number, color: string}): React.Node => ( right={(props: ListIconPropsType): React.Node => (
<List.Icon size={size} color={color} icon="chevron-right" /> <List.Icon
color={props.color}
style={props.style}
icon="chevron-right"
/>
)} )}
style={{ style={{
height: LIST_ITEM_HEIGHT, height: LIST_ITEM_HEIGHT,

View file

@ -118,9 +118,7 @@ class ServicesScreen extends React.Component<PropsType> {
title={item.title} title={item.title}
subtitle={item.subtitle} subtitle={item.subtitle}
left={(): React.Node => this.getListTitleImage(item.image)} left={(): React.Node => this.getListTitleImage(item.image)}
right={({size}: {size: number}): React.Node => ( right={(): React.Node => <List.Icon icon="chevron-right" />}
<List.Icon size={size} icon="chevron-right" />
)}
/> />
<CardList dataset={item.content} isHorizontal /> <CardList dataset={item.content} isHorizontal />
</View> </View>