nuka-carousel
nuka-carousel copied to clipboard
It's very strange behavior of wrapAround property.
Hi there. First of all thanks for this cool project. I have task to make carousel with infinite loop as that:

and I have written that code, but I got pile of flickered blocks and this is very sad.
class SliderSimple extends Component {
constructor(props){
super(props);
this.state = {
active: 0
};
}
componentDidMount () {
console.log(this.state.active);
}
componentDidUpdate (prevProps, prevState) {
console.log(this.state.active);
}
setCarouselData(carousel) {
var data = this.refs[carousel];
if ( data ) {
console.log(data);
this.setState({
active: data.state.currentSlide,
});
}
}
render() {
return (
<div styleName = "SliderWrapper">
<div styleName = "SliderMobile">
<Carousel cellAlign="center"
decorators={[]}
slideWidth = { '271px' }
cellSpacing = { 90 }
slidesToShow = { 1 }
slidesToScroll = { 1 }
data={() => this.setCarouselData('slider')}
wrapAround = { false }
ref = "slider" >
{ this.props.items.map((i, k) => {
return(
<div styleName="SliderContaner" key = {k} style = {{
opacity: this.state.active == k ? 1 : 0.5,
transition:"opacity 1s"
}}>
<div styleName="SliderItem" >
<img src={i} alt=""/>
</div>
</div>);
})
}
</Carousel>
<img styleName = "SliderOverlay" src = {require("assets/images/sliderMobileState.png")}></img>
</div>
<Arrow direction = "prev" handleClick = {() => {
this.refs.slider.previousSlide();
}}/>
}
<Arrow direction = "next" handleClick = {() => {
this.refs.slider.nextSlide();
}}/>
</div>
);
}
}
My code: I will be gratefull for any help. Thanks.
I have the same problem. One of the slides flickers when I click the "previous" nav button.