1

I used useTransition hook to add animation to a list element, and its child element's height is not a fixed number. if I set {from:{height:0},enter:{height:'auto'}, the element lose animation.

I want the children in transition animation div have a dynamic height property, any conclusions? :b

alex
  • 11
  • 3

1 Answers1

0

the reasong cause this problem is that transition doesnt work with height:auto.

I found some tricks to solve this problem.

  1. use max-height instead of height

  2. use grid display, and toggle grid-template-rows between0fr to 1fr

  3. get element innerHeight when mount. An official expample

alex
  • 11
  • 3