Skip to content

Commit

Permalink
Merge pull request #163 from gatsbyjs/add-scroll-behavior
Browse files Browse the repository at this point in the history
Add scroll-behavior to restore browser-like scroll behaviors
  • Loading branch information
KyleAMathews committed Mar 1, 2016
2 parents 17be1b4 + b4122db commit 2e1a588
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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

0 comments on commit 2e1a588

Please sign in to comment.