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

How to add SectionList 's sections in React Native from an array

$
0
0

I have an array of objects called movies (const movies = movie[]). A movie has the following properties:

  movie: {    name: string;    description: string;    date: Date;    duration: number  }

I want to use a RN SectionList component, making sections from the movie.date (Day):

**20 june 2020:**Movie name | description | durationMovie name | description | duration**18 april 2020:**Movie name | description | durationMovie name | description | duration...

How do I make the section and also how do I group my movies' array by date? I'm using lodash, but doing const groupedMovies = groupBy(movies, movie => movie.date); returns a collection and not an array.

ref.: https://reactnative.dev/docs/sectionlist


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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