Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How to filter FlatList Data by selecting multiple categories from array in react native?

$
0
0

UI Image

Here, I want to filter Flatlist data as per top categories and button should be multi-selected.

FlatList data is HotelData array and above categories is also one array that is used inside scrollview using map function.

so by selecting multiple categories i want to filter Flatlist data, so if anyone has done this task, please help me for the same.

const HotelData = [{  id: '1',  img: require('../Assets/UIPracticeImage/H1.jpg'),  name: 'Chef Vincent',  desc: 'Lorem ipsum dolor sit amet aliquon sciscilant',  tag: 'Toutes possibilities',  compareKey: 1,},{  id: '2',  img: require('../Assets/UIPracticeImage/H2.jpg'),  name: 'Pine hill green caben',  desc: 'Lorem ipsum dolor sit amet aliquon sciscilant',  tag: 'Restaurants',  compareKey: 2,},{  id: '3',  img: require('../Assets/UIPracticeImage/H3.jpg'),  name: 'Sky Palace',  desc: 'Lorem ipsum dolor sit amet aliquon sciscilant',  tag: 'Restaurants',  compareKey: 2,},{  id: '4',  img: require('../Assets/UIPracticeImage/H4.jpg'),  name: 'Green leaf',  desc: 'Lorem ipsum dolor sit amet aliquon sciscilant',  tag: 'Toutes possibilities',  compareKey: 1,},{  id: '5',  img: require('../Assets/UIPracticeImage/H1.jpg'),  name: 'Pine green leaf',  desc: 'Lorem ipsum dolor sit amet aliquon sciscilant',  tag: 'Bars',  compareKey: 3, },];const [categories, setCategories] = useState([  {name: 'Toutes possibilités', key: 1, isCheck: false, compareKey: 1},  {name: 'Restaurantes', key: 2, isCheck: false, compareKey: 2},  {name: 'Bars', key: 3, isCheck: false, compareKey: 3},]);

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>