React-slick: TypeError: images.forEach is not a function - <InnerSlider> component

Created on 23 Mar 2018  路  9Comments  路  Source: akiran/react-slick

Hi everyone, I'm getting the following error when I run my application on the ipad:

_TypeError: images.forEach is not a function. (In 'images.forEach', 'images.forEach' is undefined)
InnerSlider_componentDidUpdate_

Debugging the code it renders the component in the view, but when it executes this function it throws the error.

Only on the iPad does this happen, anyone have any idea what it could be?

screen shot 2018-03-23 at 12 35 37

screen shot 2018-03-23 at 12 36 09

Most helpful comment

The referenced commit should take care of it, the changes will be released soon.

All 9 comments

This is the same issue as https://github.com/akiran/react-slick/issues/1132.

Some (older) browsers do not provide the method 'forEach' for NodeLists, which is the return value of document.querySelectorAll().

Thanks @jmschlmrs, i'll close this issue.

Heh, we both closed our issues. Oops.

Although the problem should have been fixed by the latest verson 0.22 3.

Are you referring to changes here?

https://github.com/akiran/react-slick/commit/46b10cec38df95a53dab6234e59fde1b46fc9cdb

Array.from is not supported by IE (less than edge). This will continue to be an issue unless you've polyfilled .from()

Could you tell me if either of the following would work:
Converting to an array by spreading the NodeList object

[...images].forEach

Converting to an array by the slice method from Arrays:

Array.prototype.slice.call(images).forEach

@laveesingh, can confirm that Array.prototype.forEach.call(images, function(e){}); worked for me on IE11.

On a related note, looks like react-slick is using babel-polyfill. I'm assuming NodeList.forEach() is set to be added to that after core-js (which babel-polyfill uses) releases their V3: https://github.com/zloirock/core-js/issues/329.

The referenced commit should take care of it, the changes will be released soon.

thanks :D

Was this page helpful?
0 / 5 - 0 ratings

Related issues

will88 picture will88  路  3Comments

walker-jiang picture walker-jiang  路  3Comments

artemidas picture artemidas  路  4Comments

amishPro picture amishPro  路  3Comments

slashwhatever picture slashwhatever  路  3Comments