Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

provides drilldown-style horizontal slide transitions between index and child routes

License

NotificationsYou must be signed in to change notification settings

jcoreio/react-router-drilldown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCICoverage Statussemantic-releaseCommitizen friendlynpm version

This is a simple component that provides drilldown-style horizontal slide transitions between index and child routes.It is based upon the<Switch> component fromreact-router v4 and usesreact-view-slider internally.

Forreact-router v2 or v3, see thelegacy project.

Live Demo

Usage

npm install --save react-router react-router-dom react-router-drilldown

Create a<Drilldown> element with child<Route>s exactly like you would for a<Switch>.By default the first child<Route> is at the left, and subsequent child routes will slide in from the right.However, you also customize the order by giving an integerkey to each child route.

importReactfrom'react'import{render}from'react-dom'import{BrowserRouterasRouter,Route,Link}from'react-router-dom'importDrilldownfrom'react-router-drilldown'constHome=()=>(<div><h1>Home</h1><p><Linkto="/users">Users</Link></p><p><Linkto="/users/andy">Andy</Link></p></div>)constUsers=({ match})=>(<div><h1>Users</h1><Linkto={`${match.url}/andy`}>Andy</Link></div>)constAndy=()=><h1>Andy</h1>render(<Router><Drilldown><Routeexactpath="/"component={Home}/><Routeexactpath="/users"component={Users}/><Routepath="/users/andy"component={Andy}/></Drilldown></Router>,document.getElementById('root'))

Note: if you transition directly from/ to/users/andy before ever visiting/users, the/users view will notshow in the middle of the animated transition. However, once you have visited/users, it will show between the othertwo views when transitioning between them.

Drilldowns can be nested

Instead of the flat route configuration shown above, you also use a separate drilldown at each level:

constUsersRoute=({ match})=>(<Drilldown><Routeexactpath={match.path}component={Users}/><Routepath={`${match.url}/andy`}component={Andy}/></Drilldown>)render(<Router><Drilldown><Routeexactpath="/"component={Home}/><Routepath="/users"component={UsersRoute}/></Drilldown></Router>,document.getElementById('root'))

Unlike the flat example above, you will not see the/users view fly by in the middle when transitioning directlyfrom/ to/users/andy.

Props

animateHeight: boolean (default:true)

If truthy, will animate its height to match the height of the page atactivePage.

keepViewsMounted: boolean (default:false)

If truthy, will keep all routes that have rendered before mounted.

keepPrecedingViewsMounted: boolean (default:false)

If truthy, will keep routes preceding the active route mounted (but not routes following the active route).The order is determined by the integerkey properties on your<Route>s.

transitionDuration: number (default:500)

The duration of the transition between pages.

transitionTimingFunction: string (default:'ease')

The timing function for the transition between pages.

prefixer: Prefixer

If given, overrides theinline-style-prefixer used to autoprefix inline styles.

fillParent: boolean (default:false)

If truthy,Drilldown will use absolute positioning on itself and its pages to fill its parent element.

className: string

Any extra class names to add to the root element.

style: Object

Extra inline styles to add to the root element.

viewportClassName: string

Any extra class names to add to the inner "viewport" element.

viewportStyle: Object

Extra inline styles to add to the inner "viewport" element.

viewStyle: Object

Extra inline styles to add to the view wrapper elements.

innerViewWrapperStyle: Object

Extra inline styles to add to the inner div between theviewStyle div and yourview content element. (The inner div was added to ensure perfect heightanimation.)

location: Location (default: accessed fromwithRouter)

If given, this location is used instead of the one fromwithRouter.

About

provides drilldown-style horizontal slide transitions between index and child routes

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp