React-responsive-carousel: Black fill is visible during transition when using dynamicHeight and flexbox

Created on 5 Feb 2019  路  19Comments  路  Source: leandrowd/react-responsive-carousel

In the transition from a wide image to the tall image, a black fill is visible.

https://codesandbox.io/s/j328w994l3

In lieu of a quick solution, as a workaround, is there a way to set this background fill color?

Thanks!

wontfix

Most helpful comment

Agreed, I think having a black background by default is unnecessarily opinionated.

+1 for slides having no background by default, and having the ability to modify the background of slides via a prop.

In case this helps anyone, the workaround I've opted for is using renderItem:

<Carousel
    renderItem={item => <div style={{ background: "white" }}>{item}</div>}
>

Alternatively, you could just override the background set on .carousel .slide.

All 19 comments

Hi @markjackson02, your example doesn't show the black fill. Have you tried using images instead of background?

@leandrowd sorry for the late response. Here is an updated sandbox: https://codesandbox.io/s/v85v7rpn05

The black fill is visible below the smaller image during the transition.

Any progress?

@blacksmoke26 @markjackson02
If I correctly understood.
You may just rewrite the style of background for this selector
.carousel .slide

This code is rewriting the fill color to yellow.
.carousel .slide{ background: yellow; }

@blacksmoke26 @markjackson02
If I correctly understood.
You may just rewrite the style of background for this selector
.carousel .slide

This code is rewriting the fill color to yellow.
.carousel .slide{ background: yellow; }

I changed.carousel .slide{ background: black; } to.carousel .slide{ background: yellow; }in carousel.min.css but I am still getting black bars

@Aeonstrife Try to open
https://codesandbox.io/s/v85v7rpn05
change code in overrides.css
Screenshot 2019-08-03 at 14 08 49

I propose that we add background color as a prop unless there is a cleaner solution?

I propose that we add background color as a prop unless there is a cleaner solution?

yes it would be nicer than overriding css classes

Not sure why the default background color is black, imo, it shouldn't be set to anything

@Gu4etl's solution works. It looks like this https://github.com/leandrowd/react-responsive-carousel/blob/8593f0e2c7039fb502c25e80a0616dd8a532f9ec/src/components/_carousel.scss#L201 is where the black background is being set on .slide class

Does everyone agree it would make sense to add a prop for background color?

making it undefined by default with an option to provide would be great

+1 it should be transparent by default with the ability to change it via a prop

Agreed, I think having a black background by default is unnecessarily opinionated.

+1 for slides having no background by default, and having the ability to modify the background of slides via a prop.

In case this helps anyone, the workaround I've opted for is using renderItem:

<Carousel
    renderItem={item => <div style={{ background: "white" }}>{item}</div>}
>

Alternatively, you could just override the background set on .carousel .slide.

@leandrowd thanks for building this package 馃槂 what are your thoughts on this issue and the solutions provided?

HI. Please remove that black background color.

Any progress? Why has this not been implemented.

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.

bump

Still an issue, should not be closed yet!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ShineOfFire picture ShineOfFire  路  6Comments

thlee1122 picture thlee1122  路  5Comments

sinaler picture sinaler  路  3Comments

kishor82 picture kishor82  路  4Comments

ledbetterljoshua picture ledbetterljoshua  路  6Comments