diff --git a/redux/actions/actionSelection.tsx b/redux/actions/actionSelection.tsx index d91f603..61b57c3 100644 --- a/redux/actions/actionSelection.tsx +++ b/redux/actions/actionSelection.tsx @@ -46,13 +46,22 @@ export const getAllCards = () => { //Have it first fetch data from our starwars url. const options = { method: 'GET', + // headers: { + // 'content-length':'9505', + // 'content-type':'application/json; charset=utf-8', + // 'etag':'W/"74bb-QMT8DIj6saBS1wT4u5WWcEmZAdw"' + // } + + //! Actualisation de l'API (16/03) : headers: { - 'content-length':'9505', - 'content-type':'application/json; charset=utf-8', - 'etag':'W/"74bb-QMT8DIj6saBS1wT4u5WWcEmZAdw"' + 'content-length': '9508', + 'content-type': 'application/json; charset=utf-8', + 'etag': 'W/"74bb-d4gMlMNks7UGES3Jmn6wzUTXaLI"' } }; - const CardsPromise = await fetch('https://us.api.blizzard.com/hearthstone/cards?locale=en_US&access_token=EURTWhjBC2SRb4Ez42BT1kx8R2NcJc07kL', options); + //! Actualisation de l'API (16/03) : + const CardsPromise = await fetch('https://us.api.blizzard.com/hearthstone/cards?locale=en_US&access_token=EU1AbKy9Q7sOUjQYC5AFF1O1JPuoAgCNxk', options); + //const CardsPromise = await fetch('https://us.api.blizzard.com/hearthstone/cards?locale=en_US&access_token=EURTWhjBC2SRb4Ez42BT1kx8R2NcJc07kL', options); //console.log("FETCH") //console.log(CardsPromise) diff --git a/screens/ListScreen.tsx b/screens/ListScreen.tsx index 860c5f4..15a84cf 100644 --- a/screens/ListScreen.tsx +++ b/screens/ListScreen.tsx @@ -1,4 +1,5 @@ -import { StyleSheet, Text, View, Button, TouchableHighlight, ImageBackground } from 'react-native'; + +import { StyleSheet, Text, View, Button, TouchableHighlight, TextInput } from 'react-native'; import { StatusBar } from 'expo-status-bar'; import React, { useState, useEffect } from "react"; import { FlatList } from 'react-native-gesture-handler'; @@ -13,6 +14,11 @@ import { Card } from '../models/Card'; import { Image } from 'react-native'; import { ImageURISource } from 'react-native'; +//* Icons + +//import { BiSearchAlt } from 'react-icons'; + + //@ts-ignore const Item = ({url}) => { // a mettre dans components et definir une props pour passer le param @@ -66,30 +72,32 @@ export default function ListScreen({navigation}){ //https://us.api.blizzard.com/hearthstone/cards/678?locale=en_US + //* Search : + const [searchValue, setSearchValue] = useState(''); + + //@ts-ignore + const filteredList = nList.filter(item => item.name.toLowerCase().includes(searchValue.toLowerCase())); + return ( - {/* } - keyExtractor={item => item.id}/> */} + + setSearchValue(text)} + placeholder="Rechercher une carte..." + /> - - // navigation.navigate("CardsDetails", {"card": item})}> //* mettre la page de detail ici, renvoi a home pour l'instant navigation.navigate("ListFav")}> - - // //{item.name} - // // - // // - - // // - } keyExtractor={(item: Card) => item.id.toString()}/> + } + keyExtractor={(item: Card) => item.id.toString()} + /> @@ -129,5 +137,14 @@ const styles = StyleSheet.create({ }, title: { fontStyle: "italic", + }, + textInput: { + padding: 15, + margin: 5, + width:200, + backgroundColor: '#ffffff', + borderRadius : 15, + shadowColor: 'grey', + textAlign:'center' } });