diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index 30e8777ea..bbfc6cf3b 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -218,6 +218,7 @@ type OptionalProps = { export type Props = RequiredProps & OptionalProps; let _usedIndexForKey = false; +let _keylessItemComponentName: string = ''; type Frame = { offset: number, @@ -431,6 +432,9 @@ class VirtualizedList extends React.PureComponent { return item.key; } _usedIndexForKey = true; + if (item.type && item.type.displayName) { + _keylessItemComponentName = item.type.displayName; + } return String(index); }, maxToRenderPerBatch: 10, @@ -762,6 +766,7 @@ class VirtualizedList extends React.PureComponent { const itemCount = this.props.getItemCount(data); if (itemCount > 0) { _usedIndexForKey = false; + _keylessItemComponentName = ''; const spacerKey = !horizontal ? 'height' : 'width'; const lastInitialIndex = this.props.initialScrollIndex ? -1 @@ -831,6 +836,7 @@ class VirtualizedList extends React.PureComponent { console.warn( 'VirtualizedList: missing keys for items, make sure to specify a key property on each ' + 'item or provide a custom keyExtractor.', + _keylessItemComponentName, ); this._hasWarned.keys = true; }