[feat]: Animate Presence component addition
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 20/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- react, typescript
- Domain
- frontend
Research direction
Start by reviewing the existing useTransition API and the proposed useAnimatePresence hook and animatedPresence HOC described in the issue. No files, tests, or entry points are named, so the API and behavior need agreement with maintainers before implementation. Done means an agreed mount and unmount animation design is implemented and validated.
Written by the indexing model from the issue text.
Description
A clear and concise description of what the feature is
A new component / hook that animates elements depending on whether their children are being rendered or not without the need to be passing data (this is similar but separate to useTransition which could be depreciated in favour of this new hook)
Why should this feature be included?
framer-motion has a component called animate presence which is fairly similar to our useTransition except with the latter, you have to pass state to the hook to control the appearance of the animated components.
This isn't the worst thing when you're only controlling one modal for instance, but if you want to control multiple it would be easier to be able to handle the animations depending on whether the dom element was mounted or not (see here for more context).
This feature would hopefully lead into #1628 which is also something I would be very interested in adding to react-spring.
Please provide an example for how this would work
Unlike framer-motion, rs has two parts, the hook that runs outside the react-render world & the animated component that interpolates those SpringValues to be applied to the DOM element.
We could create a new component in a similar API style to AnimatePresence, but it would be more inline with the direction of react-spring if we could make a hook & the an additional HOC built on animated to register these components for the hook to manipulate & track. So an ideal approach can be seen below:
const MyComponent = ({show}) => {
const springs = useAnimatePresence({
from: {
opacity: 0,
},
enter: {
opacity: 1
},
leave: {
opacity: 0
}
})
return show ? <animatedPresence.div style={springs}>Hello world</animatedPresence.div> : null
}
Of course, happy to hear other people's API design ideas // thoughts or even concerns about this feature.
- Dominant language
- TypeScript
- Stars
- 29.3k
- Forks
- 1.2k
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 17
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pmndrs/react-spring
-
template: bug
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
pmndrs/react-spring#2656 ·
Maintainers usually reply within 1 day
-
area: core kind: request
Difficulty 4/5 3-5 days Newbie friendliness 55/100
pmndrs/react-spring#2542 ·
Maintainers usually reply within 1 day
-
area: typescript kind: request release: major
Difficulty 4/5 3-5 days Newbie friendliness 52/100
pmndrs/react-spring#2541 · 1 comment ·
Maintainers usually reply within 1 day
-
release: major type: RFC
Difficulty 5/5 Over a week Newbie friendliness 35/100
pmndrs/react-spring#2522 · 1 comment ·
Maintainers usually reply within 1 day
-
[bug]: Tab crash with skipAnimation and loopPossibly taken @mrityunjay-pandey claimed this 43 days ago. Openarea: core kind: bug
Difficulty 3/5 1-2 days Newbie friendliness 52/100
pmndrs/react-spring#2409 ·
Maintainers usually reply within 1 day
All issues in pmndrs/react-spring
Similar issues
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 82/100
lingdojo/kana-dojo#34714 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
manaflow-ai/cmux#59692 ·
Maintainers usually reply within 1 day
-
Retire stale Python-parity labels in Rust ingress and auth testsPossibly taken @github-actions claimed this today. Openfactory factory:building factory:unowned ralph-status:in-progress via:opencode-free/hy4-flash-free
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
JoshCLWren/comic-pile#5874 · 2 comments ·
Maintainers usually reply within 1 day
-
area: community lane: free-agent priority: P1 roadmap type: task
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
velella-sh/offing#1046 ·
Maintainers usually reply within 1 day