import { FlatList, StyleSheet, View } from 'react-native';
import { memo } from 'react';
import { TabName } from '../../../../enums/enumTabName';
import SearchResultItem from '../../../../components/SearchResultItem/SearchResultItem';
import { ComponentID, PageID } from '../../../../enums';
import { useAmityComponent } from '../../../../hooks';
const AmityUserSearchResultComponent = ({
  searchResult,
  onNextPage,
  pageId = PageID.WildCardPage
}) => {
  const searchType = TabName.Users;
  const componentId = ComponentID.community_search_result;
  const {
    isExcluded
  } = useAmityComponent({
    pageId,
    componentId
  });
  const styles = StyleSheet.create({
    container: {
      flex: 1
    }
  });
  const renderSearchResultItem = ({
    item
  }) => {
    return /*#__PURE__*/React.createElement(SearchResultItem, {
      item: item,
      searchType: searchType,
      pageId: pageId,
      componentId: componentId
    });
  };
  if (isExcluded) return null;
  if (!(searchResult !== null && searchResult !== void 0 && searchResult.length)) return null;
  return /*#__PURE__*/React.createElement(View, {
    style: styles.container
  }, /*#__PURE__*/React.createElement(FlatList, {
    data: searchResult,
    renderItem: renderSearchResultItem,
    keyExtractor: (_, index) => index.toString(),
    onEndReached: () => {
      onNextPage && onNextPage();
    }
  }));
};
export default /*#__PURE__*/memo(AmityUserSearchResultComponent);
//# sourceMappingURL=UserSearchResult.js.map