1.0.1 • Published 5 years ago

ob-infinite-scroller v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

react-infinite-scroller

image

Installation

npm i ob-infinite-scroller

OR

yarn add ob-infinite-scroller

you can run demo with npm start

How to use

import Scroller from 'ob-infinite-scroller'

const App = () => {
  const height = 400
  const itemHeight = 60
  const data = Array.from({ length: 1000 }).map((_, index) => index + 1)
  const itemCreater = index => (
    <p key={index} onClick={() => console.log(index)}>
      {index}
    </p>
  )

  return (
    <div className="wrap">
      <p>React Infinite Scroller Demo</p>
      <Scroller
        height={height}
        itemHeight={itemHeight}
        data={data}
        itemCreater={itemCreater}
      />
    </div>
  )
}

Props

NameTypeDefaultDescription
itemHeightnumber0item's height
heightnumber0wrapper's height
dataany[][]your data array
itemCreaterReact.Componentvoidgenerate items with data
rootIdstring--
stylesstyle object--
classNamestring--