question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposition of builtin CSS transition handlers with react-transition-group

See original GitHub issue

Most of the time transitions are hard and messy to perform and maintain, Styled Components bring us a very easy API to handle styling. I was thinking of an idea to add transition helpers to the API levered by react-transition-group and make it even better.

import styled from 'styled-components-transition-group';

// transition() wraps TransitionGroup
const List = styled.div.transition() ``;

// animated() wraps CSSTransition
const ListItem = styled.div.animated() `
  transition: opacity 300ms cubic-bezier(0.4, 0.0, 0.2, 1) 0ms;

  &:appear, &:enter, &:exit {
    opacity: 0;
  }
  &:appear-active, &:enter-active {
    opacity: 1;
  }
`;

Access my example repository and launch storybook for a working demo of this proposition. storybook

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:11
  • Comments:17 (2 by maintainers)

github_iconTop GitHub Comments

16reactions
gabiseabracommented, Dec 17, 2017

If anyone’s still interested, I made styled-transition-group, which exports a new styled object as geelen proposed.

5reactions
granmoecommented, Mar 18, 2018

I’m throwing my hat in the ring. I’ve used a slightly different, more minimal approach: https://github.com/granmoe/styled-animate

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSSTransition Component - React Transition Group
CSSTransition applies a pair of class names during the appear , enter , and exit states of the transition. The first class is...
Read more >
Animation Add-Ons - React
ReactCSSTransitionGroup is a high-level API based on ReactTransitionGroup and is an easy way to perform CSS transitions and animations when a React component ......
Read more >
Using React Transition Group to improve UI - LogRocket Blog
In this React Transition Group tutorial, learn how to use the CSSTransition and TransitionGroup components in your React app to improve UX.
Read more >
Improve your UI with React Transition Group - YouTube
In this video tutorial, we will take a look at React Transition Group to improve transitions in our application.0:00 Introduction 4:24 ...
Read more >
An introduction to animated transitions with React Router
React Transition Group is an animation library that gives us a way to perform animations when a React component enters or leaves the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found