Skip to content

Commit

Permalink
added reaction on disableOnClickOutside property change: activates on…
Browse files Browse the repository at this point in the history
… false, deactivates on true
  • Loading branch information
todesstoss committed Oct 24, 2019
1 parent 5a67136 commit 455c2c7
Show file tree
Hide file tree
Showing 5 changed files with 8,995 additions and 21 deletions.
15 changes: 13 additions & 2 deletions dist/react-onclickoutside.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,19 @@ function onClickOutsideHOC(WrappedComponent, config) {
this.enableOnClickOutside();
};

_proto.componentDidUpdate = function componentDidUpdate() {
this.componentNode = this.__getComponentNode();
_proto.componentDidUpdate = function componentDidUpdate(_ref) {
var prevDisableOnClickOutside = _ref.disableOnClickOutside;
var disableOnClickOutside = this.props.disableOnClickOutside;
this.componentNode = this.__getComponentNode(); // Enable onClickOutside on prop change to `true`

if (prevDisableOnClickOutside && !disableOnClickOutside) {
this.enableOnClickOutside();
} // Disable onClickOutside on prop change to `false`


if (!prevDisableOnClickOutside && disableOnClickOutside) {
this.disableOnClickOutside();
}
};
/**
* Remove all document's event listeners for this component
Expand Down
2 changes: 1 addition & 1 deletion dist/react-onclickoutside.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 455c2c7

Please sign in to comment.