@berlysia/react-virtual-scroll
height cacheable virtual scroll for react
Last updated 4 years ago by berlysia .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @berlysia/react-virtual-scroll 
SYNC missed versions from official npm registry.

react-virtual-scroll

height cacheable virtual scroll for react

Install

Install with npm:

npm install @berlysia/react-virtual-scroll

API

Props

  • id - string

    • Optional.
  • className - string

    • Optional.
  • rowRenderer - (item: any, index: number, vsProps: Props, vsState: State, reportHeight: (item: any, height: number) => JSX.Element)

    • Required.
    • index is the item's index in original array.
    • reportHeight's reference identity is ensured.
    • vsProps is this component's props object.
    • vsState is this component's state object.
  • wrapperComponent: ReactComponent or string

    • Optional. Default is "div".
  • wrapperProps: any

    • Optional. Default is {}.
  • assumedHeight - number

    • Required.
    • For items which have unknown height.
  • heightCache - MapLike

    • Optional.

    • Default is some MapLike object.

    • ES2015 Map is enough for this props.

    • MapLike is...

      interface MapLike {
          has(key: any): boolean;
          get(key: any): any;
          set(key: any, val: any): any;
          clear(): any;
      }
      
  • viewport - HTMLElement or window

    • Optional. Default is window.
  • items - Array<*>

    • Required.
  • itemToCacheKey - (item: any) => any(optional, default = x => x)

    • Optional.
  • bufferSize - number

    • Optional.

Running tests

Install devDependencies and Run npm test. or simply:

npm -d it

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

Copyright © 2016-present berlysia. Licensed under the MIT license.

Current Tags

  • 0.1.2                                ...           latest (4 years ago)

4 Versions

  • 0.1.2                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
  • 0.0.1                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |