-
Notifications
You must be signed in to change notification settings - Fork 50k
Closed
Description
Checked with React v0.12.2 running in Chrome 40.0.2214.93, Safari 8.0.2, and Firefox 35.0.
I'm able to reproduce this issue with the following:
// icon.jsx
var Icon = React.createClass({
propTypes: {
icon: React.PropTypes.string.isRequired
},
render: function() {
return <span className={this.props.icon} />;
}
});
module.exports = Icon;
// wrapper.jsx
var Icon = require('./icon.jsx');
var Wrapper = React.createClass({
propTypes: {
icon: React.PropTypes.instanceOf(Icon).isRequired,
},
render: function() {
return <button className="btn">{this.props.icon}</button>;
}
});
module.exports = Wrapper
When I render an instance of Wrapper as
// var icon = <Icon icon="some-icon" />
<Wrapper icon={icon} />
I get the error
Warning: Invalid prop `icon` supplied to `Wrapper`, expected instance of `<<anonymous>>`. Check the render method of `[the parent component]`.
(I was also able to reproduce the issue here: http://jsbin.com/necequvimi/2/ )
It seems like the instanceOf prop-type checker isn't working as expected, but maybe I've missed something.
mnpenner, herrherrmann, statico, fatih108, mwjaco and 2 more
Metadata
Metadata
Assignees
Labels
No labels