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 { SectionList, SectionListProps as RNSectionListProps } from "react-native"; type SectionListProps = RemoveStyles> & { contentContainerStyle?: FilterStyles["contentContainerStyle"]>; style?: FilterStyles["style"]>; }; export type SectionListBoxProps = ScrollableBoxProps & SectionListProps; interface SectionComponentFunctionType { (props: SectionListBoxProps, ref: ForwardedRef>): JSX.Element; } export const SectionListBox = forwardRef(function SectionListBox( { style, contentContainerStyle, ...props }: SectionListBoxProps, ref: ForwardedRef> ) { const { contentContainerStyles, styles, ...rest } = useResolveBoxListTokens(props); const color = useContext(BackgroundContext); return ( ref={ref} contentContainerStyle={[contentContainerStyles, contentContainerStyle]} style={[styles, style]} {...rest} /> ); }) as SectionComponentFunctionType;