UNPKG

react-native-flash-section-list

Version:
41 lines (40 loc) 1.81 kB
import { FlashList, ListRenderItem } from "@shopify/flash-list"; import React from "react"; import { SectionBase, SectionListData, TextStyle, ViewStyle } from "react-native"; interface SeparatorProps<ItemT, SectionT> { index: number; leadingItem: DataItem<ItemT, SectionT>; trailingItem: DataItem<ItemT, SectionT>; } type DataItem<ItemT, SectionT> = { type: "sectionHeader"; section: SectionT; } | { type: "row"; item: ItemT; }; interface FlashSectionListProps<ItemT, SectionT extends SectionBase<ItemT, SectionT>> extends Omit<React.ComponentProps<typeof FlashList>, "data" | "renderItem" | "keyExtractor"> { sections: SectionT[]; renderItem: ListRenderItem<ItemT> | null | undefined; keyExtractor?: (item: DataItem<ItemT, SectionT>, index: number) => string; renderSectionFooter?: ((info: { section: SectionListData<ItemT, SectionT>; }) => React.ReactElement | null) | undefined; renderSectionHeader?: ((info: { section: SectionListData<ItemT, SectionT>; extraData?: any; }) => React.ReactElement | null) | undefined; SectionSeparatorComponent?: ((props: SeparatorProps<ItemT, SectionT>) => React.ReactElement) | null | undefined; ItemSeparatorComponent?: ((props: SeparatorProps<ItemT, SectionT>) => React.ReactElement) | null | undefined; stickySectionHeadersEnabled?: boolean; sectionIndexOptions?: { sectionIndexLabelsKey: keyof SectionT; onSectionIndexPress?: (index: number) => void; dark?: boolean; barContainerStyle?: ViewStyle; barStyle?: ViewStyle; textStyle?: TextStyle; }; } export declare function FlashSectionList<ItemT, SectionT extends SectionBase<ItemT, SectionT>>(props: FlashSectionListProps<ItemT, SectionT>): React.JSX.Element; export {};