Skip to content

Commit

Permalink
Pass the itemIndex to the renderItem function
Browse files Browse the repository at this point in the history
  • Loading branch information
webdeb committed Aug 31, 2017
1 parent a9bc179 commit 52c5682
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -74,7 +73,7 @@ export default class Item extends Component {

return (
<li role="option" {...restProps} ref={this.storeItemReference}>
{renderItem(item, { isHighlighted, ...renderItemData })}
{renderItem(item, { itemIndex, isHighlighted, ...renderItemData })}
</li>
);
}
Expand Down

0 comments on commit 52c5682

Please sign in to comment.