- Using npm:
npm install @yoonzm/react-native-alphabet-flat-list --save
- Using Yarn:
yarn add @yoonzm/react-native-alphabet-flat-list
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}
/>
);
}
}
data
(Object) [isRequire] - listData to displayitemHeight
(Number) [isRequire] - itemComponent heightrenderItem
(Function) [isRequire] - itemComponent rendersectionHeaderHeight
(Number) - sectionHeader height; default is 25sectionHeaderComponent
(Component) - sectionHeader