From 52c5682f16e02ccffe8283de8b9404cb994070ee Mon Sep 17 00:00:00 2001 From: Boris Kotov Date: Thu, 31 Aug 2017 15:27:58 +0200 Subject: [PATCH] Pass the itemIndex to the renderItem function --- src/Item.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Item.js b/src/Item.js index 933849d..b695913 100644 --- a/src/Item.js +++ b/src/Item.js @@ -51,10 +51,9 @@ export default class Item extends Component { }; render() { - const { isHighlighted, item, renderItem, renderItemData, ...restProps } = this.props; + const { isHighlighted, item, itemIndex, renderItem, renderItemData, ...restProps } = this.props; delete restProps.sectionIndex; - delete restProps.itemIndex; if (typeof restProps.onMouseEnter === 'function') { restProps.onMouseEnter = this.onMouseEnter; @@ -74,7 +73,7 @@ export default class Item extends Component { return (
  • - {renderItem(item, { isHighlighted, ...renderItemData })} + {renderItem(item, { itemIndex, isHighlighted, ...renderItemData })}
  • ); }