diff --git a/src/react/VList.spec.tsx b/src/react/VList.spec.tsx index e3b02a61..c77f17ec 100644 --- a/src/react/VList.spec.tsx +++ b/src/react/VList.spec.tsx @@ -35,11 +35,9 @@ it("should pass attributes to element", () => { it("should pass index to items", () => { const Item = forwardRef( - ({ children, index, style }, ref) => { + ({ index, ...rest }, ref) => { return ( -
- {children} -
+
); } ); diff --git a/src/react/WindowVirtualizer.spec.tsx b/src/react/WindowVirtualizer.spec.tsx index f1be4c2d..48705f44 100644 --- a/src/react/WindowVirtualizer.spec.tsx +++ b/src/react/WindowVirtualizer.spec.tsx @@ -14,11 +14,9 @@ afterEach(cleanup); it("should pass index to items", () => { const Item = forwardRef( - ({ children, index, style }, ref) => { + ({ index, ...rest }, ref) => { return ( -
- {children} -
+
); } ); diff --git a/src/react/types.ts b/src/react/types.ts index ba0f7f76..a505044e 100644 --- a/src/react/types.ts +++ b/src/react/types.ts @@ -1,4 +1,4 @@ -import { CSSProperties, ReactNode } from "react"; +import { ComponentType, CSSProperties, LegacyRef, ReactNode } from "react"; export type ViewportComponentAttributes = Pick< React.HTMLAttributes, @@ -9,12 +9,14 @@ export type ViewportComponentAttributes = Pick< export interface CustomContainerComponentProps { style: CSSProperties; children: ReactNode; + /** + * only available after React 19 + */ + ref?: LegacyRef; } -export type CustomContainerComponent = React.ForwardRefExoticComponent< - React.PropsWithoutRef & - React.RefAttributes ->; +export type CustomContainerComponent = + ComponentType; /** * Props of customized item component for {@link Virtualizer} or {@link WindowVirtualizer}. @@ -23,8 +25,10 @@ export interface CustomItemComponentProps { style: CSSProperties; index: number; children: ReactNode; + /** + * only available after React 19 + */ + ref?: LegacyRef; } -export type CustomItemComponent = React.ForwardRefExoticComponent< - React.PropsWithoutRef & React.RefAttributes ->; +export type CustomItemComponent = ComponentType;