From 0026700bbf5a711d9a33a02375e86aa70a878855 Mon Sep 17 00:00:00 2001 From: Povilas Zirgulis Date: Thu, 9 Jan 2025 21:31:31 +0200 Subject: [PATCH] render 5 initial items in search screen on mobile --- src/components/Search/index.tsx | 1 + src/components/SelectionList/BaseSelectionList.tsx | 3 ++- src/components/SelectionList/types.ts | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index f5e27896c8e4..03b6c820da00 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -520,6 +520,7 @@ function Search({queryJSON, onSearchListScroll, isSearchScreenFocused, contentCo scrollEventThrottle={1} shouldKeepFocusedItemAtTopOfViewableArea={type === CONST.SEARCH.DATA_TYPES.CHAT} isScreenFocused={isSearchScreenFocused} + initialNumToRender={shouldUseNarrowLayout ? 5 : undefined} /> ); } diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index 4738bf6a92d8..2ad3fe8262cd 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -119,6 +119,7 @@ function BaseSelectionList( shouldScrollToFocusedIndex = true, onContentSizeChange, listItemTitleStyles, + initialNumToRender = 12, }: BaseSelectionListProps, ref: ForwardedRef, ) { @@ -831,7 +832,7 @@ function BaseSelectionList( indicatorStyle="white" keyboardShouldPersistTaps="always" showsVerticalScrollIndicator={showScrollIndicator} - initialNumToRender={12} + initialNumToRender={initialNumToRender} maxToRenderPerBatch={maxToRenderPerBatch} windowSize={windowSize} updateCellsBatchingPeriod={updateCellsBatchingPeriod} diff --git a/src/components/SelectionList/types.ts b/src/components/SelectionList/types.ts index 19c47414b089..5c7bd13d97e6 100644 --- a/src/components/SelectionList/types.ts +++ b/src/components/SelectionList/types.ts @@ -633,6 +633,9 @@ type BaseSelectionListProps = Partial & { /** Called when scrollable content view of the ScrollView changes */ onContentSizeChange?: (w: number, h: number) => void; + + /** Initial number of items to render */ + initialNumToRender?: number; } & TRightHandSideComponent; type SelectionListHandle = {