import { FlashList } from "@shopify/flash-list"; import { useAtom } from "jotai"; import type React from "react"; import type { PropsWithChildren } from "react"; import { apiAtom, userAtom } from "@/providers/JellyfinProvider"; import { Text } from "../common/Text"; type SearchItemWrapperProps = { items?: T[]; renderItem: (item: any) => React.ReactNode; header?: string; onEndReached?: (() => void) | null | undefined; }; export const SearchItemWrapper = ({ items, renderItem, header, onEndReached, }: PropsWithChildren>) => { const [_api] = useAtom(apiAtom); const [_user] = useAtom(userAtom); if (!items || items.length === 0) return null; return ( <> {header} index.toString()} estimatedItemSize={250} /*@ts-ignore */ data={items} onEndReachedThreshold={1} onEndReached={onEndReached} //@ts-ignore renderItem={({ item }) => (item ? renderItem(item) : null)} /> ); };