V
V
vovashaplin2020-06-26 23:38:55
React
vovashaplin, 2020-06-26 23:38:55

How to make smooth removal of an element from an array with react-spring?

Made animated removal and appearance of array elements. But I do not know how to make the elements smoothly collapse when one of them is deleted. Here is a simple sandbox example.
https://codesandbox.io/s/throbbing-night-ytj1r?fil...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2020-06-27
@vovashaplin

For example like this :

const transBoxes = useTransition(boxes, boxes => boxes, {
    from: { opacity: 0, width: 100, transform: "translateY(-100px)" },
    enter: { opacity: 1, transform: "translateY(0px)" },
    leave: [{ transform: "translateY(100px)", opacity: 0 }, { width: 0 }],
    config: {
      duration: 750
    }
  });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question