Skip to content

Commit 5b8f849

Browse files
committed
fix bug
1 parent 1887d30 commit 5b8f849

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/components/Table/TableBody.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ type TableBodyProps = ViewProps & {
4747
function TableBody<T>({contentContainerStyle, ...props}: TableBodyProps) {
4848
const styles = useThemeStyles();
4949
const {translate} = useLocalize();
50-
const {processedData: filteredAndSortedData, activeSearchString, listProps, hasActiveFilters, hasSearchString, isEmptyResult} = useTableContext<T>();
50+
const {processedData: filteredAndSortedData, activeFilters, activeSearchString, listProps, hasActiveFilters, hasSearchString, isEmptyResult} = useTableContext<T>();
5151
const {ListEmptyComponent, contentContainerStyle: listContentContainerStyle, ...restListProps} = listProps ?? {};
52+
const listKey = JSON.stringify(activeFilters);
5253

5354
// Determine the message based on what caused the empty result
5455
const getEmptyMessage = () => {
@@ -83,6 +84,7 @@ function TableBody<T>({contentContainerStyle, ...props}: TableBodyProps) {
8384
{...props}
8485
>
8586
<FlashList<T>
87+
key={listKey}
8688
data={filteredAndSortedData}
8789
ListEmptyComponent={isEmptyResult ? EmptyResultComponent : ListEmptyComponent}
8890
contentContainerStyle={[filteredAndSortedData.length === 0 && styles.flex1, listContentContainerStyle, contentContainerStyle]}

0 commit comments

Comments
 (0)