mirror of
https://github.com/jeffvli/feishin.git
synced 2024-11-20 14:37:06 +01:00
Forward scrollarea ref
This commit is contained in:
parent
d6936634db
commit
81455602ef
@ -1,3 +1,4 @@
|
|||||||
|
import { forwardRef, Ref } from 'react';
|
||||||
import type { ScrollAreaProps as MantineScrollAreaProps } from '@mantine/core';
|
import type { ScrollAreaProps as MantineScrollAreaProps } from '@mantine/core';
|
||||||
import { ScrollArea as MantineScrollArea } from '@mantine/core';
|
import { ScrollArea as MantineScrollArea } from '@mantine/core';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
@ -18,13 +19,14 @@ const StyledScrollArea = styled(MantineScrollArea)`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const ScrollArea = ({ children, ...props }: ScrollAreaProps) => {
|
export const ScrollArea = forwardRef(({ children, ...props }: ScrollAreaProps, ref: Ref<any>) => {
|
||||||
return (
|
return (
|
||||||
<StyledScrollArea
|
<StyledScrollArea
|
||||||
|
ref={ref}
|
||||||
scrollbarSize={12}
|
scrollbarSize={12}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</StyledScrollArea>
|
</StyledScrollArea>
|
||||||
);
|
);
|
||||||
};
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user