From 097cf3425b266239b4982db438a400d9ea55ea34 Mon Sep 17 00:00:00 2001 From: Lukasz Modzelewski Date: Wed, 31 Dec 2025 13:12:18 +0100 Subject: [PATCH] Remove SearchList isFocused --- .../Search/SearchList/BaseSearchList/index.tsx | 5 +++-- .../Search/SearchList/BaseSearchList/types.ts | 3 --- src/components/Search/SearchList/index.tsx | 10 ++-------- src/components/Search/index.tsx | 1 - 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/components/Search/SearchList/BaseSearchList/index.tsx b/src/components/Search/SearchList/BaseSearchList/index.tsx index 0888bc157378..ed53c01db505 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, @@ -33,6 +33,7 @@ function BaseSearchList({ selectedTransactions, }: BaseSearchListProps) { const hasKeyBeenPressed = useRef(false); + const isFocused = useIsFocused(); const setHasKeyBeenPressed = useCallback(() => { if (hasKeyBeenPressed.current) { @@ -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 ( 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 9d82f44df1b3..0b949608a6d1 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; @@ -168,7 +165,6 @@ function SearchList({ shouldPreventLongPressRow, queryJSON, columns, - isFocused, onViewableItemsChanged, onLayout, shouldAnimate, @@ -378,10 +374,10 @@ function SearchList({ return (