voronianski/react-swipe

Conditional rendering the children doesn't work

Closed this issue · 3 comments

zefj commented

Description

I'm conditionally setting the amount of steps and rendering children of ReactSwipe component. This does not seem to work, please see the screenshot as well as a quick debug below.

reactswipe

This code will throw on line 710, with an exception "Uncaught TypeError: Cannot read property 'props' of null". As you can see, the children array has false as first element, which causes it to break. Please refer to the gist linked below for code sample and repro.

Demo link

I'll provide a gist generated with esnextbin, dunno how to provide a working link. Easy copy-paste though. Please notice the steps-related code in the constructor, as well as children of ReactSwipe. Open the console to see the error.
https://gist.github.com/zefj/4e52d75e7e099e986f2dda769f0ce7a4

@zefj please check on new version - 5.0.7. Thanks!

@zefj fixed in latest version.