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

Infinite animation #14

Closed
ghost opened this issue Mar 13, 2019 · 8 comments · Fixed by #38
Closed

Infinite animation #14

ghost opened this issue Mar 13, 2019 · 8 comments · Fixed by #38

Comments

@ghost
Copy link

ghost commented Mar 13, 2019

My collapsed block has top and bottom padding. When i collapsed it - block height increases indefinitely (in animation loop). Looks like it increases by collapsed block height + padding every second.

@roginfarrer
Copy link
Owner

Can you provide a codesandbox example? Or some steps to reproduce? Which version?

@ghost
Copy link
Author

ghost commented Mar 14, 2019

@roginfarrer Can't, cause I received TypeError: Cannot read property 'useMemo' of undefined every time, when i tried to use your library in code sandbox

@roginfarrer
Copy link
Owner

Sounds like you don't have React installed. The library requires React v16.8.x.

Here's a codesandbox demo

@roginfarrer
Copy link
Owner

Closing due to inactivity.

@saranchonkau
Copy link

The same bug!
We can easily reproduce it by adding padding to container that receives collapse props.
I tried it with basic demo on your demo site

image

@roginfarrer roginfarrer reopened this Jun 22, 2019
@roginfarrer
Copy link
Owner

I think this is related to challenges measuring the element with padding applied. Will need to dig in further.

@Sandstedt
Copy link

A quick fix is to apply padding to the child element instead.
<section {...getCollapseProps()}><div style={{ padding: 20 }}>{props.children}</div></section>

@roginfarrer
Copy link
Owner

I'm thinking the solution here is just to document this limitation and add a console.warn if the padding property is passed to the Collapse. I looked into getting the vertical padding when measuring the element's dimensions via window.getComputedStyle, but that operation is costly, and still doesn't give a smooth closing transition (the transition ends at the element's sum of the top and bottom padding, not 0). As @Sandstedt said, the best solution here is to apply padding to the children instead.

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

Successfully merging a pull request may close this issue.

3 participants