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

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

function FlatListWithFAB<T>({ fabProps, ...props }: FlatListWithFABProps<T>) {
  return (
    <AnimatedScroller
      ScrollComponent={<FlatList {...props} />}
      fabProps={fabProps}
    />
  );
}

export default FlatListWithFAB;
