0.1.5 • Published 4 years ago

rn-extended-flatlist v0.1.5

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

rn-extended-flatlist

Helps you write better React Native lists. getItemLayout is implemented out of the box, with default ListEmptyComponent and ItemSeparatorComponent.

Example Usage

import React from 'react';
import {Text} from 'react-native';
import {ExtendedFlatList} from 'rn-extended-flatlist';

const MyList = () => (
  <ExtendedFlatList
    data={[1, 2, 3]}
    listItemHeight={100}
    emptyListMessage="Whoops! Nothing to show"
    keyExtractor={(item) => String(item)}
    renderItem={({item}) => <Text style={{height: 100}}>{item}</Text>}
  />
);

export default MyList;

<ExtendedFlatList /> props

PropsTypeDescriptionDefault Value
emptyListMessagestringMessage to show when no items available."Empty List"
listItemHeightnumberWhen provided, `getItemLayout` will be automatically implemented. | undefined
noItemSeparatorbooleanHides `ItemSeparatorComponent` | false
noEmptyListMessagebooleanHides `ListEmptyComponent` | false

<EmptyListMessage /> props

PropsTypeDescriptionDefault Value
messagestringMessage to show when no items available."Empty List"
textStyleTextStyleCustom style for the message.undefined
containerStyleViewStyleCustom style for the container.undefined

<ItemSeparator /> props

The same props as React Native's <View />

getItemLayout

A partial function that accepts the listItemHeight and returns the function expected by React Native FlatList's getItemLayout prop.

TODO

  • Add example snack.
  • onEndReached should be debounced.
  • Support dynamic item height.

License

rn-extended-flatlist is MIT licensed, as found in the LICENSE file.

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago