1.0.7 • Published 3 years ago

react-native-custom-alphabetflatlist v1.0.7

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

react-native-custom-alphabetflatlist

A Flatlist with alphabet sidebar.

When the list doesnt have items with letter you pressed on, onPressLetterWithNoMatches is called this.props.onPressLetterWithNoMatches

After the list is scrolled to items with letter you pressed on, onPressLetter is called this.props.onPressLetter

Install

npm install react-native-custom-alphabetflatlist --save

Usage

    import AlphabetFlatList from 'react-native-custom-alphabetflatlist'

    /* inside your render function */
    <AlphabetFlatList
        renderItem={this.renderItem}
        data={names}
        getItemLayout={this.getItemLayout}
        />

Example

Please check the example folder.

npm.io

Props

You can use all the props provided by FlatList.

NameTypeDefaultRequiredDescription
dataarrayYESExpects array of strings. If you are passing array of objects then also use matchFieldName prop.
renderItemfunctionYES
keyExtractorfunction(item, index) => index.toString()
viewabilityConfigobject{ itemVisiblePercentThreshold: 50 }
getItemLayoutfunctionYES
mainFlatListContainerStyleobject{}
alphabetListPropsobject{ alphabetListContainerStyle: {},alphabetButtonStyle: {},selectedAlphabetButtonStyle: {},alphabetTextStyle: {},selectedAlphabetTextStyle: {}}
matchFieldNamestringfalseIf data array contains object then pass a field name whose value you want to show on main list. See Issue #2.