Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added reaction on disableOnClickOutside property change #318

Conversation

todesstoss
Copy link

Added reaction on disableOnClickOutside property change. Activates on false, deactivates on true.
Currently this property affects activation only on component’s mount phase

Fix for #317

@dbratz1177
Copy link

bump on this getting merged. i'm currently having to do a work around for the issue this addresses

src/index.js Outdated
if (this.props.disableOnClickOutside) return;
this.enableOnClickOutside();
}

componentDidUpdate() {
componentDidUpdate({ disableOnClickOutside: prevDisableOnClickOutside }) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break on IE11. As much as I want to burn IE to the ground, for now this code still has to live in a previous era of JS. We'll have to cache that value the older way.

Suggested change
componentDidUpdate({ disableOnClickOutside: prevDisableOnClickOutside }) {
componentDidUpdate(prevProps) {
var prevDisableOnClickOutside = prevProps.disableOnClickOutside;

src/index.js Outdated
if (this.props.disableOnClickOutside) return;
this.enableOnClickOutside();
}

componentDidUpdate() {
componentDidUpdate({ disableOnClickOutside: prevDisableOnClickOutside }) {
const { disableOnClickOutside } = this.props;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it'll break on this, too.

Suggested change
const { disableOnClickOutside } = this.props;
var disableOnClickOutside = this.props.disableOnClickOutside;

@Pomax
Copy link
Owner

Pomax commented Aug 11, 2019

This will need a rebase, but mostly because v6.9.0 was released in the mean time, which introduced just enough code to require manual code selection.

@todesstoss todesstoss force-pushed the disableonclickoutside-property-change-reaction-added branch from 8f7320f to db972dc Compare October 24, 2019 08:29
@todesstoss
Copy link
Author

Sorry for the delay. PR Updated

@tomasztomys
Copy link

please merge

@bkingery
Copy link

+1 on getting this merged.

@Pomax Pomax closed this Mar 22, 2023
@tomasztomys
Copy link

why closed?

@Pomax
Copy link
Owner

Pomax commented Oct 16, 2023

Because time moved on and React completely changed how things are "supposed to be done". Modern React is based on hooks, and https://github.com/Pomax/react-onclickoutside#functional-component-with-usestate-hook explains how to do what this HoC achieved for older versions of React.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants