From 608e976cfc5c886f90ebfc4988f6d416160b0cb2 Mon Sep 17 00:00:00 2001 From: alguilhot Date: Sun, 16 Oct 2022 11:47:23 +0200 Subject: [PATCH] ADD: ajout du skinComponent dans les screens --- bob_party/src/screens/Profile.tsx | 21 ++++++-- bob_party/src/screens/Store.tsx | 27 ++++++---- bob_party/src/screens/Test.tsx | 82 ++++++------------------------- 3 files changed, 49 insertions(+), 81 deletions(-) diff --git a/bob_party/src/screens/Profile.tsx b/bob_party/src/screens/Profile.tsx index a0b55a7..2c1e652 100644 --- a/bob_party/src/screens/Profile.tsx +++ b/bob_party/src/screens/Profile.tsx @@ -5,8 +5,17 @@ import stylesScreen from './style/screens.style' import { Skin } from '../core/skin'; import { TopBar } from '../components/TopBar'; import { BotBar } from '../components/BotBar'; +import { FlatList } from 'react-native-gesture-handler'; +import { SkinComponent } from '../components/Skin'; + +const skinTest = new Skin("Bob",require('../../assets/BobsSkins/BobClassic.png')); +const skinBleu = new Skin("Bob Bleu", require('../../assets/BobsSkins/BobBlue.png')) +const skinBW = new Skin("Bob BW", require('../../assets/BobsSkins/BobBW.png')) +const skinGreen = new Skin("Bob Vert", require('../../assets/BobsSkins/BobGreen.png')) +const skinPT = new Skin("Bob R&T", require('../../assets/BobsSkins/BobPinkTurquoise.png')) + +let listSkin: Array = [skinTest, skinBleu, skinBW, skinGreen, skinPT] -const skinTest= new Skin("Bob",require('../../assets/Icons/BobClassic.png')); function Profile(props: { navigation: any; }) { const { navigation } = props @@ -17,7 +26,12 @@ function Profile(props: { navigation: any; }) { nav={navigation} /> - couille + item.getSkinName()} + renderItem={({item}) => } /> = [skinTest, skinBleu, skinBW, skinGreen, skinPT] + + function Store(props: { navigation: any; }) { const { navigation } = props @@ -19,12 +29,12 @@ function Store(props: { navigation: any; }) { nav={navigation} /> - + item.getSkinName()} + renderItem={({item}) => } /> = [skinTest, skinBleu, skinBW, skinGreen, skinPT] function Test(props: { navigation: any; }) { const { navigation } = props - const [skin, setSkin] = useState([ - { name : 'BobClassic', image: BobClassic, price: 0, id: 's0001'}, - { name : 'BobBW', image: BobBW, price: 150, id: 's0002'}, - { name : 'BobBlue', image: BobBlue, price: 200, id: 's0003'}, - { name : 'BobGreen', image: BobGreen, price: 200, id: 's0004'}, - ]); - const ItemSeprator = () => return ( - - + item.id } - data={skin} - ItemSeparatorComponent={ItemSeprator} - renderItem={({ item }) => ( - - {item.price} - {item.name} - - )} - /> + columnWrapperStyle={{ flex: 1, justifyContent: "space-around"}} + keyExtractor={item =>item.getSkinName()} + renderItem={({item}) => } /> ); } -const styles = StyleSheet.create({ - imageWrapper: { - height: 200, - width: 200, - overflow : "hidden" - }, - theImage: { - flex: 1, - alignItems: "flex-end", - margin: 10, - width: "100%", - height: "100%", - }, - container: { - backgroundColor: '#45444E', - flex: 1, - paddingTop: "50%", - paddingBottom: "50%", - alignItems: 'center', - justifyContent: 'center', - height: '100%', - }, - Text: { - margin: 15, - paddingVertical: 12, - width: '40%', - borderRadius: 10, - backgroundColor: '#0085FF', - }, - item: { - marginTop: 24, - backgroundColor: 'pink', - fontSize: 24, - }, - debug:{ - flex: 0.2, - backgroundColor: "red", - padding: 50, - }, -}); - export default Test \ No newline at end of file