UNPKG

4.56 kBMarkdownView Raw
1# rc-virtual-list
2
3React Virtual List Component which worked with animation.
4
5[![NPM version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Test coverage][coveralls-image]][coveralls-url] [![node version][node-image]][node-url] [![npm download][download-image]][download-url]
6
7[npm-image]: http://img.shields.io/npm/v/rc-virtual-list.svg?style=flat-square
8[npm-url]: http://npmjs.org/package/rc-virtual-list
9[github-actions-image]: https://github.com/react-component/virtual-list/workflows/CI/badge.svg
10[github-actions-url]: https://github.com/react-component/virtual-list/actions
11[coveralls-image]: https://img.shields.io/codecov/c/github/react-component/virtual-list/master.svg?style=flat-square
12[coveralls-url]: https://codecov.io/gh/react-component/virtual-list
13[node-image]: https://img.shields.io/badge/node.js-%3E=_6.0-green.svg?style=flat-square
14[node-url]: http://nodejs.org/download/
15[download-image]: https://img.shields.io/npm/dm/rc-virtual-list.svg?style=flat-square
16[download-url]: https://npmjs.org/package/rc-virtual-list
17
18## Online Preview
19
20https://virtual-list-react-component.vercel.app/
21
22## Development
23
24```bash
25npm install
26npm start
27open http://localhost:9001/
28```
29
30## Feature
31
32- Support react.js
33- Support animation
34- Support IE11+
35
36## Install
37
38[![rc-virtual-list](https://nodei.co/npm/rc-virtual-list.png)](https://npmjs.org/package/rc-virtual-list)
39
40## Usage
41
42```js
43import List from 'rc-virtual-list';
44
45<List data={[0, 1, 2]} height={200} itemHeight={30} itemKey="id">
46 {index => <div>{index}</div>}
47</List>;
48```
49
50# API
51
52## List
53
54| Prop | Description | Type | Default |
55| ---------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
56| children | Render props of item | (item, index, props) => ReactElement | - |
57| component | Customize List dom element | string \| Component | div |
58| data | Data list | Array | - |
59| disabled | Disable scroll check. Usually used on animation control | boolean | false |
60| height | List height | number | - |
61| itemHeight | Item minium height | number | - |
62| itemKey | Match key with item | string | - |
63| styles | style | { horizontalScrollBar?: React.CSSProperties; horizontalScrollBarThumb?: React.CSSProperties; verticalScrollBar?: React.CSSProperties; verticalScrollBarThumb?: React.CSSProperties; } | - |
64
65`children` provides additional `props` argument to support IE 11 scroll shaking.
66It will set `style` to `visibility: hidden` when measuring. You can ignore this if no requirement on IE.