@@ -86,12 +86,11 @@ const FlatList = forwardRef((props: Props, ref: Ref<HTMLElement>) => {
8686 sortBy, sortDesc, sort, sortCaseInsensitive, sortGroupBy, sortGroupDesc, // sort props
8787 searchBy, searchOnEveryWord, searchTerm, searchCaseInsensitive, // search props
8888 display, displayRow, rowGap, displayGrid, gridGap, minColumnWidth, // display props,
89- hasMoreItems, loadMoreItems, paginationLoadingIndicator, paginationLoadingIndicatorPosition,
90- pagination, // pagination props
89+ hasMoreItems, loadMoreItems, paginationLoadingIndicator, paginationLoadingIndicatorPosition, // pagination props
9190 ...otherProps // props to be added to the wrapper container if wrapperHtmlTag is specified
9291 } = props ;
9392 // tslint:disable-next-line:prefer-const
94- let { list, group, search, ...tagProps } = otherProps ;
93+ let { list, group, search, pagination , ...tagProps } = otherProps ;
9594
9695 list = convertListToArray ( list ) ;
9796
@@ -209,6 +208,13 @@ const FlatList = forwardRef((props: Props, ref: Ref<HTMLElement>) => {
209208 } ) ;
210209 }
211210
211+ if ( pagination && pagination . loadMore ) {
212+ pagination = {
213+ ...( FlatList . defaultProps && FlatList . defaultProps . pagination ) ,
214+ ...pagination
215+ } ;
216+ }
217+
212218 const content = (
213219 < Fragment >
214220 {
@@ -222,7 +228,7 @@ const FlatList = forwardRef((props: Props, ref: Ref<HTMLElement>) => {
222228 { ...{ display, displayRow, rowGap, displayGrid, gridGap, minColumnWidth} }
223229 showGroupSeparatorAtTheBottom = { group . separatorAtTheBottom || showGroupSeparatorAtTheBottom }
224230 />
225- { ( loadMoreItems || pagination . loadMore ) &&
231+ { ( loadMoreItems || ( pagination && pagination . loadMore ) ) &&
226232 < InfiniteLoader
227233 hasMore = { hasMoreItems || pagination . hasMore }
228234 loadMore = { loadMoreItems || pagination . loadMore }
@@ -324,6 +330,15 @@ FlatList.propTypes = {
324330 * the minimum column width when display grid is activated
325331 */
326332 minColumnWidth : string ,
333+ /**
334+ * a pagination shorthand configuration
335+ */
336+ pagination : shape ( {
337+ hasMore : bool ,
338+ loadMore : func ,
339+ loadingIndicator : oneOfType ( [ node , func , element ] ) ,
340+ loadingIndicatorPosition : string ,
341+ } ) ,
327342 /**
328343 * a custom element to be used instead of the default loading indicator for pagination
329344 */
@@ -441,6 +456,12 @@ FlatList.defaultProps = {
441456 limit : 0 ,
442457 loadMoreItems : null ,
443458 minColumnWidth : '' ,
459+ pagination : {
460+ hasMore : false ,
461+ loadMore : null ,
462+ loadingIndicator : null ,
463+ loadingIndicatorPosition : '' ,
464+ } ,
444465 paginationLoadingIndicator : undefined ,
445466 paginationLoadingIndicatorPosition : '' ,
446467 renderWhenEmpty : null ,
0 commit comments