import { FlatList, View } from 'react-native';
import { RequestItem } from '../RequestItem';
import { useStyles } from './styles';
import { Empty } from '../../../../../components';
function ItemSeparator() {
  const {
    styles
  } = useStyles();
  return /*#__PURE__*/React.createElement(View, {
    style: styles.divider
  });
}
export function RequestList({
  requests,
  hasMore,
  loadMore,
  isLoading,
  isLoadingFirstPage
}) {
  const {
    styles
  } = useStyles();
  return /*#__PURE__*/React.createElement(FlatList, {
    data: requests,
    keyExtractor: item => item.from,
    ItemSeparatorComponent: ItemSeparator,
    contentContainerStyle: styles.container,
    renderItem: ({
      item
    }) => /*#__PURE__*/React.createElement(RequestItem, {
      userId: item.from
    }),
    ListEmptyComponent: !isLoading && !isLoadingFirstPage ? /*#__PURE__*/React.createElement(Empty, {
      heightPercent: 0.8
    }, /*#__PURE__*/React.createElement(Empty.Content, {
      icon: "review",
      title: "No requests to review"
    })) : null,
    ListFooterComponent: isLoading || isLoadingFirstPage ? /*#__PURE__*/React.createElement(React.Fragment, null, Array.from({
      length: 3
    }).map((_, index) => /*#__PURE__*/React.createElement(RequestItem.Skeleton, {
      key: index
    }))) : null,
    onEndReached: () => {
      if (hasMore && !isLoading && !isLoadingFirstPage) {
        loadMore === null || loadMore === void 0 || loadMore();
      }
    }
  });
}
//# sourceMappingURL=RequestList.js.map