GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - beforesemicolon/flatlist-react: A helpful utility component to handle lists in react like a champ

BranchesTags
Open more actions menu

Latest commit

 

History

574 Commits
574 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
documentation
documentation
 
 
src
src
 
 
tests
tests
 
 
.eslintrc.js
.eslintrc.js
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
.yml
.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
eslint.config.js
eslint.config.js
 
 
jest.config.js
jest.config.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
renovate.json
renovate.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

FlatList React

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

Features Props / Components
Rendering list, renderItem, renderWhenEmpty, wrapperHtmlTag, limit, reversed
Render Optimization renderOnScroll
Pagination (Infinite Scroll) hasMoreItems, loadMoreItems, paginationLoadingIndicator, paginationLoadingIndicatorPosition
Filtering filterBy
Searching searchTerm, searchBy, searchOnEveryWord, searchMinCharactersCount, searchCaseInsensitive
Sorting sortBy, sortCaseInsensitive, sortDescending
Grouping groupOf, groupBy, groupSeparator, groupSeparatorAtTheBottom, groupReversed, groupSorted, groupSortedBy, groupSortedDescending, groupSortedCaseInsensitive
Styling displayGrid, gridGap, minColumnWidth, displayRow, rowGap
scrollToTop scrollToTopButton, scrollToTopOffset, scrollToTopPadding, scrollToTopPosition
Components PlainList
Utilities sortList, searchList, filterList, groupList, limitList

About

A helpful utility component to handle lists in react like a champ

Topics

display-gridfilteringflatlist-reactgroupinginfinite-scrolljavascriptlistpaginated-listreactreact-flatlistrender-scrollreversescroll-to-topsearchingsortingstyled-listtypescriptutility-tool

Resources

Readme
MIT license
Activity
Custom properties

Stars

98 stars

Watchers

3 watching

Forks

16 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.