-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
No propTypes/description column for React class components #8428
Comments
Hi @kkoch986, are you able to provide details of your environment? |
I'm not sure if this is the case w/ your react-dogen loader, but with
(source) It might be worth trying to import the named export from React |
@TaeKimJR thanks for the suggestion, im not currently using typescript but i tried that suggestion anyway with no luck unfortunately @mrmckeb what other details are you looking for? Here is the package json for the project if thats helpful:
|
Like stated in #8143, this should be solvable if you import
|
@jonathanherdt i also tried that with the above test component and it didnt seem to change anything. does it make a difference that im not using typescript? i dont have those test component hot anymore from the original issue but heres a component using it still with not prop types: import React, { Component } from 'react';
import PropTypes from 'prop-types';
export default class MultiText extends Component {
...
}
MultiText.propTypes = {
/**
* String representing the value of this component.
* Should be a JSON encoded array of each element
*/
value: PropTypes.string.isRequired,
/**
* The label for the data that this component represents
*/
label: PropTypes.string,
/**
* Fired when the data of this component changes.
* Will be given one argument which is a string
*/
onChange: PropTypes.func.isRequired,
};
MultiText.defaultProps = {
label: null,
}; |
Right, not using TypeScript and using CSF might make a difference. Sorry to hear that it didn't work for you :( |
I cant see the description and default value either. I'm using Gatsby, CSF, jsx (no typescript) and functional components (so no |
Issue on the docgen side: storybookjs/babel-plugin-react-docgen#66 |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook! |
Repro 28f7a7e |
If this is helpful, I'm on version "@storybook/react": "^6.0.0-beta.23" and it's working on the netlify when using the build-storybook for a react class component, but not locally where I'm using the yarn storybook command. Netlify (I obscured the URL): Localhost:
|
That's pretty nutso. If anything I'd expect the opposite! |
I'm having this issue as well, but noticed at least in my cases that it seemed to be caused by arrow binding functions existing in the class. It seems to happen whenever there is a class with arrow binding functions in the target file in general, even if that component/class is not the default export or even the one being used as the component in the stories. No issue:
Has the no props found issue:
Edit: Adding |
I have arrow functions in my class component. I just updated to the most recent beta, and it's working locally now! I've got no babel.config.js |
@xveganxxxedgex Thanks, I ran into the same issue but I use |
We’re cleaning house! Storybook has changed a lot since this issue was created and we don’t know if it’s still valid. Please open a new issue referencing this one if:
|
Describe the bug
When defining a react component with a class extending from
React.Component
the type and docgen description do not appear in the props table. Functional components seem to work fine.Edit: sorry didnt realize i couldnt tag the issue. This pertains specifically to the docs page addon
When i create a component like this:
with this story:
i get the following props table:
If i instead define the same component as a functional component:
i get this (for the exact same story):
I have noticed that
defaultProps
do work in both cases so its just that middle column that seems gone.To Reproduce
create a component like this:
with this story:
Expected behavior
The description column for the
test
prop should include the "please work" comment as well as the "string" type.it should look like this:
Screenshots
Included above
Code snippets
Included above
System:
Additional context
I tried to do some digging and only managed to find that in
getPropDefs
type.__docgenInfo
is undefined.type
looks like:vs the functional component where
type.__docgeninfo
has stuff in it:and
type
:not really sure about the details of how that all works, but that was about as far as my digging took me.
The text was updated successfully, but these errors were encountered: