1.0.0 • Published 8 years ago

patchkit-simple-infinite v1.0.0

Weekly downloads
4
License
GPL-3.0
Repository
github
Last release
8 years ago

Simple Infinite Scroller

Infinite-scrolling container (automatically load more).

SimpleInfinite mimics the interface of react-infinite. The main difference is, it doesnt try to do fancy performance improvements, like hiding offscreen elements. This lets it tolerate elements with heights that aren't precomputed (which react-infinite cant do).

import SimpleInfinite from './index'

const onInfiniteLoad = () => {
  this.setState({ isLoading: true })
  // fetch more...
  this.setState({ items: moreItems, isLoading: false })
}

<SimpleInfinite 
  infiniteLoadBeginBottomOffset={hasLoadedAll ? undefined : 400}
  onInfiniteLoad={onInfiniteLoad}
  isInfiniteLoading={this.state.isLoading}>
  {this.state.items.map(render)}
</SimpleInfinite>