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
pass context to mapPropsToFields #69
Conversation
if (mapPropsToFields) { | ||
this.fields = mapPropsToFields(nextProps); | ||
this.fields = mapPropsToFields(nextProps, nextContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I make a mistake.
It seems that you cannot get any value from nextContext
, for this HOC doesn't subscribe any value, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reverted this PR in master branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's same issue as with connect from redux, I suppose. You have to define contextTypes for wrapped component. E.g.:
this one will work
class A extends React.Component {...}
A = Form.create(mapper)(A);
A.contextTypes = {
}
export default A;
but this one will NOT work:
class A extends React.Component {...}
A.contextTypes = {
}
export default Form.create(mapper)(A);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can use a HOC to convert context to props, and then pass it to form.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#69 (comment) this is not a solution, it is confusing.
any update? |
Close: #68