bushblade/react-touch-drag-slider

Slider crashes when single child is passed

Closed this issue · 4 comments

Hi,

I wanted to use your slider in one of my projects and found that it crashes whenever a single child element is passed to the slider component.

Uncaught TypeError: children.map is not a function

The cause should be in

{children.map((child, index) => {

where it is expected that children is an array.

If you want I can try to make a pullrequest to fix this?

Hi @steve192
Thanks for the issue.
To be honest I've not done much with this project for a while so yes if you want to submit a PR, I'll take a look.

Hi @bushblade
In the meantime I switched to another library's and unfortunately most likely won't fix this bug.
Shall we close this issue or leave it open for others?

I'll close as I think expecting more than one child would be appropriate for a slider anyway.

Pull Request: #4