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

rename isOpened prop to isOpen, add deprecation notice #82

Merged
merged 3 commits into from
Dec 29, 2016

Conversation

dlindenkreuz
Copy link
Contributor

fixes #61

@dlindenkreuz dlindenkreuz reopened this Jul 4, 2016
@tajo
Copy link
Owner

tajo commented Jul 5, 2016

The deprecation notice should be produced by the library. isOpened should be still supported (aliased to isOpen) in the next major version v3. The complete removal can be done in v4.

@dlindenkreuz
Copy link
Contributor Author

Adding a HOC to transform the props breaks almost all tests. Do you have a suggestion for providing isOpen that isn't super arduous? Just pushed a PropType validation with deprecation notice, though.

@ianstormtaylor
Copy link

+1 would love to see this merged!

if (typeof props[propName] !== 'undefined') {
return new Error(
`Deprecated prop \`${propName}\` supplied to \`${componentName}\`.
Please use \`isOpen\` in the future.`

Choose a reason for hiding this comment

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

"In the future" might be misleading here - this is an error, you have to use isOpen for the portal to work, right?

Copy link
Owner

@tajo tajo Dec 29, 2016

Choose a reason for hiding this comment

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

Yep. I'm going to change the message.

@tajo tajo merged commit 77efed7 into tajo:master Dec 29, 2016
@tajo
Copy link
Owner

tajo commented Dec 29, 2016

Merged. Thanks!

@tajo tajo added this to the v4 milestone Dec 29, 2016
@STRML
Copy link
Contributor

STRML commented Dec 29, 2016

As a point of discussion (I can open up another issue if you like), why does this prop even exist?

It makes more sense to me to simply always render the portal if it's in the tree, and to just not render it if you want to hide it. Like so:

return (
  <div>
    <button onClick={() => this.setState({opened: !this.state.opened})}>Toggle</button>
    {this.state.opened ? 
      <Portal><div>Portal Contents</div></Portal>
    : null}
  </div>
);

@tajo
Copy link
Owner

tajo commented Dec 29, 2016

I like the idea of not using isOpen. Can you open an issue / PR? I feel this deserves more discussion and attention from other people.

Why does this prop even exist?

I guess I thought it's more intuitive.

@STRML STRML mentioned this pull request Dec 29, 2016
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.

isOpened to isOpen
5 participants