forked from remix-run/react-router
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Yet another large refactoring (hooray!)
[added] Navigation mixin for components that need to modify the URL [added] CurrentPath mixin for components that need to know the current URL path [added] getActiveRoutes, getActiveParams, and getActiveQuery methods to ActiveState mixin [removed] Awkward updateActiveState callback from ActiveState mixin [removed] Router.PathState (use Router.CurrentPath instead) [removed] Router.Transitions (use Router.Navigation instead) [removed] Router.RouteLookup (because it was useless) [added] <Routes scrollBehavior="browser"> as an alternative to scrollBehavior="imitateBrowser" [changed] <Routes fixedPath> => <Routes initialPath>. Currently only used in testing, but will be useful for SSR [added] <Routes onTransition> but starting to think the <Routes on*> hooks should be private
- Loading branch information
Showing
34 changed files
with
1,146 additions
and
1,110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
var LocationActions = require('../actions/LocationActions'); | ||
|
||
/** | ||
* A scroll behavior that attempts to imitate the default behavior | ||
* of modern browsers. | ||
*/ | ||
var ImitateBrowserBehavior = { | ||
|
||
updateScrollPosition: function (position, actionType) { | ||
switch (actionType) { | ||
case LocationActions.PUSH: | ||
case LocationActions.REPLACE: | ||
window.scrollTo(0, 0); | ||
break; | ||
case LocationActions.POP: | ||
window.scrollTo(position.x, position.y); | ||
break; | ||
} | ||
} | ||
|
||
}; | ||
|
||
module.exports = ImitateBrowserBehavior; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* A scroll behavior that always scrolls to the top of the page | ||
* after a transition. | ||
*/ | ||
var ScrollToTopBehavior = { | ||
|
||
updateScrollPosition: function () { | ||
window.scrollTo(0, 0); | ||
} | ||
|
||
}; | ||
|
||
module.exports = ScrollToTopBehavior; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.