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

react-onclickoutside does not export default props of wrapped component #309

Open
psekaruipath opened this issue Feb 5, 2019 · 1 comment

Comments

@psekaruipath
Copy link

psekaruipath commented Feb 5, 2019

Issue:

I have a component A with default propA which is wrapped inside onClickOutside HOA like so,

class ComponentA extends React.Component {
  static defaultProps {
    propA: true,
  }
  ....
}

export default onClickOutside(ComponentA)

When I am using this component in another component, componentA.props.propA is undefined instead of true.

When I look at the code, I see that it is not merging wrapped component's default props with its own default props.

My workaround for the issue:
I have a work around in my code which wraps this wrapped component and that exposes the same default props. It is not the correct fix but it unblocked me for now.

Bug Fix Request:
Right place to add that logic is in your library so the wrapped component's default props plus the library's default props are exported properly.

@Pomax
Copy link
Owner

Pomax commented Feb 19, 2019

This should probably be fixed with the React 16+ forwardRef system, in a v7 with the current system of manually figuring out what's being wrapped getting relegated to a deprecated 6.x

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

No branches or pull requests

2 participants