Created
January 14, 2023 18:04
-
-
Save gwendall/7b04b571dcd8e19ec613b2f35d77a5bc to your computer and use it in GitHub Desktop.
FixedSizeList + SimpleBarReact
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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