Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ Name | Type | Default | Description
`itemHeight` | Number | - | Height in pixels of a single item. **You must have a CSS rule that sets the height of each list item to this value.**
`itemBuffer` | Number | 0 | Number of items that should be rendered before and after the visible viewport. Try using this if you have a complex list that suffers from a bit of lag when scrolling.

#### Mapping

`VirtualList` allows a second, optional, parameter, named `mapVirtualToProps`, which functions similarly to [Redux's `mapStateToProps`](https://github.com/reactjs/react-redux/blob/master/docs/api.md#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options). This function can be provided to change the properties passed to `MyList`. Its arguments are:

Name | Description
--- | ---
`props` | Includes all properties passed to `MyVirtualList`
`state` | Includes `firstItemIndex` and `lastItemIndex`; array indexes of the visible bounds of `items`

The default `mapVirtualToProps` can be found [here](/src/utils/defaultMapVirtualToProps.js).

#### Example Usage

Check out [demo/src/app.js](demo/src/app.js) and [demo/src/ConfigurableExample.js](demo/src/ConfigurableExample.js) for the example used in the [demo](http://developerdizzle.github.io/react-virtual-list).
Expand Down
1 change: 1 addition & 0 deletions demo/dist/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions demo/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css" />
<style>
h1, h2 {
font-weight: bold;
}

body {
padding-bottom: 20em;
}
</style>
</head>
<body>
<header class="jumbotron">
<h1 class="container">React Virtual List</h1>
</header>
<main>
<section class="container" id="app">
</section>
</main>

<script src="react.js"></script>
<script src="virtualList.js"></script>
<script src="app.js"></script>

<a href="https://github.com/developerdizzle/react-virtual-list"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://github.com/a6677b08c955af8400f44c6298f40e7d19cc5b2d/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png"></a>
</body>
</html>
24 changes: 24 additions & 0 deletions demo/dist/react.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions demo/dist/virtualList.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading