Skip to content

Commit

Permalink
Props: #8894 forward-ref repro
Browse files Browse the repository at this point in the history
  • Loading branch information
shilman committed Feb 14, 2020
1 parent 85e4f6d commit 822f3df
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
@@ -0,0 +1,22 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`react component properties 8894-ts-forward-ref 1`] = `
"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import React from 'react';

const InnerBox = props => React.createElement(React.Fragment, null, JSON.stringify(props));
/**
* Use \`Box\` component to handle margins/paddings.
*/


export const Box = React.forwardRef((props, ref) => React.createElement(InnerBox, _extends({}, props, {
ref: ref
})));
export const component = Box;
Box.__docgenInfo = {
\\"description\\": \\"Use \`Box\` component to handle margins/paddings.\\",
\\"methods\\": []
};"
`;
@@ -0,0 +1,18 @@
import React from 'react';
import styled from 'styled-components';

type Props = {
pt?: number | string;
p?: number | string;
};

const InnerBox: React.FC<Props> = props => <>{JSON.stringify(props)}</>;

/**
* Use `Box` component to handle margins/paddings.
*/
export const Box: React.FC<Props> = React.forwardRef<HTMLDivElement, Props>((props, ref) => (
<InnerBox {...props} ref={ref} />
));

export const component = Box;
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`react component properties 8894-ts-forward-ref 1`] = `
Object {
"rows": Array [],
}
`;
Expand Up @@ -16,6 +16,7 @@ const fixtures = [
'8140-js-prop-types-oneof',
'9023-js-hoc',
'8740-ts-multi-props',
'8894-ts-forward-ref',
];

const stories = storiesOf('Properties/React', module);
Expand Down

0 comments on commit 822f3df

Please sign in to comment.