# react-native-section-list-get-item-layout

> This package simplifies constructing the getItemLayout prop for react native SectionLists.

Latest version **2.2.3** (published 2018-05-20) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install react-native-section-list-get-item-layout
pnpm add react-native-section-list-get-item-layout
yarn add react-native-section-list-get-item-layout
bun add react-native-section-list-get-item-layout
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.3 |
| Published | 2018-05-20 |
| First published | 2017-06-26 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 99.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jan Soendermann |
| Maintainers | jsoendermann |

## Links

- npm: https://www.npmjs.com/package/react-native-section-list-get-item-layout
- npm.io page: https://npm.io/package/react-native-section-list-get-item-layout

## Recent versions

- 2.2.3 (latest) — 2018-05-20
- 2.2.2 — 2018-03-06
- 2.2.1 — 2017-12-23
- 2.2.0 — 2017-12-17
- 2.1.0 — 2017-11-07
- 2.0.0 — 2017-07-17
- 1.0.0 — 2017-06-26

## README

# React Native SectionList getItemLayout

This package provides a function that helps you construct the `getItemLayout` function for your `SectionList`s. For an explanation of why this exists, see [this post](https://medium.com/@jsoendermann/sectionlist-and-getitemlayout-2293b0b916fb). It's meant to be used like this:

```javascript
import sectionListGetItemLayout from 'react-native-section-list-get-item-layout'

class MyComponent extends React.Component {
  constructor(props) {
    super(props)

    this.getItemLayout = sectionListGetItemLayout({
      // The height of the row with rowData at the given sectionIndex and rowIndex
      getItemHeight: (rowData, sectionIndex, rowIndex) => sectionIndex === 0 ? 100 : 50,

      // These four properties are optional
      getSeparatorHeight: () => 1 / PixelRatio.get(), // The height of your separators
      getSectionHeaderHeight: () => 20, // The height of your section headers
      getSectionFooterHeight: () => 10, // The height of your section footers
      listHeaderHeight: 40, // The height of your list header
    })
  }

  render() {
    return (
      <SectionList
        {...otherStuff}
        getItemLayout={this.getItemLayout}
      />
    )
  }
}
```

---
_Source: https://npm.io/package/react-native-section-list-get-item-layout · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
