import * as React from 'react'; import Item from './Item'; import compareObjects from './compareObjects'; export interface Props { items: any[]; itemProps?: any; renderItem(): void; renderItemData: object; sectionIndex?: number; highlightedItemIndex?: number; onHighlightedItemChange(highlightedItem: any): void; getItemId(sectionIndex: any, itemIndex: any): void; theme(): void; keyPrefix: string; } export interface State { } export default class ItemsList extends React.Component { static defaultProps = { sectionIndex: null, }; shouldComponentUpdate(nextProps: any) { return compareObjects(nextProps, this.props, ['itemProps']); } storeHighlightedItemReference = (highlightedItem: any) => { (this as any).props.onHighlightedItemChange( highlightedItem === null ? null : highlightedItem.item ); } render() { const { items, itemProps, renderItem, renderItemData, sectionIndex, highlightedItemIndex, getItemId, theme, keyPrefix, } = (this as any).props; const sectionPrefix = sectionIndex === null ? keyPrefix : `${keyPrefix}section-${sectionIndex}-`; const isItemPropsFunction = typeof itemProps === 'function'; return ( ); } }