You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.3 KiB
87 lines
2.3 KiB
|
|
import { StyleSheet, Text, View, Button, TouchableHighlight, TextInput, ImageBackground } from 'react-native';
|
|
import { StatusBar } from 'expo-status-bar';
|
|
import React, { useState, useEffect } from "react";
|
|
import { FlatList } from 'react-native-gesture-handler';
|
|
import {useDispatch, useSelector} from 'react-redux';
|
|
import { FontAwesome } from '@expo/vector-icons';
|
|
import { ThunkAction } from 'redux-thunk';
|
|
|
|
|
|
//? possiblement à supprimer
|
|
import { getAllCards } from "../redux/actions/actionSelection"
|
|
import { Card } from '../models/Card';
|
|
import { Image } from 'react-native';
|
|
import { ImageURISource } from 'react-native';
|
|
import Item from '../components/ListItemComponent';
|
|
|
|
//* Icons
|
|
// import { BiSearchAlt } from 'react-icons';
|
|
|
|
//* Components
|
|
|
|
|
|
|
|
|
|
//@ts-ignore
|
|
export default function ListScreen({navigation}){
|
|
|
|
//@ts-ignore
|
|
var nList : Card[] = useSelector(state => state.appReducer.favoriteCards);
|
|
console.log(" favs : ",nList)
|
|
|
|
const [searchValue, setSearchValue] = useState('');
|
|
|
|
const filteredList = nList.filter(item => item.name.toLowerCase().includes(searchValue.toLowerCase()));
|
|
|
|
|
|
return (
|
|
<View style={styles.container}>
|
|
|
|
<TextInput
|
|
style={styles.textInput}
|
|
value={searchValue}
|
|
onChangeText={text => setSearchValue(text)}
|
|
placeholder="Rechercher une carte..."
|
|
/>
|
|
|
|
<FlatList
|
|
numColumns={2}
|
|
data={filteredList}
|
|
renderItem={({item}) =>
|
|
<TouchableHighlight onPress={() => navigation.navigate("ListFav")}>
|
|
<Item route={{
|
|
card: item,
|
|
bool: true
|
|
}} />
|
|
</TouchableHighlight>
|
|
}
|
|
keyExtractor={(item: Card) => item.id}
|
|
/>
|
|
</View>
|
|
|
|
|
|
);
|
|
}
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
backgroundColor: '#ac9585',
|
|
alignItems: 'center',
|
|
justifyContent: 'space-evenly',
|
|
|
|
},
|
|
textInput: {
|
|
padding: 15,
|
|
margin: 5,
|
|
width:200,
|
|
backgroundColor: '#ffffff',
|
|
borderRadius : 15,
|
|
shadowColor: 'grey',
|
|
textAlign:'center'
|
|
}
|
|
});
|