Skip to content
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

Transition to the next page directly #52

Open
nukeop opened this issue Jul 27, 2017 · 5 comments
Open

Transition to the next page directly #52

nukeop opened this issue Jul 27, 2017 · 5 comments

Comments

@nukeop
Copy link

nukeop commented Jul 27, 2017

I'm using this code to great effect, thank you for sharing it.
I have a following question: right now using a transition makes the program correctly leave the previous view, but it transitions to an empty page, then the next view pops in. Is there a way to make it transition directly to the next page?

@maisano
Copy link
Owner

maisano commented Jul 27, 2017

@nukeop thanks for the kind words.

it depends on how you're composing it. are you wrapping individual routes with the RouteTransition component or are you wrapping a set of routes?

@nukeop
Copy link
Author

nukeop commented Jul 27, 2017

I'm wrapping a Switch component in the RouteTransition. I want to apply the effect only to a particular block on the page.
Here's the relevant render function:

  render() {
    return(
      <Route render={({location, history, match}) => {
        return (
          <MainLayout>
            <RouteTransition
              pathname={location.pathname}
              atEnter={{ opacity: 0 }}
              atLeave={{ opacity: 0 }}
              atActive={{ opacity: 1 }}
              className={styles.transition}
            >
              <Switch key={location.key} location={location}>
                <Route path="/album/:albumId" component={AlbumViewContainer} />
                <Route path="/artist/:artistId" component={ArtistViewContainer} />
                <Route path="/dashboard" component={Dashboard} />
                <Route path="/" component={SearchResultsContainer} />
              </Switch>
            </RouteTransition>
          </MainLayout>
        );
      }
    }>

    </Route>
  );
}

@maisano
Copy link
Owner

maisano commented Jul 31, 2017

@nukeop what happens if you set the RouteTransition's pathname prop to be location.key?

also, what styles are being set via the styles.transition class name?

@nukeop
Copy link
Author

nukeop commented Jul 31, 2017

changing pathname to location.key didn't help.

The scss sheet sets the following properties:

.transition {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 1rem;
}

@ColinVDH
Copy link

ColinVDH commented Oct 4, 2017

Also experiencing this exact issue with AnimatedSwitch. @nukeop did you figure out how to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants