# react-infinite-any-height

> Wrapper component for react-infinite which auto calculates element heights.

Latest version **2.3.0** (published 2018-03-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-infinite-any-height
pnpm add react-infinite-any-height
yarn add react-infinite-any-height
bun add react-infinite-any-height
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.0 |
| Published | 2018-03-09 |
| First published | 2016-03-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 183.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 41 |
| Author | Reslav Hollos |
| Maintainers | jcgertig, radivarig |
| Keywords | react, reactjs, react-component, infinite, scroll, any, height |

## Links

- npm: https://www.npmjs.com/package/react-infinite-any-height
- Repository: https://github.com/Radivarig/react-infinite-any-height
- Homepage: https://github.com/Radivarig/react-infinite-any-height#readme
- Issues: https://github.com/Radivarig/react-infinite-any-height/issues
- npm.io page: https://npm.io/package/react-infinite-any-height

## Dependencies (2)

- [lodash.isequal](https://npm.io/package/lodash.isequal.md) ^4.5.0
- [react-infinite](https://npm.io/package/react-infinite.md) ^0.12.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.3.0 (latest) — 2018-03-09
- 2.1.2 — 2018-03-09
- 2.1.1 — 2018-03-09
- 2.1.0 — 2018-03-09
- 2.0.2 — 2017-10-24
- 2.0.1 — 2017-07-06
- 2.0.0 — 2017-07-06
- 1.0.4 — 2016-11-28
- 1.0.3 — 2016-03-21
- 1.0.2 — 2016-03-21
- 1.0.1 — 2016-03-21
- 1.0.0 — 2016-03-21

## README

# react-infinite-any-height

[react-infinite](https://github.com/seatgeek/react-infinite) with automatic height calculation.

Try it - [Live Example](https://radivarig.github.io/#/react-infinite-any-height)

### Install

`npm install react-infinite-any-height` (peer dependencies: `react`)

### Demo

Check out [Live Example](https://radivarig.github.io/#/react-infinite-any-height),
or run locally
```bash
git clone git@github.com:Radivarig/react-infinite-any-height.git
npm install
npm run dev
```
navigate to `localhost:8080`

### Usage

```javascript
// ...
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import InfiniteAnyHeight from 'react-infinite-any-height';

class App extends Component {
  constructor() {
    super();

    const list = new Array(10000).fill('').map((x, i) => {
      const height = 100 + Math.round(Math.abs((Math.sin(i) * 250)));
      const style = { height, border: 'solid 1px', backgroundColor: `#${height}` };
      return (
        <div key={i} style={style}>
          Height: { height + 2 }
          <div style={{ textAlign: 'center', color: 'white' }}>
            Item: {i}
          </div>
        </div>
      );
    });

    this.state = { list };
  }

  render() {
    return (
      <InfiniteAnyHeight
        list={this.state.list}
        preloadAdditionalHeight={window.innerHeight*2}
        useWindowAsScrollContainer
      />
    );
  }
}

var elemDiv = document.createElement('div')
document.body.appendChild(elemDiv)
ReactDOM.render(<App/>, elemDiv)
```

All `props` are passed to `react-infinite` as well.
When updating `list` make sure to use `.slice(0)` to change reference.
If `useWindowAsScrollContainer` is ommited, both `containerHeight` and
`scrollContainer` (the node that has the active .scrollTop) props are required.


### License

MIT

---
_Source: https://npm.io/package/react-infinite-any-height · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
