nkbt / react-collapse

Component-wrapper for collapse animation with react-motion for elements with variable (and dynamic) height
MIT License
1.13k stars 113 forks source link

New content is not displayed if section is initially expanded and content was dynamically changed from empty #245

Closed itsuryev closed 5 years ago

itsuryev commented 5 years ago

Hello!

I have encountered an issue where content is not displayed if it was dynamically changed in already expanded section

Initial situation:

        <Collapse isOpened={true}>
          <div style={{height: 0}} />
        </Collapse>

When I fetch some data and it becomes

        <Collapse isOpened={true}>
          <div style={{height: 100}} />
        </Collapse>

At this point nothing is displayed, collapse sticks to 0 height. If in initial situation height would be 1 content would correctly be displayed.

I've prepared example of this situation - https://codesandbox.io/s/oqo0zp1j19 (navigate to Content.js file). Try changing height: 0 to height: 1 to see that in case of non-zero height it works correctly.

Thank you for your help and maintaing this component! Cheers :)

nkbt commented 5 years ago

As new react-collapse@5.0.0 is released https://github.com/nkbt/react-collapse/releases/tag/v5.0.0 this issue has been most likely already solved.

Please feel free to re-open if the issue persists