Seeing an issue where wrapping a component in forwardRef results in the descriptions resolving to null.
Works:
import PropTypes from 'prop-types';
import React from 'react';
const Label = ({ children, ...other }) => {
return <div {...other}>{children}</div>;
};
Label.propTypes = {
/** Content of the label */
children: PropTypes.node,
/** Blue style label */
blue: PropTypes.bool,
/** Green style label */
green: PropTypes.bool,
/** Yellow style label */
yellow: PropTypes.bool,
/** Red style label */
red: PropTypes.bool
};
Label.defaultProps = {};
export default Label;
Broken:
import PropTypes from 'prop-types';
import React, {forwardRef} from 'react';
const Label = forwardRef(({ children, ...other }, ref) => {
return <div {...other} ref={ref}>{children}</div>;
});
Label.propTypes = {
/** Content of the label */
children: PropTypes.node,
/** Blue style label */
blue: PropTypes.bool,
/** Green style label */
green: PropTypes.bool,
/** Yellow style label */
yellow: PropTypes.bool,
/** Red style label */
red: PropTypes.bool
};
Label.defaultProps = {};
export default Label;
It's interesting that the rest of the prop definition exists and only the description is dropped. Is this a known issue? It seems slightly different from other issues related to HOC in that even if the component name is resolved correctly, the prop definition is not complete.
Seeing an issue where wrapping a component in
forwardRefresults in the descriptions resolving tonull.Works:
Broken:
It's interesting that the rest of the prop definition exists and only the description is dropped. Is this a known issue? It seems slightly different from other issues related to HOC in that even if the component name is resolved correctly, the prop definition is not complete.