Skip to content

Commit af5633b

Browse files
logandanielsfacebook-github-bot
authored andcommitted
Remove invariant on nested sibling VirtualizedLists without unique listKey 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
1 parent b273516 commit af5633b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Libraries/Lists/VirtualizedList.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -526,12 +526,13 @@ class VirtualizedList extends React.PureComponent<Props, State> {
526526
this._cellKeysToChildListKeys.set(childList.cellKey, childListsInCell);
527527

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

0 commit comments

Comments
 (0)