Comments (10)
Have you seen this project? https://github.com/andreypopp/react-router-page-transition
from react-router-component.
@STRML Yes, I saw that project and based my app's transitions on it. However, the native back and forward buttons don't trigger the animations for me. They also don't trigger the transitions in the http://andreypopp.github.io/react-router-page-transition/ example. Thanks for your prompt response!
from react-router-component.
Yes - that code allows for a separate popState transition as animations on back/forward can get annoying. It is actually quite nice since you can set separate transitions on Link
s.
Using the code from the project, you can set the transitions on back/forward by specifying a popStateTransitionName
:
<AnimatedLocations hash className="Main" transitionName="moveUp" popStateTransitionName="moveUp">
<Location path="/" handler={MainPage} />
<Location path="/about" handler={AboutPage} />
</AnimatedLocations>
from react-router-component.
Hey guys!
I too have been trying to get this working, but I have a doubt, the -enter
transition works fine, but can someone explain to me how the -leave
transition works? For me, the page that is coming in animates, but the page leaving just vanishes.
This is my CSS:
.moveUp-enter {
-webkit-transform: translate3d(0,5%,0);
transition: all .4s;
opacity: 0.01;
}
.moveUp-enter.moveUp-enter-active {
-webkit-transform: translate3d(0,0,0);
opacity: 1;
}
.moveUp-leave {
transition: all 4s;
-webkit-transform: translate3d(0,0,0);
}
.moveUp-leave.moveUp-leave-active {
-webkit-transform: translate3d(0,-105%,0);
opacity: .01;
}
The 4s is for debugging purpose.
from react-router-component.
Looks like you're missing the full set of rules from styles.css, especially the opacity
bit.
There is more information in the React Docs for how this animation group works. Basically both elements are present in the DOM until React sees a transitionend
event, then it is finally removed.
from react-router-component.
I also tried with the exact same css on that file.
I read the docs throughly, but when happens is the -leave
just happens in a flash.
from react-router-component.
@STRML thanks so much for the explanation of the popStateTransitionName prop. It worked like a charm.
@jenil27 Have you made sure that the -leave
page isn't still in the DOM and just getting moved out of view? Your problem sounds very similar to an issue I had in which I thought the -leave
page was disappearing (happened instantly even with long transition), but it in fact was not properly positioned (absolute) and was being pushed out of view by the -enter
page element.
from react-router-component.
@dbmzzo The page isn't in the DOM, it just goes out of the DOM within a few milliseconds when another page is entering. I have positioned the pages absolutely and copied the same animations from the styles.css. Still no luck :(
Here is a GIF showing the effect:
from react-router-component.
@jenil27 any updates on your luck? Did you get this working if so how?
from react-router-component.
Nope, didn't figure it out. Gave up.
from react-router-component.
Related Issues (20)
- Higher-Order Component HOT 3
- Examples that pass args to renderRouteHandler are out of date
- Programmatically navigate? HOT 3
- Unknown prop `hash`
- Anyone integrated with redux?
- custom Link component (HighlightedLink) in ES6? HOT 1
- Question: Should the router have a callback to filter variable values from routes? HOT 2
- Should Hash environment url-decode routes? HOT 1
- Getting new warnings in console HOT 1
- Pathname Environment, History API and a double click in the back button to go back? HOT 7
- Update for React 15.5 warnings HOT 2
- queries do not survive in contextual routes.
- CaptureClicks drops querystrings
- Warning: getDefaultProps HOT 5
- docs don't make it clear how to navigate programatically HOT 1
- React 16.0 Support HOT 1
- onBeforeNavigation is invoked late HOT 1
- Location always renders a div HOT 3
- componentWillReceiveProps warning HOT 1
- Documentation Site Application Error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-router-component.