diff --git a/src/core/ReactCompositeComponent.js b/src/core/ReactCompositeComponent.js
index f1fe60e850c..cb7af8b08ff 100644
--- a/src/core/ReactCompositeComponent.js
+++ b/src/core/ReactCompositeComponent.js
@@ -678,7 +678,7 @@ var ReactCompositeComponentMixin = {
for (propName in propTypes) {
var checkProp = propTypes[propName];
if (checkProp) {
- checkProp(props, propName, componentName);
+ checkProp.call(this, props, propName, componentName);
}
}
}
diff --git a/src/core/__tests__/ReactCompositeComponent-test.js b/src/core/__tests__/ReactCompositeComponent-test.js
index b0b6f04bf79..ae3158ffc62 100644
--- a/src/core/__tests__/ReactCompositeComponent-test.js
+++ b/src/core/__tests__/ReactCompositeComponent-test.js
@@ -266,6 +266,30 @@ describe('ReactCompositeComponent', function() {
}).not.toThrow();
});
+ it('should allow custom propTypes to use mixins', function(){
+ var Mixin = {
+ keyValidation: function(){
+ throw new Error('Validation failed!');
+ }
+ }
+
+ var Component = React.createClass({
+ mixins: [Mixin],
+ propTypes: {
+ key: function(){
+ this.keyValidation();
+ }
+ },
+ render: function() {
+ return ;
+ }
+ });
+
+ expect(function() {
+ ReactTestUtils.renderIntoDocument();
+ }).toThrow('Validation failed!');
+ });
+
it('should not allow `forceUpdate` on unmounted components', function() {
var container = document.createElement('div');
document.documentElement.appendChild(container);