Open SelaO opened 5 years ago
I'm not sure what you're asking - can you provide the actual component code?
Foo:
class Foo extends Component {
};
...
export default injectIntl(Foo);
Bar:
export default class Bar extends Component {
render() {
const Foo = this.props.foo;
return <Foo />;
}
}
FormDropZoneWrapper.propTypes = {
dropZoneComponent: PropTypes.func.isRequired, // I want here to validate that Foo is actually Foo and not some other component, but it's wrapped by intl so I can't
};
See the comment.
In that case, you'd use PropTypes.oneOf([Foo])
- iow, nobody can ever get at the unwrapped Foo, only the wrapped one, so you only have to validate that it's the wrapped one.
I want to validate the children of an element that's passed as children.
For example:
Where y is wrapped with injectIntl and, so I want to check in
x
that y is either of type "A" or type "B", but because it's wrapped, I need to go one level deep.Is there a way to do this with these proptypes?
childrenOfType
doesn't help because it can only check if it's of type injectIntl.