Skip to content

Commit

Permalink
Merge pull request #89 from bamlab/fix/prevent-setting-list-size-to-zero
Browse files Browse the repository at this point in the history
fix: prevent setting virtualized list size to zero
  • Loading branch information
pierpo authored Mar 21, 2024
2 parents 30ecb97 + df9d1c1 commit 5405171
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ export const VirtualizedListWithSize = typedMemo(
onLayout={(event) => {
if (!hasAlreadyRendered) {
const sizeKey = isVertical ? 'height' : 'width';
setListSizeInPx(event.nativeEvent.layout[sizeKey]);
setHasAlreadyRendered(true);
if (event.nativeEvent.layout[sizeKey] !== 0) {
setListSizeInPx(event.nativeEvent.layout[sizeKey]);
setHasAlreadyRendered(true);
}
}
}}
testID={props.testID ? props.testID + '-size-giver' : undefined}
Expand Down

0 comments on commit 5405171

Please sign in to comment.