pmndrs / pmndrs/react-spring

Multiple transition animations associated with the same array

Open
#1,030 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind: request
Dominant language
TypeScript
Stars
29.1k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

🚀 Feature Proposal?

When I add/remove an item from an array, I need to do transition animations on multiple DOM elements. Imagine children or elements on the same level. Right now this is not possible yet I guess.

  const transitions = useTransition(rows, {
    animation1: {
      from: { opacity: 0 },
      enter: { opacity: 1 },
      leave: { opacity: 0 }
    },
    animation2: {
      from: { transform: "translateX(50px)" },
      enter: { transform: "translateX(0)" },
      leave: { transform: "translateX(50px)" }
    }
  });
<ul>
  {transition((props, row) => (
    <animated.li style={props.animation1}>
        <animated.div style={props.animation2}>...</animated.div>
    </animated.li>
  ))}
</ul>

Example

I've prepared a Codesandbox, but of course I couldn't get it working:
Codesandbox

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the useTransition usage shown in the issue and inspect the linked Codesandbox, especially src/components/Rows.jsx. Determine how multiple DOM elements on the same array item should receive transition styles and whether the current API supports that shape. Done means the proposed example works for both animation1 and animation2, with behavior covered by an appropriate test or example.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.