Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/components/Search/SearchList/BaseSearchList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useIsFocused} from '@react-navigation/native';
import {FlashList} from '@shopify/flash-list';
import React, {useCallback, useEffect, useMemo, useRef} from 'react';
import type {NativeSyntheticEvent} from 'react-native';
Expand All @@ -20,7 +21,6 @@ function BaseSearchList({
keyExtractor,
onScroll,
ref,
isFocused,
scrollToIndex,
onEndReached,
onEndReachedThreshold,
Expand All @@ -33,6 +33,7 @@ function BaseSearchList({
selectedTransactions,
}: BaseSearchListProps) {
const hasKeyBeenPressed = useRef(false);
const isFocused = useIsFocused();

const setHasKeyBeenPressed = useCallback(() => {
if (hasKeyBeenPressed.current) {
Expand Down Expand Up @@ -102,7 +103,7 @@ function BaseSearchList({
return () => removeKeyDownPressListener(setHasKeyBeenPressed);
}, [setHasKeyBeenPressed]);

const extraData = useMemo(() => [focusedIndex, isFocused, columns, newTransactions, selectedTransactions], [focusedIndex, isFocused, columns, newTransactions, selectedTransactions]);
const extraData = useMemo(() => [focusedIndex, columns, newTransactions, selectedTransactions], [focusedIndex, columns, newTransactions, selectedTransactions]);

return (
<AnimatedFlashListComponent
Expand Down
3 changes: 0 additions & 3 deletions src/components/Search/SearchList/BaseSearchList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ type BaseSearchListProps = Pick<
/** The callback, which is run when a row is pressed */
onSelectRow: (item: SearchListItem) => void;

/** Whether the screen containing the list is focused */
isFocused?: boolean;

/** The ref to the list */
ref: ForwardedRef<FlashListRef<SearchListItem>>;

Expand Down
10 changes: 2 additions & 8 deletions src/components/Search/SearchList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ type SearchListProps = Pick<FlashListProps<SearchListItem>, 'onScroll' | 'conten
/** Columns to show */
columns: SearchColumnType[];

/** Whether the screen is focused */
isFocused: boolean;

/** Called when the viewability of rows changes, as defined by the viewabilityConfig prop. */
onViewableItemsChanged?: (info: {changed: Array<ViewToken<SearchListItem>>; viewableItems: Array<ViewToken<SearchListItem>>}) => void;

Expand Down Expand Up @@ -168,7 +165,6 @@ function SearchList({
shouldPreventLongPressRow,
queryJSON,
columns,
isFocused,
onViewableItemsChanged,
onLayout,
shouldAnimate,
Expand Down Expand Up @@ -378,10 +374,10 @@ function SearchList({

return (
<Animated.View
exiting={shouldApplyAnimation && isFocused ? FadeOutUp.duration(CONST.SEARCH.EXITING_ANIMATION_DURATION).easing(easing) : undefined}
exiting={shouldApplyAnimation ? FadeOutUp.duration(CONST.SEARCH.EXITING_ANIMATION_DURATION).easing(easing) : undefined}
entering={undefined}
style={styles.overflowHidden}
layout={shouldApplyAnimation && hasItemsBeingRemoved && isFocused ? LinearTransition.easing(easing).duration(CONST.SEARCH.EXITING_ANIMATION_DURATION) : undefined}
layout={shouldApplyAnimation && hasItemsBeingRemoved ? LinearTransition.easing(easing).duration(CONST.SEARCH.EXITING_ANIMATION_DURATION) : undefined}
>
<ListItem
showTooltip
Expand Down Expand Up @@ -418,7 +414,6 @@ function SearchList({
groupBy,
newTransactions,
shouldAnimate,
isFocused,
data.length,
itemsWithSelection,
styles.overflowHidden,
Expand Down Expand Up @@ -490,7 +485,6 @@ function SearchList({
ref={listRef}
columns={columns}
scrollToIndex={scrollToIndex}
isFocused={isFocused}
flattenedItemsLength={flattenedItems.length}
onEndReached={onEndReached}
onEndReachedThreshold={onEndReachedThreshold}
Expand Down
1 change: 0 additions & 1 deletion src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,6 @@ function Search({
canSelectMultiple={canSelectMultiple}
selectedTransactions={selectedTransactions}
shouldPreventLongPressRow={isChat || isTask}
isFocused={isFocused}
onDEWModalOpen={handleDEWModalOpen}
SearchTableHeader={
!shouldShowTableHeader ? undefined : (
Expand Down
Loading