question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

We can add a prop so that Slick does not add width: 100%; display: inline-block; ?

See original GitHub issue

Slick is adding those styles to the Slider items and I must use important in the original styles to not lose them. This would be a very good idea, this is not the first time this has happened with Slick.

untitled

import React from 'react'
import ImageCircle from '../ImageCircle';
import Slider from "react-slick";
import './styles.scss'

export default ({ images, isAvatar }) => {
  const settings = {
    dots: false,
    infinite: true,
    autoplaySpeed: 2000,
    slidesToShow: 5,
    slidesToScroll: 5,
    autoplay: true,
    responsive: [],
    arrows: false,
    centerPadding: '100px',
    accessibility: false,
  };
  return (
    <div className='GalleryImages'>
      <Slider {...settings}>
        {
          Array.isArray(images) && images.map((img) => (
            <div className='BlockImage' key={img.url} >
              <div className='BlockOverlary' />
              {
                isAvatar ? (
                  <ImageCircle
                    style={{
                      width: '100px',
                      height: '100px',
                      margin: 'auto'
                    }}
                    img={img.url}
                    alt={img.alt}
                  />
                ) : (
                    <img
                      src={img.url}
                      alt={img.alt}
                    />
                  )
              }
            </div>
          ))
        }
      </Slider>
    </div>
  )
}

If you allow me, I can do a PR. But we should discuss the name of the prop.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:23
  • Comments:10

github_iconTop GitHub Comments

11reactions
alexfromespercommented, Jun 1, 2020

To anyone still looking for a solution…

Try wrapping your list components in a react fragment. This worked for me.

<React.Fragment key={id}> <Item> </Item> </React.Fragment>

4reactions
CharlyJazzcommented, May 6, 2019

No

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove inline css width: 100%; display: inline-block
You need in CSS add after the element value !important . For example: .product-wrap { position: relative; width: 30px !important; display: ...
Read more >
How to Make Inline-Block Elements Add Up to 100% Width
You can achieve your desired result by changing the div width to 49%, but that's not good enough. It NEEDS to be 50%!....
Read more >
slick - the last carousel you'll ever need - Ken Wheeler
slick is a responsive carousel jQuery plugin that supports multiple breakpoints, CSS3 transitions, touch events/swiping & much more!
Read more >
When do you use inline-block? | CSS-Tricks
The block-direction margin on inline elements is ignored entirely; The padding on inline elements doesn't affect the height of the line of text....
Read more >
Quick fix: Inline-block HTML elements with total 100% width ...
Nowadays there are many ways to position 2+ elements next to each other: you can use inline blocks, floating, Flexbox, even CSS Grid....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found