1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

ArticleListに自動scroll機能追加

This commit is contained in:
Rokt33r
2015-11-01 02:37:22 +09:00
parent d338f217fe
commit 522c0edd90
3 changed files with 32 additions and 3 deletions

View File

@@ -18,12 +18,12 @@ class HomePage extends React.Component {
componentDidMount () {
// React自体のKey入力はfocusされていないElementからは動かないため、
// `window`に直接かける
this.listener = (e) => this.handleKeyDown(e)
window.addEventListener('keydown', this.listener)
this.keyHandler = e => this.handleKeyDown(e)
window.addEventListener('keydown', this.keyHandler)
}
componentWillUnmount () {
window.removeEventListener('keydown', this.listener)
window.removeEventListener('keydown', this.keyHandler)
}
handleKeyDown (e) {