React-slick: AsNavFor doesn't work with version 0.23.0 and higher

Created on 25 Nov 2018  路  9Comments  路  Source: akiran/react-slick

I have tried to use the code(from here), but it didn't sync well. When i downgrade it to 0.21.0, it works great

import React, { Component } from "react";
import Slider from "react-slick";

export default class AsNavFor extends Component {
  constructor(props) {
    super(props);
    this.state = {
      nav1: null,
      nav2: null
    };
  }

  componentDidMount() {
    this.setState({
      nav1: this.slider1,
      nav2: this.slider2
    });
  }

  render() {
    return (
      <div>
        <h2>Slider Syncing (AsNavFor)</h2>
        <h4>First Slider</h4>
        <Slider
          asNavFor={this.state.nav2}
          ref={slider => (this.slider1 = slider)}
        >
          <div>
            <h3>1</h3>
          </div>
          <div>
            <h3>2</h3>
          </div>
          <div>
            <h3>3</h3>
          </div>
          <div>
            <h3>4</h3>
          </div>
          <div>
            <h3>5</h3>
          </div>
          <div>
            <h3>6</h3>
          </div>
        </Slider>
        <h4>Second Slider</h4>
        <Slider
          asNavFor={this.state.nav1}
          ref={slider => (this.slider2 = slider)}
          slidesToShow={3}
          swipeToSlide={true}
          focusOnSelect={true}
        >
          <div>
            <h3>1</h3>
          </div>
          <div>
            <h3>2</h3>
          </div>
          <div>
            <h3>3</h3>
          </div>
          <div>
            <h3>4</h3>
          </div>
          <div>
            <h3>5</h3>
          </div>
          <div>
            <h3>6</h3>
          </div>
        </Slider>
      </div>
    );
  }
}

Most helpful comment

and yes, just downgraded to 0.21.0, and it work perfectly

All 9 comments

I encountered same problem here. I downgraded install to 0.21.0 but still not working. How can I fix it?

same problem here. Looks like the two sliders only sync once after 2 clicks

and yes, just downgraded to 0.21.0, and it work perfectly

Yes. version "0.23.1" it's working properly with sync sliders but 0.23.2 it's not. Changing slides every second click.

Yes. version "0.23.1" it's working properly with sync sliders but 0.23.2 it's not. Changing slides every second click.

Tested on 0.23.1, I still have the same problem, slider is skipping every second item. On 0.21.0 work OK.

Same here, working correctly only on 0.23.1 version.

Confirming correct behaviour in 0.23.1

0.23.1 and 0.21.0 didn't work for me. What should i do???

Edit:
Ok i figured out that i made a mistake while i was downgrading. After i downgrade to 0.23.1 again,it worked successfully

Newest version only syncs every other click.

0.23.1 works for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vugman picture vugman  路  3Comments

BradyEdgar94 picture BradyEdgar94  路  3Comments

slashwhatever picture slashwhatever  路  3Comments

adamthewan picture adamthewan  路  4Comments

eternalsky picture eternalsky  路  3Comments