import { FlatList } from 'react-native';
import { UserItem } from '../UserItem';
import { Empty } from '../../../../../components';
import { useStyles } from './styles';
export function UserList({
  data,
  profileId,
  keyExtractor,
  isLoading,
  isLoadingFirstPage,
  hasMore,
  loadMore
}) {
  const {
    styles
  } = useStyles();
  return /*#__PURE__*/React.createElement(FlatList, {
    data: data,
    contentContainerStyle: styles.container,
    keyExtractor: item => keyExtractor(item),
    renderItem: ({
      item
    }) => /*#__PURE__*/React.createElement(UserItem, {
      profileId: profileId,
      userId: keyExtractor(item)
    }),
    ListEmptyComponent: !isLoading && !isLoadingFirstPage ? /*#__PURE__*/React.createElement(Empty, {
      heightPercent: 0.7
    }, /*#__PURE__*/React.createElement(Empty.Content, {
      icon: "list",
      title: "Nothing here to see yet"
    })) : null,
    ListFooterComponent: isLoading || isLoadingFirstPage ? /*#__PURE__*/React.createElement(React.Fragment, null, Array.from({
      length: 3
    }).map((_, index) => /*#__PURE__*/React.createElement(UserItem.Skeleton, {
      key: index
    }))) : null,
    onEndReached: hasMore && !isLoading && !isLoadingFirstPage ? () => loadMore === null || loadMore === void 0 ? void 0 : loadMore() : undefined
  });
}
//# sourceMappingURL=UserList.js.map