1.0.3 • Published 5 years ago

react-mobile-list v1.0.3

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

react-mobile-list

A List with infinite scrolling like RN FlatList without pull-to-refresh for mobile or pc web

Simple example

const renderItem = (item, index) => <div>{item.name}</div>

<List
  data={dataList}
  renderItem={renderItem}
  keyExtractor={(item, index) => item.id}
  ItemSeparatorWidth={8}
  ItemSeparatorColor='#f7f7f7'
  onEndReached={() => { console.log('end') }}
/>

API and Configuration:

PropertyTypeDefaultDescription
dataArray[]Your list data.
renderItemFunctionRequiredrenderItem({ item: Object, index: Number }) Takes an item from data and renders it into the list.
ItemClassNameStringclassName for items.
ItemSeparatorWidthNumber1Rendered in between each item, but not at the top or bottom.
ItemSeparatorColorString#e8e8e8borderColor.
ListEmptyComponentFunction Component ElementRendered when the list is empty. Can be a React Component Class, a render function, or a rendered element.
ListFooterComponentFunction Component ElementRendered at the bottom of all the items. Can be a React Component Class, a render function, or a rendered element.
ListHeaderComponentFunction Component ElementRendered at the top of all the items. Can be a React Component Class, a render function, or a rendered element.
keyExtractorFunctionRequired(item: object, index: number) => string
onEndReachedFunctionCalled once when the scroll position gets within onEndReachedThreshold of the rendered content.
onEndReachedThresholdNumber100How far from the end the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 100 will trigger onEndReached when the end of the content is within 100px visible length of the list.

Installation

npm install react-mobile-list --save