Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
orkunkarakus committed May 4, 2022
1 parent 5c13765 commit 32de902
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const BasePreRenderer = forwardRef((props, ref) => {
);
});

BasePreRenderer.displayName = 'BasePreRenderer';
BasePreRenderer.propTypes = htmlRendererPropTypes;

export default withLocalize(BasePreRenderer);
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ class PreRenderer extends React.Component {
super(props);

this.scrollNode = this.scrollNode.bind(this);
this.ref = React.createRef(null);
}

componentDidMount() {
if (!this.ref.current) {
if (!this.ref) {
return;
}
this.ref.current
this.ref
.getScrollableNode()
.addEventListener('wheel', this.scrollNode);
}
Expand All @@ -26,7 +25,7 @@ class PreRenderer extends React.Component {
}

scrollNode(event) {
const node = this.ref.current.getScrollableNode();
const node = this.ref.getScrollableNode();
const horizontalOverflow = node.scrollWidth > node.offsetWidth;

if ((event.currentTarget === node) && horizontalOverflow) {
Expand All @@ -41,7 +40,7 @@ class PreRenderer extends React.Component {
<BasePreRenderer
// eslint-disable-next-line react/jsx-props-no-spreading
{...this.props}
ref={el => this.ref.current = el}
ref={el => this.ref = el}
/>
);
}
Expand Down

0 comments on commit 32de902

Please sign in to comment.