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

Error in client console: Infinity is an invalid value for the height css style property #46

Open
harrisonlo opened this issue Apr 6, 2018 · 9 comments

Comments

@harrisonlo
Copy link

harrisonlo commented Apr 6, 2018

Complete error in Chrome console:

Warning: `Infinity` is an invalid value for the `height` css style property.

Check the render method of `TransitionGroup`.

It didn't locate where that error comes from. It's simply a warning.js error. I'm getting this message after using react-stack-grid.

@xfumihiro
Copy link

Interestingly, the warning only shows when render stackgrid inside react-swipeable-views in my case.

@polad
Copy link

polad commented Jul 12, 2018

We have the same issue

@gpinhey
Copy link

gpinhey commented Jul 13, 2018

The root of this issue is based on ctrlplusb/react-sizeme#120 where element-resize-detector injects a div into the DOM at a very low level, bypassing React. This causes react-sizeme to return a width of 0 for that instant when the DOM under react-stackgrid's node only consists of a 0-width div, so react-stackgrid lays out elements with 0 columns, resulting in a divide by 0.

This bug is ultimately harmless, as once React has a chance to mount the actual children as DOM nodes, react-sizeme re-evaluates and passes a non-zero width, so everything works out fine.

A zero check here should fix the warning message: https://github.com/tsuyoshiwada/react-stack-grid/blob/25e61df87d7ad112a1873a83899d53aa48b079a7/src/components/StackGrid.js#L225

@bilicio
Copy link

bilicio commented Aug 1, 2018

Change the line 425 on the newer version of the file StackGrid.js, put any value of height instead of 0.

@Cantinaband
Copy link

I had the same issue with [email protected] and [email protected].

Solved it by changing line 487 to:

var height = columnHeights.length ? Math.max.apply(Math, _toConsumableArray(columnHeights)) - gutterHeight : 0;

@indu95
Copy link

indu95 commented Mar 4, 2021

I'm using "react": "^17.0.0", "react-stack-grid": "^0.7.1", and this issue still persists and I see there is lag on screen because of this error, can anyone please let me know the solution how to resolve this? or any workarounds? @Cantinaband

@Guaaan
Copy link

Guaaan commented Oct 11, 2022

I'm having the exact same problem on react "^18.2.0", "react-stack-grid": "^0.7.1". Has someone found a solution yet?

@osomaher2020
Copy link

I've faced the same problem, and found the issue was the [array of elements] to be shown in the Slider is empty [ ]
So I enclosed the Slider by (items.length) condition like:

(items.length) &&
<>
    <Slider {...settings} className="pb-sm-5 mb-5 slick-slider-wrapper">
          .....................
    </Slider>
</>

Hope this may help

@CeciliaJorcin
Copy link

I've faced the same problem, and found the issue was the [array of elements] to be shown in the Slider is empty [ ] So I enclosed the Slider by (items.length) condition like:

(items.length) &&
<>
    <Slider {...settings} className="pb-sm-5 mb-5 slick-slider-wrapper">
          .....................
    </Slider>
</>

Hope this may help

solved the problem for me! Thank you @osomaher2020!
I was getting client.js:1 Warning: NaN is an invalid value for the width css style property.

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

No branches or pull requests

10 participants