import { ListRenderItemInfo, View } from 'react-native'; import { useColors } from '../../hook/useColors'; import { Alert } from '../../ui/Alert'; import { FlatListFactory } from '../../ui/FlatList'; import { BottomSheetNameMenu } from '../BottomSheetMenu/BottomSheetNameMenu'; import { EmptyPlaceholder, ErrorPlaceholder, LoadingPlaceholder, } from '../Placeholder'; import { SearchStyle } from '../SearchStyle'; import { TopNavigationBar, TopNavigationBarLeft } from '../TopNavigationBar'; import { useGroupList } from './GroupList.hooks'; import type { GroupListItemProps, GroupListProps } from './types'; const FlatList = FlatListFactory(); /** * Group List Component. */ export function GroupList(props: GroupListProps) { const { containerStyle, onBack, navigationBarVisible, customNavigationBar, searchStyleVisible = false, customSearch, onClickedSearch, } = props; const { data, refreshing, onRefresh, ref, onMore, viewabilityConfig, onViewableItemsChanged, listState, onClicked, onLongPress, tr, ListItemRender, menuRef, alertRef, closeMenu, flatListProps, groupCount, onReload, } = useGroupList(props); const { style, contentContainerStyle, refreshing: propsRefreshing, onRefresh: propsOnRefresh, onEndReached: propsOnEndReached, viewabilityConfig: propsViewabilityConfig, onViewableItemsChanged: propsOnViewableItemsChanged, ...others } = flatListProps ?? {}; const { getColor } = useColors(); return ( {navigationBarVisible !== false ? ( customNavigationBar ? ( <>{customNavigationBar} ) : ( } Right={} /> ) ) : null} {searchStyleVisible !== false ? ( customSearch ? ( <>{customSearch} ) : ( { onClickedSearch?.(); }} /> ) ) : null} ) => { const { item } = info; return ( ); }} keyExtractor={(item: GroupListItemProps) => { return item.id; }} onEndReached={propsOnEndReached ?? onMore} viewabilityConfig={propsViewabilityConfig ?? viewabilityConfig} onViewableItemsChanged={ propsOnViewableItemsChanged ?? onViewableItemsChanged } ListEmptyComponent={EmptyPlaceholder} ListErrorComponent={ listState === 'error' ? ( { onReload?.(); }} /> ) : null } ListLoadingComponent={ listState === 'loading' ? : null } {...others} /> ); }