import type { AnyMap } from 'react-native-nitro-modules'; import type { NativeListDataSource } from './specs/NativeListDataSource.nitro'; export type ListKey = string; export type ListItemSize = { width?: number; height?: number; }; export type ListItem = ListItemSize & { key: ListKey; type: Type; data: TData; }; export type ListItemType = TItem['type']; export type ListItemForType> = Extract extends never ? TItem : Extract; export type ListContentEqualByType = { [TType in ListItemType]: (oldItem: ListItemForType, newItem: ListItemForType) => boolean; }; export type ListDataSourceConfig = { isContentEqualByType?: ListContentEqualByType; }; export type ListDataSource = { release(): void; replaceData(data: readonly TItem[], animated?: boolean): void; insertItem(index: number, item: TItem): void; updateItem(index: number, item: TItem): void; removeItem(index: number): void; moveItem(fromIndex: number, toIndex: number): void; }; export type ListDataSourceMutation = { type: 'replaceData'; } | { type: 'removeItem'; itemKey: string; } | { type: 'updateItem'; previousItemKey: string; }; type ListDataSourceMutationListener = (mutation: ListDataSourceMutation) => void; export declare function createListDataSource(config?: ListDataSourceConfig): ListDataSource; export declare function getNativeListDataSource(dataSource: ListDataSource): NativeListDataSource; export declare function addListDataSourceMutationListener(dataSource: ListDataSource, listener: ListDataSourceMutationListener): () => void; export declare function useListDataSource(config: ListDataSourceConfig & { data: readonly TItem[]; }): ListDataSource; export {};