GithubHelp home page GithubHelp logo

Comments (6)

mklb avatar mklb commented on May 3, 2024 1

@yuzeh thanks for your fix... tried hours to get this working ;D

from react-slick.

akiran avatar akiran commented on May 3, 2024

Both should work.
Let me test it

from react-slick.

yuzeh avatar yuzeh commented on May 3, 2024

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.

akiran avatar akiran commented on May 3, 2024

@yuzeh

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.

gus4no avatar gus4no commented on May 3, 2024

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.

akiran avatar akiran commented on May 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.