VirtualizedList uses a for..of iterator which does not work on Android #17687
Labels
Ran Commands
One of our bots successfully processed a command.
Resolution: Locked
This issue was locked by the bot.
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment:
OS: macOS Sierra 10.12.6
Node: 8.9.2
Yarn: 0.23.2
npm: 5.5.1
Watchman: 3.5.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.51.0 => 0.51.0
Target: Android 27
Steps to Reproduce
Expected Behavior
VirtualizedList component works
Actual Behavior
Red box.
Here's what's happening:
for..of in the ViewabilityHelper is transpiled into the following code:
for (var _iterator = nextItems, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[typeof Symbol === 'function' ? Symbol.iterator : '@@iterator']();;) {
nextItems
is aMap
and thus failsArray.isArray
so the code assumes the object is iterable. Android does not include an interator onMap
.nextItems
only contains the keys_mapData
,_objectIndex
,_stringIndex
and_otherIndex
.The resulting error is this:
Such an error would not be caught by a test harness running in a Chrome runtime environment.
I believe the fix involves changing how
for..of
is transpiled.The text was updated successfully, but these errors were encountered: