1.0.2 • Published 1 year ago

react-native-nest-alphabet-list v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Installation

  • Using npm: npm install react-native-nest-alphabet-list --save
  • Using Yarn: yarn add react-native-nest-alphabet-list

Example

import React, {Fragment} from 'react';
import {StatusBar, Text, View} from 'react-native';
import AlphabetFlatList from "react-native-nest-alphabet-list";
import ContactItem, {CONTACT_ITEM_HEIGHT, IContact} from "./ContactItem";

...

const HEADER_HEIGHT = 50;

const App = () => {
  return (
    <Fragment>
      <StatusBar barStyle="dark-content"/>
      <AlphabetFlatList<IContact>
        data={data}
        itemHeight={CONTACT_ITEM_HEIGHT}
        headerHeight={HEADER_HEIGHT}
        renderItem={ContactItem}
        ListHeaderComponent={(
          <View style={{
            height: HEADER_HEIGHT,
            justifyContent: 'center',
            alignItems: 'center'
          }}>
            <Text>ListHeaderComponent</Text>
          </View>
        )}
      />
    </Fragment>
  );
};

Detail

Props

  • data(Object) isRequire - listData to display
  • itemHeight(Number) isRequire - itemComponent height
  • renderItem(Function) isRequire - itemComponent render
  • sectionHeaderHeight(Number) - sectionHeader height; default is 25
  • renderSectionHeader(Function) - sectionHeader
  • ListHeaderComponent(Function) - ListHeader
  • alphabetToast(Boolean) - click on the letter to prompt

License