1.5.14-next • Published 3 years ago

flatlist-react v1.5.14-next

Weekly downloads
551
License
MIT
Repository
github
Last release
3 years ago

A helpful react utility component intended to simplify handling rendering list with ease. It can handle grouping, sorting, filtering, searching, sorting, paginating, styling with very simple props.

Build GitHub npm GitHub release (latest by date)


Dear React Native Developer

This is not intended for React-Native usage. Although some features will still work, others will just break your application. Use at your own risk.

Install

Make sure you are running react and react-dom version 16.8.0+.

npm install flatlist-react

How to use

Take in consideration the following list passed to component PeopleList:

// App.jsx
people = [
    {firstName: 'Elson', lastName: 'Correia', info: {age: 24}},
    {firstName: 'John', lastName: 'Doe', info: {age: 18}},
    {firstName: 'Jane', lastName: 'Doe', info: {age: 34}},
    {firstName: 'Maria', lastName: 'Carvalho', info: {age: 22}},
    {firstName: 'Kelly', lastName: 'Correia', info:{age: 23}},
    {firstName: 'Don', lastName: 'Quichote', info: {age: 39}},
    {firstName: 'Marcus', lastName: 'Correia', info: {age: 0}},
    {firstName: 'Bruno', lastName: 'Gonzales', info: {age: 25}},
    {firstName: 'Alonzo', lastName: 'Correia', info: {age: 44}}
  ]

  <PeopleList people={people}/>

Now inside your component file, we create a function renderPerson that will be passed to renderItem:

// PeopleList.jsx
import FlatList from 'flatlist-react';

...

renderPerson = (person, idx) => {
  return (
      <li key={idx}>
        <b>{person.firstName} {person.lastName}</b> (<span>{person.info.age}</span>)
      </li>
  );
}

...

return (
    <ul>
        <FlatList
          list={this.props.people}
          renderItem={this.renderPerson}
          renderWhenEmpty={() => <div>List is empty!</div>}
          sortBy={["firstName", {key: "lastName", descending: true}]}
          groupBy={person => person.info.age > 18 ? 'Over 18' : 'Under 18'}
        />
    </ul>
)

Full Documentation

FeaturesProps / Components
Renderinglist, renderItem, renderWhenEmpty, wrapperHtmlTag, limit, reversed
Render OptimizationrenderOnScroll
Pagination (Infinite Scroll)hasMoreItems, loadMoreItems, paginationLoadingIndicator, paginationLoadingIndicatorPosition
FilteringfilterBy
SearchingsearchTerm, searchBy, searchOnEveryWord, searchMinCharactersCount, searchCaseInsensitive
SortingsortBy, sortCaseInsensitive, sortDescending
GroupinggroupOf, groupBy, groupSeparator, groupSeparatorAtTheBottom, groupReversed, groupSorted, groupSortedBy, groupSortedDescending, groupSortedCaseInsensitive
StylingdisplayGrid, gridGap, minColumnWidth, displayRow, rowGap
scrollToTopscrollToTopButton, scrollToTopOffset, scrollToTopPadding, scrollToTopPosition
ComponentsPlainList
UtilitiessortList, searchList, filterList, groupList, limitList
1.5.15-next

3 years ago

1.5.14-next

3 years ago

1.5.10

3 years ago

1.5.12

3 years ago

1.5.11

3 years ago

1.5.14

3 years ago

1.5.13

3 years ago

1.5.9

3 years ago

1.5.8

3 years ago

1.5.5-next

4 years ago

1.5.3

4 years ago

1.5.2

4 years ago

1.5.1

4 years ago

1.5.4-next

4 years ago

1.5.6-next

4 years ago

1.5.7

4 years ago

1.5.6

4 years ago

1.5.0

5 years ago

1.4.3

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.2

6 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

0.0.0

7 years ago