|
| 1 | +import * as React from 'react' |
| 2 | +import * as Immutable from 'immutable' |
| 3 | +import { ListViewProps, VirtualizedListProps } from 'react-native'; |
| 4 | + |
| 5 | +type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>> |
| 6 | + |
| 7 | +// Heuristic check if data is Immutable |
| 8 | +type ImmutableData = { |
| 9 | + slice: (begin?: number, end?: number) => any; |
| 10 | + keySeq: () => any |
| 11 | +} |
| 12 | + |
| 13 | +export type ImmutableListViewProps = Omit<ListViewProps, 'dataSource'> & { |
| 14 | + immutableData: ImmutableData, |
| 15 | + dataSource?: never, |
| 16 | + sectionHeaderHasChanged?: (prevSectionData:any, nextSectionData:any) => boolean, |
| 17 | + rowsDuringInteraction?: number, |
| 18 | + renderEmpty?: string | React.FC<ImmutableListViewProps>, |
| 19 | + renderEmptyInList?: string | React.FC<ImmutableListViewProps>, |
| 20 | +} |
| 21 | + |
| 22 | +export declare class ImmutableListView extends React.Component<ImmutableListViewProps> {} |
| 23 | + |
| 24 | +export declare class EmptyListView extends React.Component<Omit<ListViewProps, 'dataSource'> & { |
| 25 | + dataSource?: never, |
| 26 | + renderRow?: React.FC<any>, |
| 27 | + emptyText?: string, |
| 28 | +}> {} |
| 29 | + |
| 30 | +export type ImmutableVirtualizedListProps<T> = VirtualizedListProps<T> & { |
| 31 | + immutableData: ImmutableData, |
| 32 | + renderEmpty?: string | React.FC<ImmutableVirtualizedListProps<T>>, |
| 33 | + renderEmptyInList?: string | React.FC<ImmutableVirtualizedListProps<T>>, |
| 34 | +} |
| 35 | + |
| 36 | +export declare class ImmutableVirtualizedList<T = any> extends React.Component<ImmutableVirtualizedListProps<T>> {} |
| 37 | + |
| 38 | +export declare class EmptyVirtualizedList<T> extends React.Component<VirtualizedListProps<T> & { |
| 39 | + renderItem: React.FC<any>, |
| 40 | + emptyText: string |
| 41 | +}> {} |
0 commit comments