Skip to content

Animation doesn't work inside bounded flexboxes #89

@itayganor

Description

@itayganor

When <AnimateHeight/> is inside a bounded flexbox (a flexbox that has a limit in its main flex axis, i.e. a div with display: flex; flex-direction: column; height: 100px;), the variable height value during the animation doesn't count.
In this case, <AnimateHeight/> should consider itself as a flexbox child, and have flex-shrink: 0 for the height 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 the height 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:

<AnimateHeight style={{flexShrink: 0}}>content</AnimateHeight>

But there's no actual reason to explicitly set it every time.

Your Environment

  • Version used: 2.0.20
  • OS: Windows 10
  • Browser: Chrome 81

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions