-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Compatible with ReactTransitionGroup? #727
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
Comments
Seems to be the same issue. I was going to try the The RouteHandler mixin but it doesn't seem to be publicly exposed in the bower build? |
We really, really need to cut a release. Master is too far ahead of 0.11. |
It's not exposed in the global build on cdnjs which I was using. I'll try compiling myself but need to get my head around webpack first.. |
@klase You should be able to compile with |
@klase I assume it is now called |
Cheers the lifecycle hooks now trigger but I get this warning every time I hit a route: "Warning: You are calling cloneWithProps() on a child with a ref. This is dangerous because you're creating a new child which will not be added as a ref to its parent." |
@ryanflorence @klase I'm seeing this warning as well when I use the same implementation. Possible issue with react version we're using? |
@digitaltoad @alexaivars I was working through this last night, and this is a basic implementation that works, albeit with a caveat I'll get to:
However with this implementation you lose the ability to access the I spent a bit coming up with a hacky solution that passes the |
Doesn't seem to be working. I tried the code above as well as using default handler and not the one from mixin. When the route is changing after calling I want to keep the content of the previous rout untouched until transition to the new route ends. Is that possible? |
@zkilgore In react 0.13 they added a new |
@natew Thank you for the tip! Will spend some time upgrading soon and report back how it goes. I'm excited about @LKay are you implementing |
@zkilgore I tried to implement these methods in the first handler for the route but the elements still get duplicated when transition starts. |
@LKay can you toss what you have in a gist and post it? |
@LKay I'm also very interested in seeing this. I was able to get |
Are you guys using the mixin rather than the I'm not using TransitionGroup directly, but I have a component that is basically a re-implementation of it and it works well once you get rid of the component. |
@natew Can you send a gist of your implementation? |
@natew And are you using React 0.13 or 0.12? |
@duro it would be hard to extract, but the usage is in reapp rather than TransitionGroup, and the ViewList's use the same ideas as transitiongroup (https://github.com/reapp/reapp-ui/blob/master/mixins/ViewListMixin.jsx#L96) but to be honest you guys are probably further into this than me as far as using transitiongroup. For me I got transitions working only with the mixin, but both on 0.12 and 0.13. |
@duro here's a gist of pretty much what I'm doing (albeit faked). But these are the methods I implement on my handlers to make animations work. https://gist.github.com/zkilgore/254307f7cd5c42579ed0 And I'm still on 0.12 but think it should be fine in 0.13 too. |
@zkilgore Do you get this warning in your implementation:
|
I do get that, but it's not a huge deal, and though I haven't implemented One caveat is that you won't be able to use the component in the transition
|
@zkilgore Yea, I have tested going back and forth between Switching between basic routes is fine. But if I try to switch to a Handler that expects props to merge down from the RouteHandler, that Handler never gets the props. My main question here is, what is broken? React-Router? Or TransitionGroup? It seems like we are hacking around some incompatibility here, and I'm wondering who's incompatibility I should be focusing on. |
@duro can you post a gist of what you're working with in the case where it I don't think either of these components are broken (in fact they're both
|
@zkilgore @duro I was not using Mixin but just |
@LKay your gist appears to be implementing CSSTransitionGroup and not the lower level TransitionGroup. Are you implementing componentWillEnter and componentWillLeave life cycle methods on your RouteHandlers? |
@zkilgore Here is a gist of the files in question: https://gist.github.com/duro/0d6d3ef4d5b53be5e1e7 The main problem seems to stem from views (aboutServiceCategory.js) that need to load data via a static method before they are rendered. Other pages (home.js, careers.js, aboutLanding.js) that don't have bootstrapped data work fine. I understand that individually both these libraries kick ass. It's just the incompatibility between the two that has me frustrated. Any ideas on what I may be doing wrong? |
@duro Is the problem that when you switch between the 'about service category' pages the transition lifecycle methods are not called? If that's the issue, the problem is the handler will have the same key (the leaf route name, so 'serviceDetail') and in the TransitionGroup's eyes that's component isn't leaving or entering. You could append the :category param to the key to combat this. If that is not the issue, then could you describe what exactly you want to happen and what exactly is happening? |
I have upgraded everything to 0.13, and my problem now seems to be consistent. Props are not being passed down to newly created route handlers. If I move from a RouteHandler that needs to props, to a RouteHandler that needs props, the transition does not work. |
I managed to get this to work, finally: |
I'll test this ASAP. If this works you are a God in my book. On Tuesday, May 12, 2015, Colin Ramsay [email protected] wrote:
|
Note that I might not have had exactly the same issue as you, this is just super-basic usage. The whole discussion of React and React Router animations really needs some TLC at this point I think. |
You might want to try the |
@colinramsay I took a deeper look at your component. It seems to implement a similar approach to @gaearon Are there any upgrade notes for the |
@gaearon I see the |
It was merged. |
Does React Router work with ReactTransitionGroup? Maybe I'm missing something but no matter what I try the lifecycle hooks won't trigger on components associated with a route: http://jsfiddle.net/d2mnwqLj/3/
The text was updated successfully, but these errors were encountered: