typescript
Alban GUILHOT 3 years ago
commit ff0194f365

@ -1,13 +0,0 @@
import { FC, ReactNode } from "react"
import { Button, Image, Text, View } from "react-native"
import { Skin } from "../core/Skin"
/*
export const SkinComponent : FC<{skin: Skin, children: ReactNode}> = ({skin, children}) => {
return <View>
<Image source={{uri: skin.source}}/>
<Text>{t}</Text>
</View>
}
*/

@ -0,0 +1,15 @@
import { FC, ReactNode } from "react"
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}) => {
return (
<View>
<Image source={{uri: skin.Source}} style={children}/>
{childrenTest}
</View>
)
}

@ -1,6 +1,6 @@
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;

@ -1,10 +1,15 @@
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';
import { User } from '../../core/user';
import { Skin } from '../../core/skin';
const avatar = require('../../assets/Icons/BobClassic.png'); 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 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 message = require('../../assets/Icons/UnSelected/Chat.png');
const store = require('../../assets/Icons/UnSelected/Store.png'); const store = require('../../assets/Icons/UnSelected/Store.png');
@ -14,10 +19,7 @@ function Home(props: { navigation: any; }) {
<View style={styles.container}> <View style={styles.container}>
<View style={styles.header}> <View style={styles.header}>
<Pressable onPress={() => navigation.navigate('Profile')}> <Pressable onPress={() => navigation.navigate('Profile')}>
<Image <SkinComponent skin={skinTest} children={styles.avatar} childrenTest={<Text>Bite</Text>} />
style={styles.avatar}
source={avatar}
/>
</Pressable> </Pressable>
<Text style={styles.titre}>BOB PARTY</Text> <Text style={styles.titre}>BOB PARTY</Text>
<Pressable onPress={() => navigation.navigate('Settings')}> <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 engrenage = require('../../assets/Icons/UnSelected/Cogs.png');
const gamepad = require('../../assets/Icons/UnSelected/Gamepad.png'); const gamepad = require('../../assets/Icons/UnSelected/Gamepad.png');
const message = require('../../assets/Icons/UnSelected/Chat.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; }) { function Store(props: { navigation: any; }) {
const { navigation } = props const { navigation } = props

Loading…
Cancel
Save