Recalculate parent when children change

#2 · closed · 2 comments

View on GitHub ↗

Aprillion

For nested `<AutoHeight>`s, if both parent and child re-render, the height gets recalculated. But if only the child re-renders (e.g. for memoized parent), then the parent does not adjust height in version 1.0.3. Need to add a mechanism for children to notify their ancestor AutoHeights to recalculate even without React parent re-render.

Comments

Aprillion

Also experiment with `element.scrollHeight`, setting min-height and max-height without setting height, to avoid nested block `<div>` which could make it more usable inside flex container and avoid margin collapse problems. https://stackoverflow.com/questions/18083229/javascript-jquery-get-height-when-max-height-is-set-to-0

Aprillion

Fixed in version 1.1.1, tested by https://peter.hozak.info/react-auto-height/?path=/story/autoheight--parents-of-re-rendered-children