nkbt/react-collapse

Unwanted expand animation on initially opened Collapse and UnmountClosed components

Closed this issue · 2 comments

In the readme under Behaviour Notes, it currently says:

...initially opened Collapse elements will be statically rendered with no animation.

However, with both the Collapse and UnmountClosed components, I'm seeing 'expand' animations on initially opened elements. Any way to get rid of them?

Thanks for any help you can provide!
Version: react-collapse 5.0.1

nkbt commented

Most likely in your app component is rendered with height 0 initially and then height changes to something else. It could happen for a million css/layout/rendering reasons and is entirely outside of collapse’s control. Console log your determined element heights and see for yourself this is the case ((on a side note it is an effect exploited by react collapse itself to induce animation))

Wow, thank you for the quick feedback! I don't think there's an initial height of 0 set, but maybe you're right. I just tried swapping out with react-bootstrap/Collapse, and I'm not seeing an initial animation there, but maybe something strange is going on under the hood, as it were. Thank you again!