import { ListRenderItemInfo, View } from 'react-native'; import { useColors } from '../../hook'; import { Alert } from '../../ui/Alert'; import { FlatListFactory } from '../../ui/FlatList'; import { BottomSheetNameMenu } from '../BottomSheetMenu'; import { EmptyPlaceholder, ErrorPlaceholder } from '../Placeholder'; import { SearchStyle } from '../SearchStyle'; import { TopNavigationBar, TopNavigationBarLeft, TopNavigationBarRight, TopNavigationBarTitle, } from '../TopNavigationBar'; import { useNewRequests } from './NewRequests.hooks'; import type { NewRequestsItemProps, NewRequestsProps } from './types'; const FlatList = FlatListFactory(); /** * New Requests Component. * * This component displays and manages contact requests. */ export function NewRequests(props: NewRequestsProps) { const { containerStyle, onBack, navigationBarVisible, customNavigationBar, searchStyleVisible = false, customSearch, onClickedSearch, } = props; const { data, refreshing, onRefresh, ref, onMore, viewabilityConfig, onViewableItemsChanged, listState, onClicked, onLongPressed, onButtonClicked, tr, ListItemRender, onAddContact, menuRef, alertRef, onRequestCloseMenu, } = useNewRequests(props); const { getColor } = useColors(); return ( {navigationBarVisible !== false ? ( customNavigationBar ? ( <>{customNavigationBar} ) : ( } Right={TopNavigationBarRight} RightProps={{ onClicked: () => { onAddContact(); }, iconName: 'person_add', }} Title={} /> ) ) : null} {searchStyleVisible !== false ? ( customSearch ? ( <>{customSearch} ) : ( { onClickedSearch?.(); }} /> ) ) : null} ) => { const { item } = info; return ( ); }} keyExtractor={(item: NewRequestsItemProps) => { return item.id; }} onEndReached={onMore} viewabilityConfig={viewabilityConfig} onViewableItemsChanged={onViewableItemsChanged} ListEmptyComponent={EmptyPlaceholder} ListErrorComponent={ listState === 'error' ? ( { onRefresh?.(); }} /> ) : null } /> ); }