FIX: changement du type de la source des skin pour pouvoir l'afficher

stub-api
Thomas Chazot 3 years ago
parent ff0194f365
commit c15c463793

@ -3,13 +3,12 @@ import { Button, Image, ImageStyle, Text, View } from "react-native"
import { Skin } from "../core/Skin"
import React from "react"
export const SkinComponent : FC<{skin: Skin, children: ImageStyle, childrenTest: ReactNode}> = ({skin, children, childrenTest}) => {
export const SkinComponent : FC<{skin: Skin, children: ImageStyle}> = ({skin, children}) => {
console.log(skin.getSkinSource());
return (
<View>
<Image source={{uri: skin.Source}} style={children}/>
{childrenTest}
<Image source={ skin.getSkinSource()} style={children}/>
</View>
)
}

@ -1,8 +1,10 @@
import { ImageURISource } from "react-native";
export class Skin{
private Name: string;
Source: string;
private Source: any;
constructor(name: string, source:string){
constructor(name: string, source:any){
this.Name=name;
this.Source=source;
}
@ -11,7 +13,7 @@ export class Skin{
this.Name=name;
}
setSkinSource(source: string){
setSkinSource(source: any){
this.Source=source;
}

@ -1,15 +1,15 @@
import { StatusBar } from 'expo-status-bar'
import { StyleSheet, View, Text, Alert, Pressable, Image} from 'react-native'
import React from 'react';
import { SkinComponent } from '../../components/skinAvatar';
import { User } from '../../core/user';
import { Skin } from '../../core/skin';
import { SkinComponent } from '../components/skinAvatar';
import { User } from '../core/user';
import { Skin } from '../core/skin';
const avatar = require('../../assets/Icons/BobClassic.png');
const skinTest= new Skin("Bob", '../../assets/Icons/BobClassic.png');
const skinTest= new Skin("Bob",require('../../assets/Icons/BobClassic.png'));
const engrenage = require('../../assets/Icons/UnSelected/Cogs.png');
const gamepad = require('../../assets/Icons/Selected/Gamepad.png');
const gamepad = require('../../assets/Icons/Selected/SGamepad.png');
const message = require('../../assets/Icons/UnSelected/Chat.png');
const store = require('../../assets/Icons/UnSelected/Store.png');
@ -19,7 +19,7 @@ function Home(props: { navigation: any; }) {
<View style={styles.container}>
<View style={styles.header}>
<Pressable onPress={() => navigation.navigate('Profile')}>
<SkinComponent skin={skinTest} children={styles.avatar} childrenTest={<Text>Bite</Text>} />
<SkinComponent skin={skinTest} children={styles.avatar} />
</Pressable>
<Text style={styles.titre}>BOB PARTY</Text>
<Pressable onPress={() => navigation.navigate('Settings')}>

@ -6,7 +6,7 @@ const avatar = require('../../assets/Icons/BobClassic.png');
const engrenage = require('../../assets/Icons/UnSelected/Cogs.png');
const gamepad = require('../../assets/Icons/UnSelected/Gamepad.png');
const message = require('../../assets/Icons/UnSelected/Chat.png');
const store = require('../../assets/Icons/Selected/Store.png');
const store = require('../../assets/Icons/Selected/SStore.png');
function Store(props: { navigation: any; }) {
const { navigation } = props

Loading…
Cancel
Save