Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using react HOC pattern - not showing propTypes in generated doc. #50

Open
vimalkodoth opened this issue Dec 15, 2019 · 2 comments
Open

Comments

@vimalkodoth
Copy link

vimalkodoth commented Dec 15, 2019

I'm trying to use @component for my base component which is passed to say, a withFocusable higher-order function returns a higher-order component as below.
/**
*Item to render within List
*@component
*/
function ListItem(props){
// returns a JSX
}

ListItem.propTypes = {
/** Description for item */
item : PropTypes.object.isRequired,
index : PropTypes.number.isRequired,
forwardedRef: PropTypes.node
}
export default withFocusable(ListItem, {initialFocusId : 'item0'});

Generated document has only constructor section something like below and doesn't show any prop types section ( table ) or even these props with description.

ListItem
Item to render within List

@jynnie
Copy link

jynnie commented Mar 21, 2020

Similar, but even the normal Documented component's prop types table isn't showing up.

image

/**
 * Some documented component
 *
 * @component
 * @example
 * const size = 12
 * const text = 'I am documented!'
 * return (
 *   <Documented size={size} text={text} />
 * )
 */
const Documented = props => {
  const { text, size } = props;
  return (
    <p style={{ fontSize: size, padding: 10, border: "1px solid #ccc" }}>
      {text}
    </p>
  );
};

Documented.propTypes = {
  /**
   * Text is a text :)
   */
  text: PropTypes.string.isRequired,
  /**
   * Font size
   */
  size: PropTypes.number,
};

Documented.defaultProps = {
  text: "Hello World",
  size: 12,
};

@sachinpatil55
Copy link

can you please try by adding
export default Documented at bottom line, it should work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants