-
Notifications
You must be signed in to change notification settings - Fork 53
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
Animation doesn't work inside bounded flexboxes #89
Comments
Nice catch, I'll see what I can do. Adding |
Why hacky? it's exactly what's happening; the animated div gets shrunk because flexbox takes other calculations into account before |
Sorry, I wasn't clear. It feels hacky to add styles that fix very specific issue. EDIT: Honestly I feel this shouldn't be hard coded in the library itself. Instead user should add a class name and |
I added "Gotchas" section to the readme to explain this scenario: |
When
<AnimateHeight/>
is inside a bounded flexbox (a flexbox that has a limit in its main flex axis, i.e. adiv
withdisplay: flex; flex-direction: column; height: 100px;
), the variableheight
value during the animation doesn't count.In this case,
<AnimateHeight/>
should consider itself as a flexbox child, and haveflex-shrink: 0
for theheight
property to work as expected.Code example
https://codesandbox.io/s/react-animate-height-flex-tsu4k
Press Prepend random number to add items to the top of the list. Click it enough times until the whole
.logs
div is full (in terms of height). Then, watch how theheight
property doesn't do anything.Expected behavior
Height should be animated.
Possible Solution
Add
flex-shrink: 0
to the animated div, while animated.Currently achievable by:
But there's no actual reason to explicitly set it every time.
Your Environment
The text was updated successfully, but these errors were encountered: