import React from 'react';
import type { SectionListProps } from 'react-native';
import { SectionList } from 'react-native';
import AnimatedScroller from './AnimatedScrollable';
import type { ActionGroupProps } from '../FAB/ActionGroup';
import type { FABProps } from '../FAB/FAB';

interface SectionListWithFABProps<T> extends SectionListProps<T> {
  /**
   * FAB or FAB.ActionGroup props props.
   */
  fabProps: FABProps | ActionGroupProps;
}

function SectionListWithFAB<T>({
  fabProps,
  ...props
}: SectionListWithFABProps<T>) {
  return (
    <AnimatedScroller
      ScrollComponent={<SectionList {...props} />}
      fabProps={fabProps}
    />
  );
}

export default SectionListWithFAB;
