Ajout du component SkinAvatar

typescript
Thomas Chazot 3 years ago
parent db8de28d34
commit b4b9742955

@ -1,13 +1,14 @@
import { FC, ReactNode } from "react" import { FC, ReactNode } from "react"
import { Button, Image, Text, View } from "react-native" import { Button, Image, ImageStyle, Text, View } from "react-native"
import { Skin } from "../core/Skin" 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: ReactNode}> = ({skin, children}) => {
return <View>
<Image source={{uri: skin.source}}/> return (
<Text>{t}</Text> <View>
<Image source={{uri: skin.Source}} style={children}/>
</View> </View>
} )
*/ }

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

@ -1,6 +1,7 @@
import { StatusBar } from 'expo-status-bar' import { StatusBar } from 'expo-status-bar'
import { StyleSheet, View, Text, Alert, Pressable, Image} from 'react-native' import { StyleSheet, View, Text, Alert, Pressable, Image} from 'react-native'
import React from 'react'; import React from 'react';
import { SkinComponent } from '../../components/skinAvatar';
const avatar = require('../../assets/Icons/BobClassic.png'); const avatar = require('../../assets/Icons/BobClassic.png');
const engrenage = require('../../assets/Icons/UnSelected/Cogs.png'); const engrenage = require('../../assets/Icons/UnSelected/Cogs.png');

Loading…
Cancel
Save