Skip to content

Instantly share code, notes, and snippets.

@gwendall
Created January 14, 2023 18:04
Show Gist options
  • Save gwendall/7b04b571dcd8e19ec613b2f35d77a5bc to your computer and use it in GitHub Desktop.
Save gwendall/7b04b571dcd8e19ec613b2f35d77a5bc to your computer and use it in GitHub Desktop.
FixedSizeList + SimpleBarReact
import SimpleBarReact from 'simplebar-react';
import { FixedSizeList } from 'react-window';
import React from 'react';
const FixedSizeListSimpleBar: React.FC<typeof FixedSizeList & {
className?: string;
height?: number;
children: React.ReactNode;
}> = ({
className,
height,
children,
...props
}) => (
<SimpleBarReact className={ className } style={ { height } }>
{
// @ts-ignore
({ scrollableNodeRef, contentNodeRef }) => {
return (
<FixedSizeList
height={ height }
outerRef={ scrollableNodeRef }
innerRef={ contentNodeRef }
className="simplebar-content-wrapper"
{ ...props }
>
{ children }
</FixedSizeList>
);
}
}
</SimpleBarReact>
);
export default FixedSizeListSimpleBar;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment