Fix ref passed to Stack error
This commit is contained in:
parent
0940896448
commit
6486f3b539
1 changed files with 3 additions and 2 deletions
|
@ -37,12 +37,13 @@ interface IStack extends React.HTMLAttributes<HTMLDivElement> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Vertical stack of child elements. */
|
/** Vertical stack of child elements. */
|
||||||
const Stack: React.FC<IStack> = (props) => {
|
const Stack: React.FC<IStack> = React.forwardRef((props, ref: React.LegacyRef<HTMLDivElement> | undefined) => {
|
||||||
const { space, alignItems, justifyContent, className, grow, ...filteredProps } = props;
|
const { space, alignItems, justifyContent, className, grow, ...filteredProps } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
{...filteredProps}
|
{...filteredProps}
|
||||||
|
ref={ref}
|
||||||
className={classNames('flex flex-col', {
|
className={classNames('flex flex-col', {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
[spaces[space]]: typeof space !== 'undefined',
|
[spaces[space]]: typeof space !== 'undefined',
|
||||||
|
@ -54,6 +55,6 @@ const Stack: React.FC<IStack> = (props) => {
|
||||||
}, className)}
|
}, className)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
});
|
||||||
|
|
||||||
export default Stack;
|
export default Stack;
|
||||||
|
|
Loading…
Reference in a new issue