diff --git a/addons/docs/src/frameworks/react/__testfixtures__/9399-js-proptypes-shape/docgen.snapshot b/addons/docs/src/frameworks/react/__testfixtures__/9399-js-proptypes-shape/docgen.snapshot new file mode 100644 index 000000000000..700732942e9a --- /dev/null +++ b/addons/docs/src/frameworks/react/__testfixtures__/9399-js-proptypes-shape/docgen.snapshot @@ -0,0 +1,47 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`react component properties 9399-js-proptypes-shape 1`] = ` +"import React from 'react'; +import PropTypes from 'prop-types'; +export const Credits = ({ + areas +}) => React.createElement(React.Fragment, null, JSON.stringify(areas)); // https://github.com/storybookjs/storybook/issues/9399 + +Credits.propTypes = { + areas: PropTypes.arrayOf(PropTypes.shape({ + position: PropTypes.string.isRequired, + names: PropTypes.arrayOf(PropTypes.string).isRequired + })).isRequired +}; +export const component = Credits; +Credits.__docgenInfo = { + \\"description\\": \\"\\", + \\"methods\\": [], + \\"displayName\\": \\"Credits\\", + \\"props\\": { + \\"areas\\": { + \\"type\\": { + \\"name\\": \\"arrayOf\\", + \\"value\\": { + \\"name\\": \\"shape\\", + \\"value\\": { + \\"position\\": { + \\"name\\": \\"string\\", + \\"required\\": true + }, + \\"names\\": { + \\"name\\": \\"arrayOf\\", + \\"value\\": { + \\"name\\": \\"string\\" + }, + \\"required\\": true + } + } + } + }, + \\"required\\": true, + \\"description\\": \\"\\" + } + } +};" +`; diff --git a/addons/docs/src/frameworks/react/__testfixtures__/9399-js-proptypes-shape/input.js b/addons/docs/src/frameworks/react/__testfixtures__/9399-js-proptypes-shape/input.js new file mode 100644 index 000000000000..af120524fa8f --- /dev/null +++ b/addons/docs/src/frameworks/react/__testfixtures__/9399-js-proptypes-shape/input.js @@ -0,0 +1,16 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +export const Credits = ({ areas }) => <>{JSON.stringify(areas)}; + +// https://github.com/storybookjs/storybook/issues/9399 +Credits.propTypes = { + areas: PropTypes.arrayOf( + PropTypes.shape({ + position: PropTypes.string.isRequired, + names: PropTypes.arrayOf(PropTypes.string).isRequired, + }) + ).isRequired, +}; + +export const component = Credits;