Giter VIP home page Giter VIP logo

Comments (10)

STRML avatar STRML commented on May 18, 2024

Have you seen this project? https://github.com/andreypopp/react-router-page-transition

from react-router-component.

dbmzzo avatar dbmzzo commented on May 18, 2024

@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.

STRML avatar STRML commented on May 18, 2024

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 Links.

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>

See code

from react-router-component.

jenil avatar jenil commented on May 18, 2024

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.

STRML avatar STRML commented on May 18, 2024

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.

jenil avatar jenil commented on May 18, 2024

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.

dbmzzo avatar dbmzzo commented on May 18, 2024

@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.

jenil avatar jenil commented on May 18, 2024

@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:
untitled

from react-router-component.

lifeiscontent avatar lifeiscontent commented on May 18, 2024

@jenil27 any updates on your luck? Did you get this working if so how?

from react-router-component.

jenil avatar jenil commented on May 18, 2024

Nope, didn't figure it out. Gave up.

from react-router-component.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.