react-spring icon indicating copy to clipboard operation
react-spring copied to clipboard

[bug]: When using useTranstion, the element corresponding to the initial value is not displayed.

Open malt03 opened this issue 3 years ago • 1 comments

Which react-spring target are you using?

  • [X] @react-spring/web
  • [ ] @react-spring/three
  • [ ] @react-spring/native
  • [ ] @react-spring/konva
  • [ ] @react-spring/zdog

What version of react-spring are you using?

9.4.5

What's Wrong?

If an array or a function that returns an array is specified for the enter property of useTransition, elements that are drawn based on data passed as initial values in the first argument will complete drawing at the value specified in from. (To be precise, they appear to animate from -> enter -> from.)

This problem is not reproduced when a single value, not an array, is specified for the enter property. The problem does not occur in version 9.4.4, so the bug seems to be in 9.4.5.

To Reproduce

https://react-spring.dev/hooks/use-transition#multi-stage-transitions

Expected Behaviour

The element is displayed correctly for the initial value.

Link to repo

https://codesandbox.io/s/delicate-platform-vsik5n

malt03 avatar Jul 07 '22 12:07 malt03

To summarise for anyone wanting to look at this issue, if you use 9.4.4 there will be two items that animate in straight away, in 9.4.5 those two items are never rendered.

joshuaellis avatar Apr 10 '23 16:04 joshuaellis