Server Side Rendering Initial Load Fade Out / In
See original GitHub issueHi there, thank you for your work on this animation framework, it’s exactly what I was searching for.
I’m trying to add it to my single page react app (built using Gatsby). I wrapped my page contents in a simple <Fade></Fade>
component and everything is working exactly how I want it to when navigating between pages. The initial page load, however, results in the contents displaying normally, then fading out and fading back in.
Is there a way to disable this behavior? I read the Server-Side Rendering section of the readme, however that leads me to believe that this is the desired result. Is that correct?
I also noticed that on the docs site, some transitions occur when navigating between pages but not when loading directly to that page (ex. the right-side navigation on this page slides up, but this transition is simply ignored if it is the initial site load). How was this accomplished? I don’t mind if the transitions don’t work on the initial load so long as I can avoid the unnecessary fade out / fade in.
I tried setting opacity: 0
in my CSS in hopes that it would remain hidden until the transition fades it in, but that didn’t seem to help.
Steps to reproduce:
- Open a new browser tab, preferably incognito to avoid caching
- Visit my site in progress: https://dublife.netlify.com/
- Watch for the content on the page to load, then fade out and back in a second later.
Thanks in advance!
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
@applebya You can place in html.js
Then in your js_disabled.css you place
Basically what it does is when JS is disabled instead of showing nothing it will show everything as it overrides the opacity from the library.
Well this is kind of intended behaviour, but you can disable it if you put the following code somewhere near the entry point in your app:
I’m planning to make this option default in
1.2.x
and remove thessrFadeout
function. To be honest, there are drawbacks to every solution: WithssrFadeout(false)
you won’t get animations on your initial load which might be equally confusing. There is also an internal prop calledalwaysReveal
( i might rename it in future ) that will force reveal animation even on initial load but it will make revealed contents invisible to googlebot and people with javascript off. So it will make sense for images and headers. That’s how I animate the frontpage of React Reveal. I’ll probably make the current behaviour an opt in via a prop in1.2.x