0.0.23 • Published 5 years ago

react-native-alpha-flat-list v0.0.23

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

React Native Alpha Flat List

A simple and fully customizable React Native component that implements Alphabetical List

Getting Started

$ yarn add react-native-alpha-flat-list

or

$ npm install --save react-native-alpha-flat-list

Example

npm.io

Usage

Import the AlphaFlatList component from react-native-alpha-flat-list and use it like so:

import React from 'react'
import { SafeAreaView, View, Text } from 'react-native'

import AlphaFlatList from 'react-native-alpha-flat-list'

const ITEM_HEIGHT = 20

const items = Array.from({ length: 500 }, () => {
    return {
        id: '_' + Math.random().toString(36).substr(2, 9),
        name: Math.random().toString(36).substring(7).replace(/[0-9]/g, '')
    }
})

const data = items.sort((previous, next) => previous.name.localeCompare(next.name))

export default function App () {
    const renderItem = ({ item }) => (
        <View style={{ height: ITEM_HEIGHT, paddingLeft: 20, }}>
            <Text>{item.name}</Text>
        </View>
    )

    const keyExtractor = ({ id }) => id

    return (
        <SafeAreaView style={{ flex: 1 }}>
            <AlphaFlatList
                data={data}
                initialNumToRender={data.length}
                keyExtractor={keyExtractor}
                renderItem={renderItem}
                itemHeight={ITEM_HEIGHT}
                listStyle={{ paddingLeft: 10 }}
                sidebarLetterStyle={{ fontWeight: 'bold' }}
                sidebarLetterActiveStyle={{ color: 'red' }}
            />
        </SafeAreaView>
    )
}
0.0.23

5 years ago

0.0.22

5 years ago

0.0.20

5 years ago

0.0.21

5 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.15

5 years ago

0.0.16

5 years ago

0.0.17

5 years ago

0.0.14

5 years ago

0.0.10

5 years ago

0.0.11

5 years ago

0.0.12

5 years ago

0.0.13

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago