Skip to content

Latest commit

 

History

History
58 lines (46 loc) · 1.64 KB

README.md

File metadata and controls

58 lines (46 loc) · 1.64 KB

   react-native-alphabet-flat-list    react-native-alphabet-flat-list

Alphabet FlatList

Installation

  • Using npm: npm install @yoonzm/react-native-alphabet-flat-list --save
  • Using Yarn: yarn add @yoonzm/react-native-alphabet-flat-list

Example

import React, { Component } from 'react';
import { Text, View } from 'react-native';
import SWAlphabetFlatList from '@yoonzm/react-native-alphabet-flat-list';

const CONTACTS = {
  A: ['Any', 'Avatar'],
  B: ['Basketball', 'Big']
};

const ITEM_HEIGHT = 50;

class Example extends Component {
  render() {
    return (
      <SWAlphabetFlatList
        data={CONTACTS}
        renderItem={({ item }) => (
          <View style={{ height: ITEM_HEIGHT }}>
            <Text>{item}</Text>
          </View>
        )}
        itemHeight={ITEM_HEIGHT}
      />
    );
  }
}

Props

  • data(Object) [isRequire] - listData to display
  • itemHeight(Number) [isRequire] - itemComponent height
  • renderItem(Function) [isRequire] - itemComponent render
  • sectionHeaderHeight(Number) - sectionHeader height; default is 25
  • sectionHeaderComponent(Component) - sectionHeader

License