Allow data lists to include 0 or '' (falsey items)

Summary:
Fixing https://github.com/facebook/react-native/issues/13578

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

(Write your motivation here.)

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)
Closes https://github.com/facebook/react-native/pull/15419

Reviewed By: sahrens

Differential Revision: D5795844

Pulled By: tomasreimers

fbshipit-source-id: 4cdf97a2f5e83e38f4e12af771b512e7dddd212a
This commit is contained in:
Tomas Reimers 2017-09-13 17:22:22 -07:00 коммит произвёл Facebook Github Bot
Родитель a17797940d
Коммит ae1a4f08f6
1 изменённых файлов: 0 добавлений и 2 удалений

Просмотреть файл

@ -527,7 +527,6 @@ class VirtualizedList extends React.PureComponent<Props, State> {
last = Math.min(end, last);
for (let ii = first; ii <= last; ii++) {
const item = getItem(data, ii);
invariant(item, 'No item for index ' + ii);
const key = keyExtractor(item, ii);
if (stickyIndicesFromProps.has(ii + stickyOffset)) {
stickyHeaderIndices.push(cells.length);
@ -1168,7 +1167,6 @@ class VirtualizedList extends React.PureComponent<Props, State> {
_createViewToken = (index: number, isViewable: boolean) => {
const {data, getItem, keyExtractor} = this.props;
const item = getItem(data, index);
invariant(item, 'Missing item for index ' + index);
return {index, item, key: keyExtractor(item, index), isViewable};
};