import { StyledProp } from '@codeleap/styles' import { SectionsComposition } from './styles' import { SectionListRenderItemInfo, SectionListProps as RNSectionListProps, SectionListData } from 'react-native' import { ViewProps } from '../View' import { EmptyPlaceholderProps } from '../EmptyPlaceholder' import { RefreshControlProps } from '../RefreshControl' export type DataboundSectionListPropsTypes = 'sections' | 'renderItem' | 'keyExtractor' | 'style' | 'renderSectionFooter' | 'renderSectionHeader' export type SectionInfo = { isFirst: boolean isLast: boolean isOnly: boolean } export type AugmentedSectionRenderItemInfo = SectionListRenderItemInfo & SectionInfo export type SectionComponentProps = SectionInfo & { title: string index: number data: T[] } export type SectionRenderComponentProps = { section: { title: string index: number data: T[] } } export type ReplaceSectionListProps = Omit & { sections: Array<{ title: string; data: T[] }> keyExtractor?: (item: T, index: number) => string renderItem: (props: AugmentedSectionRenderItemInfo) => React.ReactElement onRefresh?: () => void fakeEmpty?: boolean loading?: boolean renderSectionHeader?: (props: SectionComponentProps) => React.ReactElement renderSectionFooter?: (props: SectionComponentProps) => React.ReactElement } export type SectionProps = ReplaceSectionListProps, T> & Omit & { separators?: boolean placeholder?: EmptyPlaceholderProps refreshControlProps?: Partial fakeEmpty?: boolean loading?: boolean keyboardAware?: boolean style?: StyledProp }