Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo breaks on resize #543

Closed
RoarkeRandall opened this issue Nov 12, 2016 · 7 comments
Closed

Demo breaks on resize #543

RoarkeRandall opened this issue Nov 12, 2016 · 7 comments
Labels

Comments

@RoarkeRandall
Copy link

Resize the output window horizontally and it breaks.

https://jsfiddle.net/kirana/20bumb4g/

@allantl
Copy link

allantl commented Dec 11, 2016

This seems to be fixed using the latest release (0.14.2).

@giladbr
Copy link

giladbr commented Feb 5, 2017

It seems it's a bug they didn't finish fixing. Here's a workaround that works for me - add the following to React's component that contains the react-slick:

constructor() {
      [...]
      this.onWindowResized = this.onWindowResized.bind(this);
  }

  componentDidMount() {
      window.addEventListener('resize', this.onWindowResized);
  }


  componentWillUnmount () {
      window.removeEventListener('resize', this.onWindowResized);
  }

  onWindowResized() { //add debounce for performance?
      this.forceUpdate(); //react's default forceUpdate
  }

This will effectively force React to re-render the entire component on window resize, fixing the problem.

@Tonyhark
Copy link

cause this issue appear by ver 0.14.6, so use version 0.14.5 to avoid this bug

@kaqiinono
Copy link

将走马灯组件用方法进行定义即可

@stale
Copy link

stale bot commented Mar 24, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 24, 2018
@stale stale bot closed this as completed Mar 31, 2018
@Karl-EdwardFPJeanMehu
Copy link

This is still an unresolved an issue. I'm running v 0.23.1

@laveesingh
Copy link
Contributor

@Karl-EdwardFPJeanMehu could you create a codesandbox demo for the same?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants