-
Notifications
You must be signed in to change notification settings - Fork 160
Every single aspect of this carousel is buggy #723
Description
They. Have. Tests.
But you know what's funny about tests? They should be properly written too.
Alright, I fixed the most obvious bug ever, can't imagine how they come so far with it.
Not going to do any helpful things for those, who created this, but for community.
First of all, you have to get rid of node-sass
. It's deprecated and not going to work with Python39, but developers don't seem to care. Use dart-scss instead. Just replace node-sass
with sass
.
if you use slides.map
just like any developer would display slides from database, you should fix src/tools/getChildren
file.
Replace with
import React from "react";
const getChildren = (children, slides) => {
if (!children) {
if (slides) {
return slides;
}
return [];
}
return React.Children.toArray(children);
};
export default getChildren;
I know what you think, but yea, they have [children]
instead.
Then in main Carousel.js
file instead of calling this every single render you should use state. Doesn't matter, recoil or useState
from React.
And then drop this somewhere too
useEffect(() => {
setChildren(getChildren(props.children, props.slides));
}, [props.children]);
When I fixed it, at first I thought that all my problems are solved, but how silly was I!
What made me think other things are written better?
I can't imagine that they did something more complex than examples in documentation, because nothing is working at all.
All I wanted is to have a carousel with items from database. I requests it, I pass it as a child.
<ReactCarousel {...settings}>
{challenges.map((challenge) => (
<Challenge challenge={challenge} key={challenge.id} />
))}
<CreateChallenge />
</ReactCarousel>
So, settings. When I add infinite
plugin, it just empty, doesn't show anything. Completely.
Other settings like fastSwipe
, slidesToShowPlugin
and so on make no difference.
When It loads, content is cut, I don't see more than on screen. If I resize window a bit, it appears, but I still can scroll it away from the screen.
ice_video_20210614-235927.mp4
I don't understand one thing. This library has a community, quite nice markup on github and they even asking for donations.
How do you use it? Why do you use it?