Fix ref passed to Stack error

This commit is contained in:
Justin 2022-08-31 14:31:44 -04:00
parent 0940896448
commit 6486f3b539

View file

@ -37,12 +37,13 @@ interface IStack extends React.HTMLAttributes<HTMLDivElement> {
}
/** 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;
return (
<div
{...filteredProps}
ref={ref}
className={classNames('flex flex-col', {
// @ts-ignore
[spaces[space]]: typeof space !== 'undefined',
@ -54,6 +55,6 @@ const Stack: React.FC<IStack> = (props) => {
}, className)}
/>
);
};
});
export default Stack;