import { forwardRef, ReactElement, ReactNode, useCallback } from "react" import { ScrollViewProps, SectionList, SectionListProps } from "react-native" import { KeyboardAwareScrollView } from "react-native-keyboard-controller" import { DEFAULT_BOTTOM_OFFSET } from "@/components/Screen" type SectionType = { name: string description: string data: ItemType[] } type SectionListWithKeyboardAwareScrollViewProps = SectionListProps & { /* Optional function to pass a custom scroll component */ renderScrollComponent?: (props: ScrollViewProps) => ReactNode /* Optional additional offset between TextInput bottom edge and keyboard top edge. See https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-aware-scroll-view#bottomoffset */ bottomOffset?: number /* The sections to be rendered in the list */ sections: SectionType[] /* Function to render the header for each section */ renderSectionHeader: ({ section }: { section: SectionType }) => React.ReactNode } function SectionListWithKeyboardAwareScrollView( { renderScrollComponent, bottomOffset = DEFAULT_BOTTOM_OFFSET, contentContainerStyle, ...props }: SectionListWithKeyboardAwareScrollViewProps, ref: React.Ref>, ): ReactElement { const defaultRenderScrollComponent = useCallback( (props: ScrollViewProps) => ( ), [contentContainerStyle, bottomOffset], ) return ( ) } export default forwardRef(SectionListWithKeyboardAwareScrollView) as ( props: SectionListWithKeyboardAwareScrollViewProps & { ref?: React.Ref> }, ) => ReactElement