diff --git a/App.tsx b/App.tsx index abaa4bc..2cb14a7 100644 --- a/App.tsx +++ b/App.tsx @@ -8,7 +8,7 @@ import StackNavigation from './navigation/StackNavigation'; import { createStackNavigator } from '@react-navigation/stack'; // Import your application store -import store from "./redux/store"; +//import store from "./redux/store"; import { @@ -18,25 +18,25 @@ import { import { Provider } from 'react-redux'; + export default function App() { + //safearea + //mettre le navigateur ayant le princ + return ( + + + + ); + } + // export default function App() { -// //safearea -// //mettre le navigateur ayant le princ // return ( -// -// -// +// <> +// {/* Bind your application store to the Provider store */} +// {/* */} +// +// +// +// {/* */} +// // ); // } - -export default function App() { - return ( - <> - {/* Bind your application store to the Provider store */} - - - - - - - ); -} diff --git a/components/mainComponent.tsx b/components/mainComponent.tsx index 99deaa0..c7e5640 100644 --- a/components/mainComponent.tsx +++ b/components/mainComponent.tsx @@ -2,6 +2,7 @@ import { StatusBar } from 'expo-status-bar'; import { StyleSheet, Text, View, Button } from 'react-native'; import React, { useState } from "react"; +// @ts-ignore export default function Main(props : mainProps){ const [count, setCount] = useState(0); return ( diff --git a/data/ApiDataManager.tsx b/data/ApiDataManager.tsx index 456eff9..a08be79 100644 --- a/data/ApiDataManager.tsx +++ b/data/ApiDataManager.tsx @@ -1,14 +1,14 @@ -class ApiDataManager{ +// export class ApiDataManager{ - public async getCards() : Promise { +// public async getCards() : Promise { - const CardPromise = await fetch('https://omgvamp-hearthstone-v1.p.rapidapi.com/cards') - - const CardListJson = await CardPromise.json(); - const CardList: String[] = Array.of(CardListJson); - return CardList; - } -} +// const CardPromise = await fetch('https://omgvamp-hearthstone-v1.p.rapidapi.com/cards') + +// const CardListJson = await CardPromise.json(); +// const CardList: String[] = Array.of(CardListJson); +// return CardList; +// } +// } diff --git a/data/stub.ts b/data/stub.ts index 7b0a096..af96cf8 100644 --- a/data/stub.ts +++ b/data/stub.ts @@ -1,11 +1,12 @@ -class StubLib { - +import { Card } from "../models/Card" +export class StubLib { + public getCards(): Card[] { const NOUNOURS_LIST : Card[] = [ - new Card("Chewie"), - new Card("Rupert"), - new Card("Ronflex"), + new Card("c1","Chewie"), + new Card("r2","Rupert"), + new Card("a3","Ronflex"), ] return NOUNOURS_LIST } diff --git a/models/Card.tsx b/models/Card.tsx index eaf6ab1..ea3c82e 100644 --- a/models/Card.tsx +++ b/models/Card.tsx @@ -1,15 +1,165 @@ -class Card { +import {isValidNumber} from "react-native-gesture-handler/lib/typescript/web_hammer/utils"; - constructor(name :string) { +export class Card { + + constructor(id: string,name :string,set : string,type : string,faction : string,rarity : string,cost : number,attack : number, health : number, desc : string,flavor : string,artist : string,collectible : boolean,elite : boolean,race : string, img : string, imgGold : string) { + this._id=id this._name=name + this._set=set + this._type=type + this._faction=faction + this._rarity=rarity + this._cost=cost + this._attack = attack + this._health = health + this._desc = desc + this._flavor = flavor + this._artist = artist + this._collectible = collectible + this._elite = elite + this._race = race + this._img = img + this._imgGold = imgGold + + } + + // ID // + + private _id : string; + get id(): string { + return this._id + } + + // NAME // + private _name : string; + get name(): string { + return this._name; + } + set name(value: string) { + this._name = value; + } + + + private _set : string; + get set(): string{ + return this._set + } + + set set(value : string){ + this._set = value + } + + private _type : string; + get type():string{ + return this._type + } + set type(value : string){ + this._type=value + } + + private _faction : string; + + get faction():string{ + return this._faction } - get name(): string { - return this._name; + set faction(value : string){ + this._faction=value } + private _rarity : string - set name(value: string) { - this._name = value; + get rarity(): string { + return this._rarity; } - private _name : string; + + set rarity(value: string) { + this._rarity = value ; + } + private _cost : number + + get cost(): number { + return this._cost; + } + set cost(value: number) { + this._cost = value ; + } + + private _attack : number + get attack(): number { + return this._attack; + } + set attack(value: number) { + this._attack = value ; + } + private _health : number + get health(): number { + return this._health; + } + set health(value: number) { + this._health = value ; + } + private _desc : string + get desc(): string { + return this._desc; + } + set desc(value: string) { + this._desc = value ; + } + + private _flavor : string + + get flavor(): string { + return this._flavor; + } + set flavor(value: string) { + this._flavor = value ; + } + + private _artist : string + get artist(): string { + return this._artist; + } + set artist(value: string) { + this._artist = value ; + } + private _collectible : boolean + get collectible(): boolean { + return this._collectible; + } + set collectible(value: boolean ){ + this._collectible = value; + } + private _elite : boolean + get elite(): boolean { + return this._elite; + } + set elite(value: boolean) { + this._elite = value ; + } + + private _race : string + get race(): string { + return this._race; + } + set race(value: string) { + this._race = value ; + } + + + private _img : string + + get img(): string { + return this._img; + } + set img(value: string) { + this._img = value ; + } + private _imgGold : string + + get imgGold(): string { + return this._imgGold; + } + set imgGold(value: string) { + this._imgGold = value ; + } } \ No newline at end of file diff --git a/package.json b/package.json index 8efe27b..6978a11 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "react-dom": "18.1.0", "react-native": "0.70.5", "react-native-gesture-handler": "~2.8.0", - "react-native-safe-area-context": "^4.5.0", + "react-native-safe-area-context": "4.4.1", "react-native-web": "~0.18.9", "react-redux": "^8.0.5", "redux": "^4.2.1" diff --git a/redux/actions/action.tsx b/redux/actions/action.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/redux/constants.tsx b/redux/constants.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/redux/reducers/appReducer.tsx b/redux/reducers/appReducer.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/redux/store.tsx b/redux/store.tsx deleted file mode 100644 index dc655fa..0000000 --- a/redux/store.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import {configureStore} from '@reduxjs/toolkit' -import appReducer from './reducers/appReducer'; - -// Reference here all your application reducers -const reducer = { - appReducer: appReducer, -} - -// @ts-ignore -const store = configureStore({ - reducer, -},); - -export default store; \ No newline at end of file diff --git a/screens/ListScreen.tsx b/screens/ListScreen.tsx index 9bf009c..e16d635 100644 --- a/screens/ListScreen.tsx +++ b/screens/ListScreen.tsx @@ -3,34 +3,8 @@ import { StyleSheet, Text, View, Button } from 'react-native'; import { StatusBar } from 'expo-status-bar'; import React, { useState } from "react"; import { FlatList } from 'react-native-gesture-handler'; - - -export const DATA = [ - { - id: '1', - title: "premier élément", - }, - { - id: '2', - title: "second élément", - }, - { - id: '3', - title: "élément", - }, - { - id: '4', - title: "Rick", - }, - { - id: '5', - title: "Corentin", - }, - { - id: '10', - title: "dernier élément", - }, -]; +import { StubLib } from '../data/stub'; +import { Card } from '../models/Card'; //@ts-ignore const Item = ({title}) => ( @@ -39,23 +13,23 @@ const Item = ({title}) => ( ); -export default async function Main() { +export default function Main() { const [count, setCount] = useState(0); const {getCards} = new StubLib(); const list: Card[] = getCards(); + const req = fetch('https://omgvamp-hearthstone-v1.p.rapidapi.com/cards') + + return ( - - Maman, prend la caméra ! ! - - {count} - {list.at(0)?.name} -