Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Add a new usage example for CellMeasurer #1168

Merged
merged 1 commit into from
Jul 12, 2018
Merged
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
18 changes: 16 additions & 2 deletions docs/CellMeasurer.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ It should be configured based on the type of measurements you need. It accepts t
### Prop Types
| Property | Type | Required? | Description |
|:---|:---|:---:|:---|
| defaultHeight | number | | Umeasured cells will initially report this height |
| defaultWidth | number | | Umeasured cells will initially report this width |
| defaultHeight | number | | Unmeasured cells will initially report this height |
| defaultWidth | number | | Unmeasured cells will initially report this width |
| fixedHeight | boolean | | Rendered cells will have a fixed height, dynamic width |
| fixedWidth | boolean | | Rendered cells will have a fixed width, dynamic height |
| minHeight | number | | Derived row height (of multiple cells) should not be less than this value |
Expand Down Expand Up @@ -162,6 +162,20 @@ function renderList (props) {
}
```

###### Using `CellMeasurer` with equal dynamic cell heights or widths

```jsx
// Normally, every cell gets measured individually and is very slow.
// However, with the keyMapper prop we can specify a constant return value and
// tell CellMeasurer that all measurements after the first one will hit the
// cache and we get a speedy solution.
const cache = new CellMeasurerCache({
defaultHeight: 30,
fixedWidth: true,
keyMapper: () => 1,
});
```

### Limitations and Performance Considerations

###### Performance
Expand Down