Skip to content
Permalink
Browse files

Remove invariant on nested sibling VirtualizedLists without unique li…

…stKey props

Summary:
It's easy to accidentally trigger this invariant when adding / moving around a component that relies on a FlatList.

There might be some unexpected behavior when this occurs, i.e. messed up virtualization / viewability logging. But to me, that is a better outcome than crashing the JS context.

Reviewed By: sahrens

Differential Revision: D14975295

fbshipit-source-id: 18015a780a153aae995723b120440be0e55d8e8b
  • Loading branch information...
Logan Daniels authored and facebook-github-bot committed May 1, 2019
1 parent b273516 commit af5633bcba224f71f035ba4214a93b69723c9b93
Showing with 7 additions and 6 deletions.
  1. +7 −6 Libraries/Lists/VirtualizedList.js
@@ -526,12 +526,13 @@ class VirtualizedList extends React.PureComponent<Props, State> {
this._cellKeysToChildListKeys.set(childList.cellKey, childListsInCell);

const existingChildData = this._nestedChildLists.get(childList.key);
invariant(
!(existingChildData && existingChildData.ref !== null),
'A VirtualizedList contains a cell which itself contains ' +
'more than one VirtualizedList of the same orientation as the parent ' +
'list. You must pass a unique listKey prop to each sibling list.',
);
if (existingChildData && existingChildData.ref !== null) {
console.error(
'A VirtualizedList contains a cell which itself contains ' +
'more than one VirtualizedList of the same orientation as the parent ' +
'list. You must pass a unique listKey prop to each sibling list.',
);
}
this._nestedChildLists.set(childList.key, {
ref: childList.ref,
state: null,

0 comments on commit af5633b

Please sign in to comment.
You can’t perform that action at this time.