Bind the onWheel listener directly to props

React doesn't seem to care if this is null/undefined.
This commit is contained in:
Travis Ralston 2019-04-05 09:43:29 -06:00
parent 138fd4ec87
commit 17a57eb3e5

View file

@ -118,19 +118,13 @@ export default class AutoHideScrollbar extends React.Component {
return this.containerRef.scrollTop; return this.containerRef.scrollTop;
} }
onWheel = (e) => {
if (this.props.onWheel) {
this.props.onWheel(e);
}
};
render() { render() {
return (<div return (<div
ref={this._collectContainerRef} ref={this._collectContainerRef}
style={this.props.style} style={this.props.style}
className={["mx_AutoHideScrollbar", this.props.className].join(" ")} className={["mx_AutoHideScrollbar", this.props.className].join(" ")}
onScroll={this.props.onScroll} onScroll={this.props.onScroll}
onWheel={this.onWheel} onWheel={this.props.onWheel}
> >
<div className="mx_AutoHideScrollbar_offset"> <div className="mx_AutoHideScrollbar_offset">
{ this.props.children } { this.props.children }