Skip to content

Commit c46e97e

Browse files
mammad2ccooperka
authored andcommitted
🐛 Fix error in getItemCount with null items (#37)
* fixed error when items is null in ImmutableVirtualizedList.js , in `getItemCount` when `items` is null throw error. With this change, at first it will checks `items` is valid and so on. * added install scripts * replace install by prepare in scripts * Remove unrelated 'prepare' script * Simplify logic
1 parent a51c2de commit c46e97e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ImmutableVirtualizedList/ImmutableVirtualizedList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class ImmutableVirtualizedList extends PureComponent {
114114
ref={(component) => { this.virtualizedListRef = component; }}
115115
data={immutableData}
116116
getItem={(items, index) => utils.getValueFromKey(index, items)}
117-
getItemCount={(items) => (items.size || 0)}
117+
getItemCount={(items) => ((items && items.size) || 0)}
118118
keyExtractor={(item, index) => String(index)}
119119
{...passThroughProps}
120120
/>

0 commit comments

Comments
 (0)