Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: ReactCSSTransitionGroup delays #8280

Closed
renarsvilnis opened this issue Nov 13, 2016 · 5 comments
Closed

Feature: ReactCSSTransitionGroup delays #8280

renarsvilnis opened this issue Nov 13, 2016 · 5 comments

Comments

@renarsvilnis
Copy link

renarsvilnis commented Nov 13, 2016

Hi, I want to make a feature request for adding a way to delay enter/appear/leave for ReactCSSTransitionGroup component.

I propose adding new props to ReactCSSTransitionGroup:

  • transitionEnterDelay Delay in ms after which element begins enter transition. Defaults to 0.
  • transitionAppearDelay Delay in ms after which element begins appear transition. Defaults to 0.
  • transitionLeaveDelay Delay in ms after which element begins leave transition. Defaults to 0.
 <ReactCSSTransitionGroup
          transitionName="example"
          transitionEnterDelay={300}
          transitionEnterTimeout={500}
          transitionAppear
          transitionAppearDelay={300}
          transitionAppearTimeout={500}
          transitionLeaveDelay={0}
          transitionLeaveTimeout={300}
>
          {items}
</ReactCSSTransitionGroup>

As all defaults for proposed props are 0 it would't add breaking changes for existing ReactCSSTransitionGroup users.

The example before describes my reasons behind the request.

Use case

I'm currently creating an project that contains navigable subpages and each subpage has a unique enter and leave animation with a unique enter/leave duration and it is possible to change to any subpage from another in any order. When changing to a new page the previous subpage leave must end before the new page begins entering in. So I need to delay the entering of the new subpage until old one leaves.

Currently I have an object that defines enter/leave durations for each of the subpages and a helper function calcPageTimeouts(currentPage, lastPage) that calculates the correct timeouts and delays for current subpage for the ReactCSSTransitionGroup component depending on current state.

Each subpage contains multiple different elements that in combination creates an enter/leave animation sequences. As ReactCSSTransitionGroup enter/leave transitions are CSS class based, it's not possible to add a additional transition-delay on an parent element. To add needed behaviour I would need to entirely manage the enter/leave stuff in Javascript rather in CSS by adding a class.

@renarsvilnis
Copy link
Author

renarsvilnis commented Nov 17, 2016

If anyone interested I made a <DelayMount /> component that tries to allow delayed mounting and "unmounting" of components.

https://gist.github.com/renarsvilnis/bb083fa50c64221c49f43169076cdf31

@cvle
Copy link

cvle commented Feb 1, 2017

Checkout this project as an alternative: https://github.com/wikiwi/react-css-transition

@craftzdog
Copy link

Why not use transition-delay?

@aweary
Copy link
Contributor

aweary commented Jun 14, 2017

We are no longer maintaining the transition group add-ons, please check out https://github.com/reactjs/react-transition-group instead. Thanks!

@aweary aweary closed this as completed Jun 14, 2017
@gaearon
Copy link
Collaborator

gaearon commented Jun 14, 2017

(To be clear, the linked repo is a drop-in replacement as of version 1, which will be maintained in foreseeable future.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants