1.0.8 • Published 5 years ago

sectionlist-get-itemlayout v1.0.8

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

React Native SectionList getItemLayout

This package provides a function that helps you construct the getItemLayout function for your SectionLists. It's interface is based on react-native-section-list-get-item-layout. It's meant to be used like this:

import sectionListGetItemLayout from 'sectionlist-get-item-layout';

class MyComponent extends React.Component {

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

      // These five properties are optional
      getSeparatorHeight: () => 1, // The height of your separators between items
      getSectionHeaderHeight: () => 20, // The height of your section headers
      getSectionFooterHeight: () => 10, // The height of your section footers
      listHeaderHeight: 40, // The height of your header
      listFooterHeight: 20, // The height of your footer
    });

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

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago