-
Notifications
You must be signed in to change notification settings - Fork 47.6k
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
Mixins aren't available to custom propType validations #431
Comments
Note: My current workaround is to make the mixin available globally and use it directly.
I'm fairly new to the react.js source, so I have no idea the level of effort for this enhancement request. But seeing how there is a reasonable workaround, I'm not viewing this as a high priority request. |
This makes sense to me. Should be a pretty simple fix -- just change
to
in src/core/ReactCompositeComponent.js:681. |
Made this patch in my project and works great! I'll open a pull request. |
I'm pretty sure we're never going to make this happen. We've moving towards a more static world for proptypes so using |
In writing a custom
propTypes
validation function, I would like to be able to access mixins, for shared validation behavior.Given the following mixin:
My goal would be that I could do the following:
But this fails because
this
iswindow
, not the instance. Is it possible to autobind propType functions?Here is a jsfiddle of the above code (slightly modified): http://jsfiddle.net/kXysA/1/
For reference: I also tried the following, but I'm not surprised this failed because
this
isundefined
in this context:The text was updated successfully, but these errors were encountered: