Comments (6)
@yuzeh thanks for your fix... tried hours to get this working ;D
from react-slick.
Both should work.
Let me test it
from react-slick.
So it looks like css width
is not getting assigned to the items if the root element of the item is a React component.
Current workaround is wrapping the component in a div
.
from react-slick.
children of slider component to adjust styles and class names based on intreractions
https://github.com/akiran/react-slick/blob/master/lib/inner-slider.jsx#L57-62
In this case, style and classnames are applied to react components instead of html elements.
Your work around is one way to fix this.
Other way would be to pass props to div inside component (I haven't tested it though)
var Bar = React.createClass({
render: function() {
return (
<div {...this.props}>
<img src={this.props.imageUrl} />
</div>
);
},
});
I will see if there is any better way to fix this issue.
from react-slick.
similar issue here but it's just a regular div, not a component the responsive settings doesn't seem to work until I resize the window, demo works though, if I copy exactly what's on the demo to my render function it works ok :/
edit:
Seems like I found the issue, this.state.subcategories
is something that I get with an ajax call if I hardcode the json object directly it works ok.
render: function() {
var slickSettings = {
dots: true,
infinite: false,
adaptiveHeight: false,
speed: 500,
slidesToShow: 7,
slidesToScroll: 7,
responsive: [{
breakpoint: 1200,
settings: {
slidesToShow: 6,
slidesToScroll: 6
}
}, {
breakpoint: 1024,
settings: {
slidesToShow: 4,
slidesToScroll: 4
}
}, {
breakpoint: 768,
settings: {
slidesToShow: 3,
slidesToScroll: 3
}
}, {
breakpoint: 480,
settings: {
slidesToShow: 2,
slidesToScroll: 2
}
}]
};
var subcategories = this.state.subcategories.map(function(subcategory){
return(
<div key={subcategory.id}>
<div className="active-link-with-image tt-cp text-2">
<a data-category={subcategory.slug}>
<img src={subcategory.images.thumb}/>
<div className="name">
<span>{subcategory.name}</span>
</div>
</a>
</div>
</div>
)
});
return (
<div className="slick-categories">
<Slider {...slickSettings} ref="slick">
{subcategories}
</Slider>
<div className="spinner loading" ref="spinner"/>
</div>
);
}
from react-slick.
Slider is not getting update when new slides are arrived
Earlier we used to reinitialize slider when props changed, but removed it to fix other issue #85
01e6e4b
Need to find a different solution
from react-slick.
Related Issues (20)
- Pagination Dots Not Activating Correctly with decimal Values for slidesToShow and infinite: false. HOT 1
- Question: Smooth Scrolling HOT 1
- CenterMode with Infinite and Variable Width not centering properly HOT 5
- Missing settings and defaultValues in default props HOT 1
- error Assignment to constant variable. HOT 1
- Customize arrows and dots inside a div so that we can position the main div of arrows and dots anywhere for Next.js 14. HOT 2
- CenterMode : false is not working
- WaitForAnimate: Animates opposite way HOT 1
- No skipping back when resized
- Slider with only one slide item not displaying properly HOT 2
- Centermode and VariableWidth not working HOT 1
- UI is broken when changing version from 0.29.0 -> 0.30.2 with one image.
- How to hide button next/prev arrow in react slick
- variableWidth: true, infinite: false not disabling the next arrow button when the last element enters the viewport HOT 2
- Forcing slide animation when scrolling up and down on mobile
- Slider isn't aligned left HOT 2
- Change width of the center slide only
- Performance issue with clones (infinite)
- initialSlide is ignored on breakpoints HOT 1
- currentSlide from afterChange event shows decimal when using SlidesToShow as decimal and infinite:false
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-slick.