Warning: Failed prop type: `Bar.children` only accepts components named Foo, got null
I believe this is down to this helper function only checking that the component is a function, when it becomes an object after it's wrapped in the forwardRef. Would there be any possibility of checking that the component type is a function or an object?
Consider the following:
When used like this,
childrenOf
andcomponentWithName
work as expected. However, if we wrapFoo
in aforwardRef
wrapper like so:Then we receive the following warning:
I believe this is down to this helper function only checking that the component is a
function
, when it becomes anobject
after it's wrapped in theforwardRef
. Would there be any possibility of checking that the component type is afunction
or anobject
?https://github.com/airbnb/prop-types/blob/5a08d03a74d2dbbf05455de47c23783d46929c3f/src/helpers/getComponentName.js#L7