fix proximo images

This commit is contained in:
Arnaud Vergnet 2021-05-10 20:55:00 +02:00
parent 63722c2417
commit a8dde29654
4 changed files with 18 additions and 10 deletions

View file

@ -44,8 +44,6 @@ const styles = StyleSheet.create({
}); });
function ProximoListItem(props: PropsType) { function ProximoListItem(props: PropsType) {
// console.log(Urls.proximo.images + props.item.image);
return ( return (
<List.Item <List.Item
title={props.item.name} title={props.item.name}

View file

@ -28,7 +28,7 @@ const AMICALE_ENDPOINT = AMICALE_SERVER + 'api/';
const APP_ENDPOINT = STUDENT_SERVER + '~amicale_app/v2/'; const APP_ENDPOINT = STUDENT_SERVER + '~amicale_app/v2/';
const PROXIMO_ENDPOINT = STUDENT_SERVER + '~proximo/v2/api/'; const PROXIMO_ENDPOINT = STUDENT_SERVER + '~proximo/v2/api/';
const PROXIMO_IMAGES_ENDPOINT = const PROXIMO_IMAGES_ENDPOINT =
STUDENT_SERVER + '~proximo/v2/api-proximo/public/storage/app/'; STUDENT_SERVER + '~proximo/api_proximo/storage/app/public/';
const APP_IMAGES_ENDPOINT = STUDENT_SERVER + '~amicale_app/images/'; const APP_IMAGES_ENDPOINT = STUDENT_SERVER + '~amicale_app/images/';
export default { export default {

View file

@ -249,7 +249,10 @@ function ProximoListScreen(props: Props) {
<ScrollView> <ScrollView>
<View style={styles.modalContent}> <View style={styles.modalContent}>
<Image style={styles.image} source={{ uri: item.image }} /> <Image
style={styles.image}
source={{ uri: Urls.proximo.images + item.image }}
/>
</View> </View>
<Text>{item.description}</Text> <Text>{item.description}</Text>
</ScrollView> </ScrollView>
@ -330,9 +333,6 @@ function ProximoListScreen(props: Props) {
data: ArticlesType | undefined data: ArticlesType | undefined
): SectionListDataType<ProximoArticleType> => { ): SectionListDataType<ProximoArticleType> => {
if (data) { if (data) {
console.log(data);
console.log(props.route.params.category);
return [ return [
{ {
title: '', title: '',

View file

@ -19,18 +19,19 @@
import * as React from 'react'; import * as React from 'react';
import i18n from 'i18n-js'; import i18n from 'i18n-js';
import { Avatar, List, useTheme, withTheme } from 'react-native-paper'; import { List, useTheme, withTheme } from 'react-native-paper';
import WebSectionList from '../../../components/Screens/WebSectionList'; import WebSectionList from '../../../components/Screens/WebSectionList';
import MaterialHeaderButtons, { import MaterialHeaderButtons, {
Item, Item,
} from '../../../components/Overrides/CustomHeaderButton'; } from '../../../components/Overrides/CustomHeaderButton';
import type { SectionListDataType } from '../../../components/Screens/WebSectionList'; import type { SectionListDataType } from '../../../components/Screens/WebSectionList';
import { StyleSheet } from 'react-native'; import { Image, StyleSheet } from 'react-native';
import Urls from '../../../constants/Urls'; import Urls from '../../../constants/Urls';
import { readData } from '../../../utils/WebData'; import { readData } from '../../../utils/WebData';
import { useNavigation } from '@react-navigation/core'; import { useNavigation } from '@react-navigation/core';
import { useLayoutEffect } from 'react'; import { useLayoutEffect } from 'react';
import { useCachedProximoCategories } from '../../../utils/cacheContext'; import { useCachedProximoCategories } from '../../../utils/cacheContext';
import GENERAL_STYLES from '../../../constants/Styles';
const LIST_ITEM_HEIGHT = 84; const LIST_ITEM_HEIGHT = 84;
@ -63,6 +64,12 @@ const styles = StyleSheet.create({
item: { item: {
justifyContent: 'center', justifyContent: 'center',
}, },
avatar: {
marginLeft: 5,
...GENERAL_STYLES.centerVertical,
height: 35,
width: 35,
},
}); });
function sortCategories( function sortCategories(
@ -172,7 +179,10 @@ function ProximoMainScreen() {
onPress={onPress} onPress={onPress}
left={(props) => left={(props) =>
item.icon.endsWith('.png') ? ( item.icon.endsWith('.png') ? (
<Avatar.Image style={props.style} source={{ uri: item.icon }} /> <Image
style={{ ...props.style, ...styles.avatar }}
source={{ uri: Urls.proximo.icons + item.icon }}
/>
) : ( ) : (
<List.Icon <List.Icon
style={props.style} style={props.style}