Skip to content

Commit

Permalink
fix: remove binding from render
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoddox committed Jul 27, 2018
1 parent 7ec39b6 commit 84bb1d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "react-redux-toastr",
"version": "7.3.0",
"version": "7.4.0",
"description": "react-redux-toastr is a React toastr message implemented with Redux",
"main": "lib/index.js",
"jsnext:main": "./src/index.js",
Expand Down
20 changes: 10 additions & 10 deletions src/ToastrBox.js
Expand Up @@ -80,7 +80,7 @@ export default class ToastrBox extends React.Component {
}
}

handlePressEnterOrSpaceKeyToastr(e) {
handlePressEnterOrSpaceKeyToastr = (e) => {
if (e.key === ' ' || e.key === 'enter') {
this.handleClickToastr(e);
}
Expand All @@ -92,7 +92,7 @@ export default class ToastrBox extends React.Component {
}
}

handleClickToastr() {
handleClickToastr = () => {
let {onToastrClick, closeOnToastrClick} = this.props.item.options;
this.ignoreIsHiding = true;

Expand All @@ -106,7 +106,7 @@ export default class ToastrBox extends React.Component {
}
}

handleClickCloseButton(e) {
handleClickCloseButton = (e) => {
let {onCloseButtonClick} = this.props.item.options;
e.stopPropagation();

Expand All @@ -120,7 +120,7 @@ export default class ToastrBox extends React.Component {
this._removeToastr();
}

mouseEnter() {
mouseEnter = () => {
clearTimeout(this.intervalId);

this._setIntervalId(null);
Expand All @@ -134,7 +134,7 @@ export default class ToastrBox extends React.Component {
}
}

mouseLeave() {
mouseLeave = () => {
const {removeOnHover, removeOnHoverTimeOut} = this.props.item.options;

if (!this.isHiding && (removeOnHover || this.shouldClose)) {
Expand Down Expand Up @@ -188,7 +188,7 @@ export default class ToastrBox extends React.Component {
<button
type="button"
className="close-toastr"
onClick={this.handleClickCloseButton.bind(this)}
onClick={this.handleClickCloseButton}
>
&#x2715;
</button>
Expand Down Expand Up @@ -331,8 +331,8 @@ export default class ToastrBox extends React.Component {
if (hasOnToastrClick || doesCloseOnToastrClick) {
toastrClickAttributes.role = 'button';
toastrClickAttributes.tabIndex = 0;
toastrClickAttributes.onClick = this.handleClickToastr.bind(this);
toastrClickAttributes.onKeyPress = this.handlePressEnterOrSpaceKeyToastr.bind(this);
toastrClickAttributes.onClick = this.handleClickToastr;
toastrClickAttributes.onKeyPress = this.handlePressEnterOrSpaceKeyToastr;
}

return (
Expand All @@ -345,8 +345,8 @@ export default class ToastrBox extends React.Component {
options.className
)}

onMouseEnter={this.mouseEnter.bind(this)}
onMouseLeave={this.mouseLeave.bind(this)}
onMouseEnter={this.mouseEnter}
onMouseLeave={this.mouseLeave}
{...toastrClickAttributes}
>
{this.toastr()}
Expand Down

0 comments on commit 84bb1d6

Please sign in to comment.