jl- / react-slide-deck

react carousel, swipe, slide deck, showcase, page section scroll ...
MIT License
86 stars 6 forks source link

Error when rendered with only one slide #4

Closed maxpblum closed 8 years ago

maxpblum commented 8 years ago

Hi again! We're getting close to deploying our new app that uses this component—very excited about it. We're A/B testing various versions of it, though, including one that doesn't include multiple slides, and it would be awesome if we didn't have to conditionally wrap our slides in the <SlideDeck> component based on how many there are. We tried having only one slide, though, and we got this error: image

The error pops up from this line: https://github.com/jl-/react-slide-deck/blob/master/src/deck.js#L275

Do you think it would be possible to make the component handle the one-slide case gracefully? We can work around it if not, but if it's an easy fix, it would be so great.

Thank you, again, for all your work!!

jl- commented 8 years ago

Thanks @maxpblum , I really should have added unit test support. I think it has been fixed with this commit. Is it ok that you replace your local react-slide-deck/dist/deck.js with this new build and run the test again to see if it passed. If that went well, I will make a release right away. Sorry again for lacking of test cases.