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

"StyledComponent" Component - No propTypes defined! #6417

Closed
rwieruch opened this issue Apr 4, 2019 · 16 comments
Closed

"StyledComponent" Component - No propTypes defined! #6417

rwieruch opened this issue Apr 4, 2019 · 16 comments

Comments

@rwieruch
Copy link
Contributor

rwieruch commented Apr 4, 2019

After upgrading from Storybook 4.x.x to 5.0.6., I am not able anymore to see the assigned propTypes for Styled Components in Storybook anymore.

That's what I see in Storybook:


Screen Shot 2019-04-04 at 11 56 05


That's what I have coded:

const TabBar = styled.div`
  display: flex;
  flex-direction: column;
`;

TabBar.displayName = 'TabBar';

TabBar.propTypes = {
  children: PropTypes.arrayOf(
    PropTypes.shape({
      type: PropTypes.oneOf([TabBar.ContentTab]),
    }),
  ).isRequired,
};

And I would expect to see the children prop types instead.

Note: It works for other components which haven't defined with styled components though.

@shilman
Copy link
Member

shilman commented Apr 4, 2019

So this worked as is in 4.x and then just broke in 5.0? Are you using a custom webpack config?

@rwieruch
Copy link
Contributor Author

rwieruch commented Apr 4, 2019

I checked again and it worked with 4.1.11. @shilman It looked at least like this:


Screen Shot 2019-04-04 at 17 04 34


That's my custom webpack config:

module.exports = ({ config }) => {
  config.module.rules.push(
    {
      test: /\.(js|jsx)$/,
      exclude: /node_modules/,
      use: ['babel-loader'],
    },
    {
      test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
      use: ['file-loader'],
    },
    {
      test: /stories\.(js|jsx)?$/,
      loaders: [require.resolve('@storybook/addon-storysource/loader')],
      enforce: 'pre',
    },
  );

  return config;
};

@shilman
Copy link
Member

shilman commented Apr 4, 2019

Thanks for confirming @rwieruch. I'm working on a replacement for addon-info, and will keep my eyes out for this. I'll also fix it in addon-info assuming that it's an easy fix.

@rwieruch
Copy link
Contributor Author

rwieruch commented Apr 4, 2019

Perfect! Thank you @shilman 👍

@liamross
Copy link

liamross commented Apr 4, 2019

@shilman This may also be related to the bug I logged for the missing prop table in TypeScript: #6345

@oknoorap
Copy link

it's fixed already and published? @shilman

@shilman
Copy link
Member

shilman commented Apr 10, 2019

@oknoorap Nope, will comment here when it is. If anybody else wants to take a crack at it, they're more than welcome!

@stale
Copy link

stale bot commented May 1, 2019

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!

@stale stale bot added the inactive label May 1, 2019
@stale
Copy link

stale bot commented May 31, 2019

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!

@stale stale bot closed this as completed May 31, 2019
@cyrus-za
Copy link

Please let me know when this gets fixed. Quite annoying to see all these unknown styled components
image

Not using a custom webpack. Using CRA with typescript

@rwieruch
Copy link
Contributor Author

Not sure how to keep issues open when the stale bot comes along 😄

@shilman shilman reopened this Jun 16, 2019
@stale stale bot removed the inactive label Jun 16, 2019
@shilman
Copy link
Member

shilman commented Jun 16, 2019

FYI you might want to check out Storybook Docs which is designed to replace addon-info.

Here's the project description: https://medium.com/storybookjs/storybook-docs-sneak-peak-5be78445094a
And here's the guide to technical preview alpha you can use today: https://docs.google.com/document/d/1un6YX7xDKEKl5-MVb-egnOYN8dynb5Hf7mq0hipk8JE/edit?usp=sharing

@rwieruch
Copy link
Contributor Author

Thanks for sharing! Looks super promising and I will try it this week 👍

@shilman
Copy link
Member

shilman commented Jun 17, 2019

@rwieruch Great! Github issues welcome + we also have a discussion going in the #docs-mode channel in our discord around design feedback & support https://discord.gg/UUt2PJb

@stale
Copy link

stale bot commented Jul 8, 2019

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!

@stale stale bot added the inactive label Jul 8, 2019
@stale
Copy link

stale bot commented Aug 7, 2019

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!

@stale stale bot closed this as completed Aug 7, 2019
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

5 participants