Closed wkillerud closed 6 years ago
There is onMeasure
callback which you can use to do any extra warnings in your app
Also components will not only expand. They collapse to 0
smoothly too. So 0
is a legit number which should not produce any warnings.
Allright, guess we’ll just need to remember this edge case. Thanks for the quick reply!
I'm using React Collapse in a mixed framework world where React views sometimes are mounted inside Marionette views (we're slowly porting a large app to React). A few times now we've struggled getting React Collapse to work, only to discover that we're rendering the React view in the wrong Marionette life cycle method, before stuff is added to the DOM. As a consequence
clientHeight
is 0 on the first render and the Collapse component always gets a height of 0, regardless ofisOpened
status.Would it be possible to add a warning to the console log if
getTo
produces 0?https://github.com/nkbt/react-collapse/blob/a0951988f57b6730aec2fde1346467c4d618f761/src/Collapse.js#L150
A message like
Collapse measured a clientHeight of 0px. Is the parent element in the DOM and measurable?
or something similar would probably have put me on the right track much sooner.If it sounds OK I'd be happy to file a PR :)