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

Add scroll-behavior to restore browser-like scroll behaviors #163

Merged
merged 1 commit into from
Mar 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add scroll-behavior to restore browser-like scroll behaviors
Fixes #141
  • Loading branch information
KyleAMathews committed Mar 1, 2016
commit b4122dbb36fac74b1e3e7f814a90ab4cfbb71155
5 changes: 4 additions & 1 deletion lib/utils/web-entry.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import React from 'react'
import ReactDOM from 'react-dom'
import { browserHistory, Router } from 'react-router'
import useScroll from 'scroll-behavior/lib/useStandardScroll'
const scrollHistory = useScroll(() => browserHistory)()

import createRoutes from 'create-routes'
import app from 'app'

Expand Down Expand Up @@ -30,7 +33,7 @@ loadConfig(() =>

ReactDOM.render(
<Router
history={browserHistory}
history={scrollHistory}
routes={routes}
/>,
typeof window !== 'undefined' ? document.getElementById('react-mount') : void 0)
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"react-transform-hmr": "^1.0.0",
"redbox-react": "^1.0.1",
"sass-loader": "^3.1.2",
"scroll-behavior": "^0.3.2",
"slash": "^1.0.0",
"static-site-generator-webpack-plugin": "^2.0.1",
"style-loader": "^0.13.0",
Expand Down