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

The issue with forwardRef Component #76

Closed
xiaoshuangLi opened this issue Oct 22, 2019 · 2 comments
Closed

The issue with forwardRef Component #76

xiaoshuangLi opened this issue Oct 22, 2019 · 2 comments

Comments

@xiaoshuangLi
Copy link

Following Component won't have __docgenInfo.Because of the isReactForwardRefCall in react-docgen not recognize forwardRef(...). We get the ast base on (props, ref) => {...}.The actualNameHandler can't the right name we need.

import React, { forwardRef } from 'react';
import PropTypes from 'prop-types';

const Text = forwardRef((props, ref) => {
  return (
    <div>text</div>
  );
});

Text.defaultProps = {
  onClick: PropTypes.func,
  children: PropTypes.node,
  style: PropTypes.object,
};

export default Text;

@danielduan
Copy link
Member

@xiaoshuangLi you are more than welcome to open a PR to fix the bug and add some test cases. unfortunately, I don't have much bandwidth these days to do much feature work.

@xiaoshuangLi
Copy link
Author

@danielduan Good news, react-docgen fixed it hours ago. reactjs/react-docgen#385

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

No branches or pull requests

2 participants