diff --git a/src/components/Search/SearchList/BaseSearchList/index.tsx b/src/components/Search/SearchList/BaseSearchList/index.tsx index d30bc170bbd5..05553d602645 100644 --- a/src/components/Search/SearchList/BaseSearchList/index.tsx +++ b/src/components/Search/SearchList/BaseSearchList/index.tsx @@ -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'; @@ -20,7 +21,6 @@ function BaseSearchList({ keyExtractor, onScroll, ref, - isFocused, scrollToIndex, onEndReached, onEndReachedThreshold, @@ -34,6 +34,7 @@ function BaseSearchList({ customCardNames, }: BaseSearchListProps) { const hasKeyBeenPressed = useRef(false); + const isFocused = useIsFocused(); const setHasKeyBeenPressed = useCallback(() => { if (hasKeyBeenPressed.current) { @@ -104,8 +105,8 @@ function BaseSearchList({ }, [setHasKeyBeenPressed]); const extraData = useMemo( - () => [focusedIndex, isFocused, columns, newTransactions, selectedTransactions, customCardNames], - [focusedIndex, isFocused, columns, newTransactions, selectedTransactions, customCardNames], + () => [focusedIndex, columns, newTransactions, selectedTransactions, customCardNames], + [focusedIndex, columns, newTransactions, selectedTransactions, customCardNames], ); return ( diff --git a/src/components/Search/SearchList/BaseSearchList/types.ts b/src/components/Search/SearchList/BaseSearchList/types.ts index b7e29e1fdf1c..e0fe33cadc93 100644 --- a/src/components/Search/SearchList/BaseSearchList/types.ts +++ b/src/components/Search/SearchList/BaseSearchList/types.ts @@ -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>; diff --git a/src/components/Search/SearchList/index.tsx b/src/components/Search/SearchList/index.tsx index ec02f483f0cc..dddc4a080a44 100644 --- a/src/components/Search/SearchList/index.tsx +++ b/src/components/Search/SearchList/index.tsx @@ -100,9 +100,6 @@ type SearchListProps = Pick, '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>; viewableItems: Array>}) => void; @@ -174,7 +171,6 @@ function SearchList({ shouldPreventLongPressRow, queryJSON, columns, - isFocused, onViewableItemsChanged, onLayout, shouldAnimate, @@ -386,10 +382,10 @@ function SearchList({ return (