With this code, the code below throw error in Android mobile React-Native jscore.
[...new Map()];
[...new Set()];
I'm not completely sure how it can break something. What's the version of Android? Is spread operator native or from Babel?
I believe we ran into this as well. Using chrome its fine but on device our android crashes after going from 2.5.1 -> 2.5.3
So... Any additional information?
Debugging this a little bit. Definitely caused by https://github.com/zloirock/core-js/commit/6f9792057de00c873bca6373c1c5eecf66cbc45d. Rolling back to one commit before https://github.com/zloirock/core-js/commit/771b32d5d19e8bf7c292c9f7c9f86deddf755824 and its fine. The stack trace I see is
'TaskQueue: Error with task: Incompatible receiver, Map required!
_validate-collection.js:3:55
if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');<<<<
_collection-strong.js:120:25
$iterDefine(C, NAME, function (iterated, kind) {
this._t = validate(iterated, NAME); // target <<<<<<<
this._k = kind; // kind
_iter-define.js:26:57
switch (kind) {
case KEYS: return function keys() { return new Constructor(this, kind); };
case VALUES: return function values() { return new Constructor(this, kind); };
} return function entries() { return new Constructor(this, kind); }; <<<<<<<
And the react-native code
https://github.com/facebook/react-native/blob/master/Libraries/Lists/ViewabilityHelper.js#L249
const changed = [];
for (const [key, viewable] of nextItems) { <<<<<<
if (!prevItems.has(key)) {
Same issue here, we were getting Incompatible receiver, Map required in I.E.11. Reverting back to v2.5.2 fixed it. We use core-js via babel-preset-env, in order to get it fixed the solution is to set the version hard in the resolutions property of the package.json file:
"resolutions": {
"core-js": "2.5.2"
},
Edit: the resolutions section of the package.json file is a yarn feature!
There is a js file named BackHandler.Android.js in React-Native, which is used to manage Android BackPress Events.
var _backPressSubscriptions = new Set();
RCTDeviceEventEmitter.addListener(DEVICE_BACK_EVENT, function() {
var backPressSubscriptions = new Set(_backPressSubscriptions);
var invokeDefault = true;
var subscriptions = [...backPressSubscriptions].reverse();
for (var i = 0; i < subscriptions.length; ++i) {
if (subscriptions[i]()) {
invokeDefault = false;
break;
}
}
Because of this code var subscriptions = [...backPressSubscriptions].reverse(); and Map&Set Error, when we press BackPress in Android, it will lead these execption:

Reverting back to v2.5.2 fixed this problem.
Also see this when running Array.from(new Set([1, 2, 3])) on RN-android
run into a related issue I think - although in IE11 and in dev mode with babel, for loops like like
for (const [k, v] of myMap) {
}
produces (sometimes): "Incompatible receiver, Map required!"
downgrading to 2.5.2 fixes IE errors
If you're seeing this, please take a minute to put together a reproducible example repository that contains code that reproduces the error, it would help a ton in narrowing this down.
IE11:

Android 4.4-6:




So what about a reproducible example and clarification your environment?
@zloirock This seems to be reproducible with an app that uses jscore (such as React Native) and a babel shimmed for..of block iterating on a Set/Map. This is happening for all versions of Android that I've tested.
I put together a few details of another instance of this problem: https://github.com/twilio/TwilioChatJsReactNative/issues/9
If it helps at all, when I turn on react native's remote debugging, the error goes away. I'm also using android 7.1.1.
I was able to "fix" it in react native by doing this:
yarn add [email protected]
cp -R node_modules/core-js/* node_modules/fbjs-scripts/node_modules/core-js/
cp -R node_modules/core-js/* node_modules/babel-register/node_modules/core-js/
cp -R node_modules/core-js/* node_modules/babel-runtime/node_modules/core-js/
cp -R node_modules/core-js/* node_modules/metro-bundler/node_modules/core-js/
i can reproduce this as well. This occurs on Android API 25, Using Android OS 7.1.1
My RN environment is below.
Environment:
OS: macOS High Sierra 10.13.1
Node: 9.2.1
Yarn: Not Found
npm: 5.5.1
Watchman: 4.9.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.53.0 => 0.53.0
This is an issue with any RN component that uses virtualized list. They use Maps in the implementation if you are using the onViewableItemsChanged prop of the virtualized list. This then brings the error TaskQueue: Map is Required!
do what @yamafaktory did and downgrading to 2.5.2 worked for me. Clearly an issue is happening with 2.5.3 and React Native specifically
I can confirm that this error occurs also with an Angular 5 project using core-js polyfills.
I can confirm React Native breaks for me with 2.5.3 and works again after downgrad to 2.5.2
By looking at what changes from 2.5.2 to 2.5.3 I narrowed the problem down to this change: https://github.com/zloirock/core-js/issues/236 https://github.com/zloirock/core-js/commit/f96b8d8afaebda5f49ac213627218f841c8692b4#diff-cef85cf90f184a55418f175f3c233f2aR219
If I revert var $default = (!BUGGY && $native) || getMethod(DEFAULT); to var $default = $native || getMethod(DEFAULT); then it works again on Android.
FYI @zloirock
Ok, I was able to reproduce it... only in FF27. Seems the most cases of this issue was caused conflicts with another not completely correct polyfills. I will revert this change and will publish a patch release soon. This logic will be completely rewritten in core-js@3.
@zloirock thanks!
Happy to see progress. Thanks
Kenneth Skovhus notifications@github.com schrieb am Do., 22. März 2018,
15:14:
@zloirock https://github.com/zloirock thanks!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/zloirock/core-js/issues/368#issuecomment-375320878,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADgNEhNL8_r6g73gwedxbI4vbd0PQv3ks5tg7GqgaJpZM4RDbdJ
.
Fixed in 2.5.4 and 3.0.0-alpha.1.
hi
I am using 2.5.4 version in my react-native project. But I am facing this error for android.

Can you please advise?

facing same issue, please provide any information. tried using 2.4.0, 2.5.4 and @3 but not working
Most helpful comment
Same issue here, we were getting
Incompatible receiver, Map requiredin I.E.11. Reverting back tov2.5.2fixed it. We use core-js via babel-preset-env, in order to get it fixed the solution is to set the version hard in the resolutions property of the package.json file:Edit: the resolutions section of the package.json file is a yarn feature!