npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-router-transitioner

v0.1.4

Published

A thin layer over react-motion for animating routes in react-router.

Downloads

43

Readme

React Router Transition

A simple component for easily enable transitions for components. Built for react-router, powered by react-motion. Some demos(from original repo)

You'll define transitions in your component which is the main difference from the original version.

import { RouteTransition } from 'react-router-transitioner';

// in your root app component:
<div>
  <RouteTransition>
    {this.props.children}
  </RouteTransition>
</div>


// And in your component that need transition

class AComponent extends Componet {...}


AComponent.sceneConfig = {
  atEnter: {
    opacity: 0,
    offset: -100
  },
  atLeave: {
    opacity: spring(0, fadeConfig),
    offset: spring(100, slideConfig)
  },
  atActive: {
    opacity: spring(1, slideConfig),
    offset: spring(0, slideConfig)
  },
  mapStyles(styles) {
    return {
      opacity: styles.opacity,
      transform: `translateX(${styles.offset}%)`
    };
  }
}

Installation

Install the modified version

npm install --save react-router-transitioner

If you want to install the original version

npm install --save react-router-transition

Usage

You need to place RouteTransition at your root of the router, and wrap your {this.props.children}

If you want to add transition to a component in the route tree, add a static property with key sceneConfig sceneConfig requires a few props:

  • component: the element type ('div', 'span', etc.) to wrap transitioning routes. use false to transition routes themselves (this will require consuming a style prop in your route components).Default is div.
  • atEnter: an object of interpolatable style values for a route that is mounting (required)
  • atBack: an object of interpolatable style values for a route that is mounting by poping, can be useful to create mobile feeling transitions (optional)
  • atLeave: an object of interpolatable style values for a route that is unmounting (required)
  • atActive: interpolatable style values for a route that has mounted (required)
  • mapStyles: an optional function to transform styles that aren't 1:1 (e.g. animating translateX or other values of transform)
  • runOnMount: a boolean to signal whether or not to run the transition on initial RouteTransition mount (Not sure if it's working now)
  • defaultConfig: set default scene configuration for all child routes, default is {}

and supports a couple optional props:

  • className: applies to the wrapper component
  • style: applies to the wrapper component

If you want more granular control over the transition, pass in spring objects accordingly. For more information on springs, check out react-motion's documentation.

Nesting Transitions

It's supported! Since transitions are defined at component level!