forked from treehouse/mastodon
Replace onWheel listener with onScroll (#3324)
* Replace onWheel listener with onScroll * Update column.jsrebase/4.0.0rc2
parent
c6db416ff7
commit
2531c5953b
|
@ -1,6 +1,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ColumnHeader from './column_header';
|
import ColumnHeader from './column_header';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import { debounce } from 'lodash';
|
||||||
|
|
||||||
const easingOutQuint = (x, t, b, c, d) => c*((t=t/d-1)*t*t*t*t + 1) + b;
|
const easingOutQuint = (x, t, b, c, d) => c*((t=t/d-1)*t*t*t*t + 1) + b;
|
||||||
|
|
||||||
|
@ -48,11 +49,11 @@ class Column extends React.PureComponent {
|
||||||
this._interruptScrollAnimation = scrollTop(scrollable);
|
this._interruptScrollAnimation = scrollTop(scrollable);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleWheel = () => {
|
handleScroll = debounce(() => {
|
||||||
if (typeof this._interruptScrollAnimation !== 'undefined') {
|
if (typeof this._interruptScrollAnimation !== 'undefined') {
|
||||||
this._interruptScrollAnimation();
|
this._interruptScrollAnimation();
|
||||||
}
|
}
|
||||||
}
|
}, 200)
|
||||||
|
|
||||||
setRef = (c) => {
|
setRef = (c) => {
|
||||||
this.node = c;
|
this.node = c;
|
||||||
|
@ -74,7 +75,7 @@ class Column extends React.PureComponent {
|
||||||
role='region'
|
role='region'
|
||||||
aria-labelledby={columnHeaderId}
|
aria-labelledby={columnHeaderId}
|
||||||
className='column'
|
className='column'
|
||||||
onWheel={this.handleWheel}>
|
onScroll={this.handleScroll}>
|
||||||
{header}
|
{header}
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue