Skip to content

Add transition hooks to ReactCSSTransitionGroup.#5915

Closed
RandScullard wants to merge 2 commits intofacebook:masterfrom
GuptonMarrsInternational:reactcsstransitiongroup-transition-hooks
Closed

Add transition hooks to ReactCSSTransitionGroup.#5915
RandScullard wants to merge 2 commits intofacebook:masterfrom
GuptonMarrsInternational:reactcsstransitiongroup-transition-hooks

Conversation

@RandScullard
Copy link

Please see issue #5914 for details.

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot
Copy link
Contributor

@RandScullard updated the pull request.

@jamesplease
Copy link

I'd love to see this get merged in.

CSSCore.removeClass(node, activeClassName);

if (childRef.componentDidTransition) {
childRef.componentDidTransition(animationType);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't coponentWillTransition be called before componentDidTransition?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is if I'm not mistaken. This call to componentWillTransition in the the endListener callback, which is called after the transition ends.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmeas That's correct. componentWillTransition is called just before the transition begins and componentDidTransition is called just after it ends. The order looks backwards because of the position of endListener in the source code.

@aweary
Copy link
Contributor

aweary commented Jun 2, 2016

@RandScullard I believe this PR will need tests as well.

@RandScullard
Copy link
Author

@aweary I'd love to move this forward, but I could use some guidance on a few things:

  1. This PR is now four months old, so it's pretty far out of date with respect to React. In particular, I see that there have been some changes to the testing infrastructure in that time. What's the best way to bring the PR up to date with the latest stuff?
  2. I'm not yet familiar with React unit testing and while I'm happy to dive in, it would be great if I could get a pointer to existing tests similar to the ones I need to add. Or better yet, if someone who knows the React unit tests could collaborate with me on this part.

@gaearon
Copy link
Collaborator

gaearon commented Jun 26, 2016

Thank you for the PR! Unfortunately we won’t get it in due to #5914 (comment). Sorry about that!

@gaearon gaearon closed this Jun 26, 2016
CSSCore.removeClass(node, className);
CSSCore.removeClass(node, activeClassName);

if (childRef.componentDidTransition) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed to change this to if (childRef && childRef.componentDidTransition) {} to prevent errors in certain situations.

@jamesplease
Copy link

For future visitors: this PR works great! It's on my todo list to abstract it into a standalone lib as a maintained version of the CSSTransitionGroup addon. But in the meantime you can reference this PR:

https://github.com/jmeas/moolah/pull/405

which shows you what the code should look like. It was a bit tricky since React pulls in deps from this repo (that took me a long time to figure out 😛 ). I also referenced this project for some of the code, although they made a lot of changes to the CSSTransitionGroup itself which I didn't include.

@RandScullard
Copy link
Author

Thanks @jmeas! I'm glad someone was able to make use of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants