ADD: Ajout du composant skinAvatar

typescript
Thomas Chazot 2 years ago
parent b4b9742955
commit 9060645aa3

@ -3,12 +3,13 @@ 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}> = ({skin, children}) => {
export const SkinComponent : FC<{skin: Skin, children: ImageStyle, childrenTest: ReactNode}> = ({skin, children, childrenTest}) => {
return (
<View>
<Image source={{uri: skin.Source}} style={children}/>
{childrenTest}
</View>
)
}

@ -4,7 +4,7 @@ export class Skin{
constructor(name: string, source:string){
this.Name=name;
this.Source=require(source);
this.Source=source;
}
setSkinName(name: string){

@ -2,10 +2,14 @@ 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';
const avatar = require('../../assets/Icons/BobClassic.png');
const skinTest= new Skin("Bob", '../../assets/Icons/BobClassic.png');
const engrenage = require('../../assets/Icons/UnSelected/Cogs.png');
const gamepad = require('../../assets/Icons/Selected/SGamepad.png');
const gamepad = require('../../assets/Icons/Selected/Gamepad.png');
const message = require('../../assets/Icons/UnSelected/Chat.png');
const store = require('../../assets/Icons/UnSelected/Store.png');
@ -15,10 +19,7 @@ function Home(props: { navigation: any; }) {
<View style={styles.container}>
<View style={styles.header}>
<Pressable onPress={() => Alert.alert('Profil Joueur')}>
<Image
style={styles.avatar}
source={avatar}
/>
<SkinComponent skin={skinTest} children={styles.avatar} childrenTest={<Text>Bite</Text>} />
</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/SStore.png');
const store = require('../../assets/Icons/Selected/Store.png');
function Store(props: { navigation: any; }) {
const { navigation } = props

Loading…
Cancel
Save