Skip to main content

FlatListWrapper

Content

Wrapper around FlatList which operates based on provided LoadState and shows appropriate data.

Params

Extends FlatListProps and additionally adds next properties

NameTypeRequiredDefault valueDescription
loadStateLoadStateTrue-Load state
tryAgain() => voidFalseUndefinedAction callback which occurs when pressing on Try Again
errorstring or nullFalselocalization.errors.listErrorTitleError text which will be shown to user in case if loadState == LoadState.error

Usage example

  return (
<FlatListWrapper
loadState={loadState}
data={data}
error={error}
renderItem={renderItem}
ListEmptyComponent={<EmptyView title={localization.empty.orders} description={localization.empty.ordersDescription} />}
tryAgain={tryAgain}
onRefresh={pullToRefresh}
onEndReached={loadMore}
keyExtractor={orderKeyExtractor}
/>
);