Skip to main content

Purpose

MNFlatList is a generic, reusable wrapper around React Native's FlatList component. It simplifies usage by providing default styling and customizable props for flexible list rendering.

MNFlatList

Import

import MNFlatList from '@/components/ui/scrollList/MNFlatList';

Props

PropTypeOptionalDescription
dataT[]NoArray of items to be rendered in the list
renderItemFlatListProps<T>['renderItem']NoFunction that renders each item
keyExtractorFlatListProps<T>['keyExtractor']YesFunction to extract a unique key for each item
ListHeaderComponentReact.ReactElement | nullYesComponent rendered at the top of the list
ListFooterComponentReact.ReactElement | nullYesComponent rendered at the bottom of the list
contentContainerStyleobjectYesAdditional styles applied to the content container

Basic Usage

 <MNFlatList
data={children}
renderItem={childRow}
contentContainerStyle={styles.flatListContentContainerStyle}
/>


MNPaginatedList

MNPaginatedList renders a paginated list using FlatList. It simulates API data fetching with pagination, supports both vertical and horizontal scrolling, and shows a loading spinner when new data is being fetched.

Import

import MNPaginatedList from '@/components/ui/scrollList/MNPaginatedList';

Props

PropTypeDefaultDescription
horizontalbooleanfalseIf true, renders the list horizontally

Basic Usage

<MNPaginatedList horizontal={false}/>

NOTE: All example can be founded in paginated_list.tsx