Storybook: Addon-docs: React forwardRef breaks Props block

Created on 30 Aug 2019  路  5Comments  路  Source: storybookjs/storybook

Ref: https://github.com/storybookjs/storybook/pull/4961

To Reproduce
component:

import React from 'react'
import { string } from 'prop-types'

const Title = React.forwardRef((props, ref) => (
  return <div ref={ref}>{prop.text}</div>
))

Title.propTypes = { 
  text: string.isRequired
}

export default Title

story:

import React from 'react'
import Title from './Title'

export default {
    title: 'Example|Title',
    parameters: {
        component: Title
    }
}

export const newUser = () => <Title text="Ted Doe"  />

Expected behavior
The props table should show props.text is of type string

Screenshots
image

System:
System:
OS: macOS 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Binaries:
Node: 12.6.0 - ~/.nvm/versions/node/v12.6.0/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.11.2 - ~/.nvm/versions/node/v12.6.0/bin/npm
Browsers:
Chrome: 76.0.3809.132
Firefox: 68.0.2
Safari: 12.1.2
npmPackages:
@storybook/addon-a11y: ^5.2.0-rc.0 => 5.2.0-rc.0
@storybook/addon-actions: ^5.2.0-rc.0 => 5.2.0-rc.0
@storybook/addon-docs: ^5.2.0-rc.0 => 5.2.0-rc.0
@storybook/addon-knobs: ^5.2.0-rc.0 => 5.2.0-rc.0
@storybook/addon-storysource: ^5.2.0-rc.0 => 5.2.0-rc.0
@storybook/addons: ^5.2.0-rc.0 => 5.2.0-rc.0
@storybook/react: ^5.2.0-rc.0 => 5.2.0-rc.0
@storybook/source-loader: ^5.2.0-rc.0 => 5.2.0-rc.0

docs react bug help wanted todo

All 5 comments

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!

@shilman I'm trying to fix this issue 馃檱

@darmawanalbert the same applies to memo(Component)

Huzzah!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.3.0-alpha.23 containing PR #8445 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

Jeepers creepers!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.2.5 containing PR #8445 that references this issue. Upgrade today to try it out!

Was this page helpful?
0 / 5 - 0 ratings