import { BackgroundContext } from "design-system/hooks/useBackgroundColor"; import { FilterStyles, RemoveStyles, ScrollableBoxProps, useResolveBoxListTokens, } from "design-system/hooks/useResolveBoxListTokens"; import React, { ForwardedRef, forwardRef, useContext } from "react"; import { FlatListProps as RNFlatListProps } from "react-native"; import Animated, { AnimateProps } from "react-native-reanimated"; type FlatListProps = RemoveStyles> & { contentContainerStyle?: FilterStyles["contentContainerStyle"]>; style?: FilterStyles["style"]>; }; export type AnimatedFlatListBoxProps = ScrollableBoxProps & AnimateProps>; interface AnimatedFlatListComponentType { (props: AnimatedFlatListBoxProps, ref: ForwardedRef>): JSX.Element; } export const AnimatedFlatListBox = forwardRef(function FlatListBox( { style, contentContainerStyle, ...props }: AnimatedFlatListBoxProps, ref: ForwardedRef> ) { const { contentContainerStyles, styles, ...rest } = useResolveBoxListTokens(props); const color = useContext(BackgroundContext); return ( ref={ref} contentContainerStyle={[contentContainerStyles, contentContainerStyle]} style={[styles, style]} {...rest} /> ); }) as AnimatedFlatListComponentType;