0.1.0 • Published 8 years ago

@srph/react-infinite-scroll v0.1.0

Weekly downloads
69
License
MIT
Repository
github
Last release
8 years ago

react-infinite-scroll

npm i @srph/react-infinite-scroll

A simple infinite scroll React.js component.

Why

  • I was a bit frustrated with the existing libraries, so I went to come up with a simpler API.
  • I'd like to keep this library simple -- if you're looking for more advanced features and performant implementations, please check react-virtualized and react-infinity.

Usage

<Infinite callback={this.request} disabled={this.state.loading}>
  {this.state.items((item, i) =>
  	<div key={i}>{item.name}</div>
  )}
</Infinite>

API

PropDescriptionType
callbackThe callback to be ran when we reach the offsetfunction (required)
disabledFlag to run callback once we reach the offsetboolean (default: false)
offsetAllowance before reaching the offsetnumber (default: 250)
containerFlag if we're using the window (false) or this div (requires to be scrollable)boolean (default: false)
reverseTrigger callback when we reach the top instead of the bottom. Useful for chat applications.boolean (default: false)

Examples

You can check the demo, or build it yourself:

npm run install
npm run example:run